diff --git a/ui/app/components/two-step-button.js b/ui/app/components/two-step-button.js index cd29dd8aa..e1a593079 100644 --- a/ui/app/components/two-step-button.js +++ b/ui/app/components/two-step-button.js @@ -24,6 +24,7 @@ export default class TwoStepButton extends Component { inlineText = false; onConfirm() {} onCancel() {} + onPrompt() {} state = 'idle'; @equal('state', 'idle') isIdle; @@ -33,6 +34,9 @@ export default class TwoStepButton extends Component { while (true) { let ev = yield waitForEvent(document.body, 'click'); if (!this.element.contains(ev.target) && !this.awaitingConfirmation) { + if (this.onCancel) { + this.onCancel(); + } this.send('setToIdle'); } } @@ -47,6 +51,9 @@ export default class TwoStepButton extends Component { @action promptForConfirmation() { + if (this.onPrompt) { + this.onPrompt(); + } this.set('state', 'prompt'); next(() => { this.cancelOnClickOutside.perform(); diff --git a/ui/app/controllers/variables/variable/index.js b/ui/app/controllers/variables/variable/index.js index 3ac8028d5..46695cfac 100644 --- a/ui/app/controllers/variables/variable/index.js +++ b/ui/app/controllers/variables/variable/index.js @@ -1,4 +1,5 @@ import Controller from '@ember/controller'; +import { action } from '@ember/object'; import { task } from 'ember-concurrency'; import messageForError from '../../../utils/message-from-adapter-error'; import { inject as service } from '@ember/service'; @@ -10,6 +11,18 @@ export default class VariablesVariableIndexController extends Controller { @tracked error = null; + @tracked isDeleting = false; + + @action + onDeletePrompt() { + this.isDeleting = true; + } + + @action + onDeleteCancel() { + this.isDeleting = false; + } + @task(function* () { try { yield this.model.deleteRecord(); diff --git a/ui/app/templates/variables/variable/index.hbs b/ui/app/templates/variables/variable/index.hbs index 2f5d86736..a55e55bf1 100644 --- a/ui/app/templates/variables/variable/index.hbs +++ b/ui/app/templates/variables/variable/index.hbs @@ -22,23 +22,23 @@ {{/if}} -