2018-06-27 20:39:57 +00:00
|
|
|
import Controller from '@ember/controller';
|
2017-10-23 23:59:30 +00:00
|
|
|
import WithNamespaceResetting from 'nomad-ui/mixins/with-namespace-resetting';
|
2018-07-11 16:34:22 +00:00
|
|
|
import { alias } from '@ember/object/computed';
|
2020-06-10 13:49:16 +00:00
|
|
|
import classic from 'ember-classic-decorator';
|
2022-07-05 19:58:56 +00:00
|
|
|
import { inject as service } from '@ember/service';
|
2017-09-19 14:47:10 +00:00
|
|
|
|
2020-06-10 13:49:16 +00:00
|
|
|
@classic
|
2021-12-28 16:08:12 +00:00
|
|
|
export default class DefinitionController extends Controller.extend(
|
|
|
|
WithNamespaceResetting
|
|
|
|
) {
|
2020-06-10 13:49:16 +00:00
|
|
|
@alias('model.job') job;
|
|
|
|
@alias('model.definition') definition;
|
2022-07-05 19:58:56 +00:00
|
|
|
@service router;
|
2018-08-21 23:46:24 +00:00
|
|
|
|
2020-06-10 13:49:16 +00:00
|
|
|
isEditing = false;
|
2018-08-21 23:46:24 +00:00
|
|
|
|
|
|
|
edit() {
|
2019-03-26 07:46:44 +00:00
|
|
|
this.job.set('_newDefinition', JSON.stringify(this.definition, null, 2));
|
2018-08-21 23:46:24 +00:00
|
|
|
this.set('isEditing', true);
|
2020-06-10 13:49:16 +00:00
|
|
|
}
|
2018-08-21 23:46:24 +00:00
|
|
|
|
|
|
|
onCancel() {
|
|
|
|
this.set('isEditing', false);
|
2020-06-10 13:49:16 +00:00
|
|
|
}
|
2018-08-21 23:46:24 +00:00
|
|
|
|
2022-07-05 19:58:56 +00:00
|
|
|
onSubmit() {
|
|
|
|
this.router.transitionTo('jobs.job', this.job.idWithNamespace);
|
2020-06-10 13:49:16 +00:00
|
|
|
}
|
|
|
|
}
|