open-nomad/ui/app/routes/jobs/run.js
Buck Doyle cd11cd290c Add manually-converted classes
I don’t know why the codemod ignored these files 🧐
2020-06-15 10:14:26 -05:00

36 lines
686 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 = 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();
}
}
}