mirror of
https://github.com/kemko/nomad.git
synced 2026-01-08 19:35:41 +03:00
36 lines
891 B
JavaScript
36 lines
891 B
JavaScript
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);
|
|
});
|
|
|
|
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)
|
|
);
|
|
},
|
|
});
|