diff --git a/ui/app/components/job-page/parts/title.js b/ui/app/components/job-page/parts/title.js new file mode 100644 index 000000000..fb8e3232c --- /dev/null +++ b/ui/app/components/job-page/parts/title.js @@ -0,0 +1,23 @@ +import Component from '@ember/component'; + +export default Component.extend({ + tagName: '', + + job: null, + title: null, + + handleError() {}, + + actions: { + stopJob() { + this.get('job') + .stop() + .catch(() => { + this.get('handleError')({ + title: 'Could Not Stop Job', + description: 'Your ACL token does not grant permission to stop jobs.', + }); + }); + }, + }, +}); diff --git a/ui/app/templates/components/job-page/parts/title.hbs b/ui/app/templates/components/job-page/parts/title.hbs new file mode 100644 index 000000000..2de3064d3 --- /dev/null +++ b/ui/app/templates/components/job-page/parts/title.hbs @@ -0,0 +1,13 @@ +

+ {{or title job.name}} + {{job.status}} + {{yield}} + {{#if (not (eq job.status "dead"))}} + {{two-step-button + idleText="Stop" + cancelText="Cancel" + confirmText="Yes, Stop" + confirmationMessage="Are you sure you want to stop this job?" + onConfirm=(action "stopJob")}} + {{/if}} +