github.com/emate/nomad@v0.8.2-wo-binpacking/ui/app/routes/jobs/job.js (about)

     1  import { inject as service } from '@ember/service';
     2  import Route from '@ember/routing/route';
     3  import RSVP from 'rsvp';
     4  import notifyError from 'nomad-ui/utils/notify-error';
     5  
     6  export default Route.extend({
     7    store: service(),
     8    token: service(),
     9  
    10    serialize(model) {
    11      return { job_name: model.get('plainId') };
    12    },
    13  
    14    model(params, transition) {
    15      const namespace = transition.queryParams.namespace || this.get('system.activeNamespace.id');
    16      const name = params.job_name;
    17      const fullId = JSON.stringify([name, namespace || 'default']);
    18      return this.get('store')
    19        .findRecord('job', fullId, { reload: true })
    20        .then(job => {
    21          return RSVP.all([job.get('allocations'), job.get('evaluations')]).then(() => job);
    22        })
    23        .catch(notifyError(this));
    24    },
    25  });