open-nomad/ui/app/serializers/job-plan.js

15 lines
532 B
JavaScript
Raw Normal View History

import { assign } from '@ember/polyfills';
import ApplicationSerializer from './application';
2019-04-16 19:11:43 +00:00
import { get } from '@ember/object';
export default class JobPlan extends ApplicationSerializer {
normalize(typeHash, hash) {
const failures = hash.FailedTGAllocs || {};
hash.FailedTGAllocs = Object.keys(failures).map(key => {
return assign({ Name: key }, failures[key] || {});
});
2019-04-16 19:11:43 +00:00
hash.PreemptionIDs = (get(hash, 'Annotations.PreemptedAllocs') || []).mapBy('ID');
return super.normalize(...arguments);
}
}