2017-12-15 21:39:18 +00:00
|
|
|
import { inject as service } from '@ember/service';
|
|
|
|
import { get } from '@ember/object';
|
|
|
|
import { assign } from '@ember/polyfills';
|
2017-11-29 01:21:56 +00:00
|
|
|
import ApplicationSerializer from './application';
|
|
|
|
|
|
|
|
export default ApplicationSerializer.extend({
|
2017-12-15 21:39:18 +00:00
|
|
|
system: service(),
|
2017-11-29 01:21:56 +00:00
|
|
|
|
|
|
|
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);
|
|
|
|
},
|
|
|
|
});
|