open-nomad/ui/app/controllers/jobs/job/definition.js

30 lines
758 B
JavaScript
Raw Normal View History

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