github.com/blixtra/nomad@v0.7.2-0.20171221000451-da9a1d7bb050/ui/app/routes/jobs/job.js (about)

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