open-nomad/ui/app/serializers/evaluation.js
Michael Lange c86183154b Remove hacky code that worked around an Ember Data bug
The bug is fixed in 2.18, so this can be written in the normal
less surprising way.
2018-06-13 15:05:18 -07:00

25 lines
739 B
JavaScript

import { inject as service } from '@ember/service';
import { get } from '@ember/object';
import { assign } from '@ember/polyfills';
import ApplicationSerializer from './application';
export default ApplicationSerializer.extend({
system: service(),
normalize(typeHash, hash) {
hash.FailedTGAllocs = Object.keys(hash.FailedTGAllocs || {}).map(key => {
return assign({ Name: key }, get(hash, `FailedTGAllocs.${key}`) || {});
});
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]);
return this._super(typeHash, hash);
},
});