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';
|
2020-06-22 15:48:53 +00:00
|
|
|
import classic from 'ember-classic-decorator';
|
2017-11-29 01:21:56 +00:00
|
|
|
|
2020-06-22 15:48:53 +00:00
|
|
|
@classic
|
2020-06-10 13:49:16 +00:00
|
|
|
export default class Evaluation extends ApplicationSerializer {
|
|
|
|
@service system;
|
2017-11-29 01:21:56 +00:00
|
|
|
|
|
|
|
normalize(typeHash, hash) {
|
2018-12-13 00:07:56 +00:00
|
|
|
const failures = hash.FailedTGAllocs || {};
|
|
|
|
hash.FailedTGAllocs = Object.keys(failures).map(key => {
|
|
|
|
const propertiesForKey = failures[key] || {};
|
|
|
|
return assign({ Name: key }, propertiesForKey);
|
2017-11-29 01:21:56 +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]);
|
|
|
|
|
2019-08-22 13:11:24 +00:00
|
|
|
hash.ModifyTimeNanos = hash.ModifyTime % 1000000;
|
|
|
|
hash.ModifyTime = Math.floor(hash.ModifyTime / 1000000);
|
|
|
|
|
|
|
|
hash.CreateTimeNanos = hash.CreateTime % 1000000;
|
|
|
|
hash.CreateTime = Math.floor(hash.CreateTime / 1000000);
|
|
|
|
|
2020-06-10 13:49:16 +00:00
|
|
|
return super.normalize(typeHash, hash);
|
|
|
|
}
|
|
|
|
}
|