github.com/emate/nomad@v0.8.2-wo-binpacking/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      // TEMPORARY: https://github.com/emberjs/data/issues/5209
    23      hash.OriginalJobId = hash.JobID;
    24  
    25      return this._super(typeHash, hash);
    26    },
    27  });