open-nomad/ui/app/controllers/jobs/job/index.js
Michael Lange 4c34a04151 Work around the dreaded broken relationship ED bug
Summary can unlink from a job when loaded in the wrong order. This
guarantees that the summary is bound to the job detail view by
falling back to the summary in the store.
2018-03-22 20:14:37 -07:00

37 lines
916 B
JavaScript

import { inject as service } from '@ember/service';
import { alias } from '@ember/object/computed';
import Controller, { inject as controller } from '@ember/controller';
import WithNamespaceResetting from 'nomad-ui/mixins/with-namespace-resetting';
export default Controller.extend(WithNamespaceResetting, {
system: service(),
jobController: controller('jobs.job'),
queryParams: {
currentPage: 'page',
sortProperty: 'sort',
sortDescending: 'desc',
},
currentPage: 1,
sortProperty: 'name',
sortDescending: false,
breadcrumbs: alias('jobController.breadcrumbs'),
job: alias('model'),
actions: {
gotoTaskGroup(taskGroup) {
this.transitionToRoute('jobs.job.task-group', taskGroup.get('job'), taskGroup);
},
gotoJob(job) {
this.transitionToRoute('jobs.job', job, {
queryParams: { jobNamespace: job.get('namespace.name') },
});
},
},
});