2018-08-14 20:06:26 +00:00
|
|
|
import Route from '@ember/routing/route';
|
|
|
|
import { inject as service } from '@ember/service';
|
|
|
|
|
|
|
|
export default Route.extend({
|
2020-01-20 20:57:01 +00:00
|
|
|
can: service(),
|
2018-08-14 20:06:26 +00:00
|
|
|
store: service(),
|
2018-08-15 00:29:51 +00:00
|
|
|
system: service(),
|
2018-08-14 20:06:26 +00:00
|
|
|
|
2020-06-09 21:03:28 +00:00
|
|
|
breadcrumbs: Object.freeze([
|
2018-08-14 20:06:26 +00:00
|
|
|
{
|
|
|
|
label: 'Run',
|
|
|
|
args: ['jobs.run'],
|
|
|
|
},
|
2020-06-09 21:03:28 +00:00
|
|
|
]),
|
2018-08-15 00:29:51 +00:00
|
|
|
|
2020-01-20 20:57:01 +00:00
|
|
|
beforeModel() {
|
|
|
|
if (this.can.cannot('run job')) {
|
|
|
|
this.transitionTo('jobs');
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2018-08-15 00:29:51 +00:00
|
|
|
model() {
|
2019-03-26 07:46:44 +00:00
|
|
|
return this.store.createRecord('job', {
|
2018-08-15 00:29:51 +00:00
|
|
|
namespace: this.get('system.activeNamespace'),
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
resetController(controller, isExiting) {
|
|
|
|
if (isExiting) {
|
2019-03-26 07:46:44 +00:00
|
|
|
controller.model.deleteRecord();
|
2018-08-15 00:29:51 +00:00
|
|
|
}
|
|
|
|
},
|
2018-08-14 20:06:26 +00:00
|
|
|
});
|