2017-12-15 21:39:18 +00:00
|
|
|
import { inject as service } from '@ember/service';
|
|
|
|
import Route from '@ember/routing/route';
|
|
|
|
import RSVP from 'rsvp';
|
2017-09-28 17:06:13 +00:00
|
|
|
import notifyError from 'nomad-ui/utils/notify-error';
|
2018-06-27 19:48:26 +00:00
|
|
|
import { jobCrumbs } from 'nomad-ui/utils/breadcrumb-utils';
|
2017-09-19 14:47:10 +00:00
|
|
|
|
|
|
|
export default Route.extend({
|
2017-12-15 21:39:18 +00:00
|
|
|
store: service(),
|
2018-02-08 23:06:10 +00:00
|
|
|
token: service(),
|
2017-09-19 14:47:10 +00:00
|
|
|
|
2018-06-27 19:48:26 +00:00
|
|
|
breadcrumbs: jobCrumbs,
|
2018-06-27 18:29:04 +00:00
|
|
|
|
2017-10-23 17:27:22 +00:00
|
|
|
serialize(model) {
|
|
|
|
return { job_name: model.get('plainId') };
|
|
|
|
},
|
|
|
|
|
|
|
|
model(params, transition) {
|
|
|
|
const namespace = transition.queryParams.namespace || this.get('system.activeNamespace.id');
|
|
|
|
const name = params.job_name;
|
2017-12-11 22:42:17 +00:00
|
|
|
const fullId = JSON.stringify([name, namespace || 'default']);
|
2017-09-19 14:47:10 +00:00
|
|
|
return this.get('store')
|
2017-10-23 17:27:22 +00:00
|
|
|
.findRecord('job', fullId, { reload: true })
|
|
|
|
.then(job => {
|
2017-11-29 01:24:30 +00:00
|
|
|
return RSVP.all([job.get('allocations'), job.get('evaluations')]).then(() => job);
|
2017-10-23 17:27:22 +00:00
|
|
|
})
|
2017-09-28 17:06:13 +00:00
|
|
|
.catch(notifyError(this));
|
2017-09-19 14:47:10 +00:00
|
|
|
},
|
|
|
|
});
|