-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4189 from hashicorp/f-ui-stop-job-button
UI: Stop job button
- Loading branch information
Showing
24 changed files
with
527 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import Component from '@ember/component'; | ||
|
||
export default Component.extend({ | ||
tagName: '', | ||
|
||
errorMessage: null, | ||
onDismiss() {}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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.', | ||
}); | ||
}); | ||
}, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import Component from '@ember/component'; | ||
import { equal } from '@ember/object/computed'; | ||
|
||
export default Component.extend({ | ||
classNames: ['two-step-button'], | ||
|
||
idleText: '', | ||
cancelText: '', | ||
confirmText: '', | ||
confirmationMessage: '', | ||
onConfirm() {}, | ||
onCancel() {}, | ||
|
||
state: 'idle', | ||
isIdle: equal('state', 'idle'), | ||
isPendingConfirmation: equal('state', 'prompt'), | ||
|
||
actions: { | ||
setToIdle() { | ||
this.set('state', 'idle'); | ||
}, | ||
promptForConfirmation() { | ||
this.set('state', 'prompt'); | ||
}, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,19 @@ | ||
@import "./components/badge"; | ||
@import "./components/boxed-section"; | ||
@import "./components/cli-window"; | ||
@import "./components/ember-power-select"; | ||
@import "./components/empty-message"; | ||
@import "./components/error-container"; | ||
@import "./components/gutter"; | ||
@import "./components/inline-definitions"; | ||
@import "./components/job-diff"; | ||
@import "./components/json-viewer"; | ||
@import "./components/loading-spinner"; | ||
@import "./components/metrics"; | ||
@import "./components/node-status-light"; | ||
@import "./components/page-layout"; | ||
@import "./components/simple-list"; | ||
@import "./components/status-text"; | ||
@import "./components/timeline"; | ||
@import "./components/tooltip"; | ||
@import './components/badge'; | ||
@import './components/boxed-section'; | ||
@import './components/cli-window'; | ||
@import './components/ember-power-select'; | ||
@import './components/empty-message'; | ||
@import './components/error-container'; | ||
@import './components/gutter'; | ||
@import './components/inline-definitions'; | ||
@import './components/job-diff'; | ||
@import './components/json-viewer'; | ||
@import './components/loading-spinner'; | ||
@import './components/metrics'; | ||
@import './components/node-status-light'; | ||
@import './components/page-layout'; | ||
@import './components/simple-list'; | ||
@import './components/status-text'; | ||
@import './components/timeline'; | ||
@import './components/tooltip'; | ||
@import './components/two-step-button'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
.two-step-button { | ||
display: inline; | ||
position: relative; | ||
|
||
.confirmation-text { | ||
position: absolute; | ||
left: 0; | ||
top: -1.2em; | ||
font-size: $body-size; | ||
font-weight: $weight-normal; | ||
color: darken($grey-blue, 20%); | ||
white-space: nowrap; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{{#if errorMessage}} | ||
<div class="notification is-danger"> | ||
<div class="columns"> | ||
<div class="column"> | ||
<h3 data-test-job-error-title class="title is-4">{{errorMessage.title}}</h3> | ||
<p data-test-job-error-body>{{errorMessage.description}}</p> | ||
</div> | ||
<div class="column is-centered is-minimum"> | ||
<button data-test-job-error-close class="button is-danger" onclick={{action onDismiss}}>Okay</button> | ||
</div> | ||
</div> | ||
</div> | ||
{{/if}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<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 | ||
data-test-stop | ||
idleText="Stop" | ||
cancelText="Cancel" | ||
confirmText="Yes, Stop" | ||
confirmationMessage="Are you sure you want to stop this job?" | ||
onConfirm=(action "stopJob")}} | ||
{{/if}} | ||
</h1> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{{#if isIdle}} | ||
<button data-test-idle-button type="button" class="button is-warning is-small is-inline" onclick={{action "promptForConfirmation"}}> | ||
{{idleText}} | ||
</button> | ||
{{else if isPendingConfirmation}} | ||
<span data-test-confirmation-message class="confirmation-text">{{confirmationMessage}}</span> | ||
<button data-test-cancel-button type="button" class="button is-dark is-outlined is-small is-inline" onclick={{action (queue | ||
(action "setToIdle") | ||
(action onCancel) | ||
)}}> | ||
{{cancelText}} | ||
</button> | ||
<button data-test-confirm-button class="button is-danger is-small is-inline" onclick={{action (queue | ||
(action "setToIdle") | ||
(action onConfirm) | ||
)}}> | ||
{{confirmText}} | ||
</button> | ||
{{/if}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.