github.com/zoomfoo/nomad@v0.8.5-0.20180907175415-f28fd3a1a056/ui/app/serializers/evaluation.js (about) 1 import { inject as service } from '@ember/service'; 2 import { get } from '@ember/object'; 3 import { assign } from '@ember/polyfills'; 4 import ApplicationSerializer from './application'; 5 6 export default ApplicationSerializer.extend({ 7 system: service(), 8 9 normalize(typeHash, hash) { 10 hash.FailedTGAllocs = Object.keys(hash.FailedTGAllocs || {}).map(key => { 11 return assign({ Name: key }, get(hash, `FailedTGAllocs.${key}`) || {}); 12 }); 13 14 hash.PlainJobId = hash.JobID; 15 hash.Namespace = 16 hash.Namespace || 17 get(hash, 'Job.Namespace') || 18 this.get('system.activeNamespace.id') || 19 'default'; 20 hash.JobID = JSON.stringify([hash.JobID, hash.Namespace]); 21 22 return this._super(typeHash, hash); 23 }, 24 });