open-nomad/ui/app/controllers/jobs/job/index.js
Michael Lange 7abf621441 On namespace change on a job detail page, redirect to /jobs
And reload jobs for the new namespace.
2017-10-23 17:42:36 -07:00

39 lines
985 B
JavaScript

import Ember from 'ember';
import Sortable from 'nomad-ui/mixins/sortable';
import WithNamespaceResetting from 'nomad-ui/mixins/with-namespace-resetting';
const { Controller, computed, inject } = Ember;
export default Controller.extend(Sortable, WithNamespaceResetting, {
system: inject.service(),
jobController: inject.controller('jobs.job'),
queryParams: {
currentPage: 'page',
sortProperty: 'sort',
sortDescending: 'desc',
},
currentPage: 1,
pageSize: 10,
sortProperty: 'name',
sortDescending: false,
breadcrumbs: computed.alias('jobController.breadcrumbs'),
job: computed.alias('model'),
taskGroups: computed('model.taskGroups.[]', function() {
return this.get('model.taskGroups') || [];
}),
listToSort: computed.alias('taskGroups'),
sortedTaskGroups: computed.alias('listSorted'),
actions: {
gotoTaskGroup(taskGroup) {
this.transitionToRoute('jobs.job.task-group', taskGroup.get('job'), taskGroup);
},
},
});