Move common title parts into a part component

This commit is contained in:
Michael Lange 2018-04-19 10:14:59 -07:00
parent bb61fda409
commit 60938b6eb6
2 changed files with 36 additions and 0 deletions

View 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.',
});
});
},
},
});

View 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>