github.com/ferranbt/nomad@v0.9.3-0.20190607002617-85c449b7667c/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 const failures = hash.FailedTGAllocs || {}; 11 hash.FailedTGAllocs = Object.keys(failures).map(key => { 12 const propertiesForKey = failures[key] || {}; 13 return assign({ Name: key }, propertiesForKey); 14 }); 15 16 hash.PlainJobId = hash.JobID; 17 hash.Namespace = 18 hash.Namespace || 19 get(hash, 'Job.Namespace') || 20 this.get('system.activeNamespace.id') || 21 'default'; 22 hash.JobID = JSON.stringify([hash.JobID, hash.Namespace]); 23 24 return this._super(typeHash, hash); 25 }, 26 });