open-nomad/ui/app/routes/jobs/run.js
Michael Lange e8593ec1bb
ui: Update namespaces design (#10444)
This rethinks namespaces as a filter on list pages rather than a global setting.

The biggest net-new feature here is being able to select All (*) to list all jobs
or CSI volumes across namespaces.
2021-04-29 15:00:59 -05:00

38 lines
835 B
JavaScript

import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';
import classic from 'ember-classic-decorator';
@classic
export default class RunRoute extends Route {
@service can;
@service store;
@service system;
breadcrumbs = [
{
label: 'Run',
args: ['jobs.run'],
},
];
beforeModel() {
if (this.can.cannot('run job')) {
this.transitionTo('jobs');
}
}
model() {
// When jobs are created with a namespace attribute, it is verified against
// available namespaces to prevent redirecting to a non-existent namespace.
return this.store.findAll('namespace').then(() => {
return this.store.createRecord('job');
});
}
resetController(controller, isExiting) {
if (isExiting) {
controller.model.deleteRecord();
}
}
}