Move common title parts into a part component
This commit is contained in:
parent
bb61fda409
commit
60938b6eb6
23
ui/app/components/job-page/parts/title.js
Normal file
23
ui/app/components/job-page/parts/title.js
Normal file
|
@ -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.',
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
13
ui/app/templates/components/job-page/parts/title.hbs
Normal file
13
ui/app/templates/components/job-page/parts/title.hbs
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
<h1 class="title">
|
||||||
|
{{or title job.name}}
|
||||||
|
<span class="bumper-left tag {{job.statusClass}}" data-test-job-status>{{job.status}}</span>
|
||||||
|
{{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}}
|
||||||
|
</h1>
|
Loading…
Reference in a new issue