2017-09-19 14:47:10 +00:00
|
|
|
import Ember from 'ember';
|
|
|
|
import ApplicationSerializer from './application';
|
|
|
|
|
|
|
|
const { get, assign } = Ember;
|
|
|
|
|
|
|
|
export default ApplicationSerializer.extend({
|
|
|
|
attrs: {
|
|
|
|
versionNumber: 'JobVersion',
|
|
|
|
},
|
|
|
|
|
|
|
|
normalize(typeHash, hash) {
|
|
|
|
hash.TaskGroupSummaries = Object.keys(get(hash, 'TaskGroups') || {}).map(key => {
|
|
|
|
const deploymentStats = get(hash, `TaskGroups.${key}`);
|
|
|
|
return assign({ Name: key }, deploymentStats);
|
|
|
|
});
|
|
|
|
|
2017-10-23 17:22:58 +00:00
|
|
|
hash.PlainJobId = hash.JobID;
|
|
|
|
hash.Namespace =
|
|
|
|
hash.Namespace ||
|
|
|
|
get(hash, 'Job.Namespace') ||
|
|
|
|
this.get('system.activeNamespace.id') ||
|
|
|
|
'default';
|
|
|
|
hash.JobID = JSON.stringify([hash.JobID, hash.Namespace]);
|
|
|
|
|
2017-09-19 14:47:10 +00:00
|
|
|
return this._super(typeHash, hash);
|
|
|
|
},
|
|
|
|
|
|
|
|
extractRelationships(modelClass, hash) {
|
|
|
|
const namespace = this.store.adapterFor(modelClass.modelName).get('namespace');
|
|
|
|
const id = this.extractId(modelClass, hash);
|
|
|
|
|
|
|
|
return assign(
|
|
|
|
{
|
|
|
|
allocations: {
|
|
|
|
links: {
|
|
|
|
related: `/${namespace}/deployment/allocations/${id}`,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
this._super(modelClass, hash)
|
|
|
|
);
|
|
|
|
},
|
|
|
|
});
|