open-consul/ui-v2/app/components/confirmation-dialog/index.js
John Cowen ac629cd51e
ui: KV Form and List Components (#8307)
* Add components for KV form, KV list and Session form

* Pass through a @label attribute for a human label + don't require error

* Ignore transition aborted errors for if you are re-transitioning

* Make old confirmation dialog more ember-like and tagless

* Make sure data-source and data-sink supports KV and sessions

* Use new components and delete all the things

* Fix up tests

* Make list component tagless

* Add component pageobject and fixup tests from that

* Add eslint warning back in
2020-07-20 18:04:43 +01:00

28 lines
699 B
JavaScript

/*eslint ember/closure-actions: "warn"*/
import Component from '@ember/component';
import Slotted from 'block-slots';
import { set } from '@ember/object';
export default Component.extend(Slotted, {
tagName: '',
message: 'Are you sure?',
confirming: false,
permanent: false,
actions: {
cancel: function() {
set(this, 'confirming', false);
},
execute: function() {
set(this, 'confirming', false);
this.sendAction(...['actionName', ...this['arguments']]);
},
confirm: function() {
const [action, ...args] = arguments;
set(this, 'actionName', action);
set(this, 'arguments', args);
set(this, 'confirming', true);
},
},
});