open-nomad/ui/app/routes/jobs/run.js
Buck Doyle 1cca7abcab
Add Ember ESLint plugin (#8134)
This is extracted from #8094, where I have run into some snags. Since
these ESLint fixes aren’t actually connected to the Ember 3.16 update
but involve changes to many files, we might as well address them
separately. Where possible I fixed the problems but in cases where
a fix seemed too involved, I added per-line or -file exceptions.
2020-06-09 16:03:28 -05:00

34 lines
624 B
JavaScript

import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';
export default Route.extend({
can: service(),
store: service(),
system: service(),
breadcrumbs: Object.freeze([
{
label: 'Run',
args: ['jobs.run'],
},
]),
beforeModel() {
if (this.can.cannot('run job')) {
this.transitionTo('jobs');
}
},
model() {
return this.store.createRecord('job', {
namespace: this.get('system.activeNamespace'),
});
},
resetController(controller, isExiting) {
if (isExiting) {
controller.model.deleteRecord();
}
},
});