mirror of
https://github.com/datahub-project/datahub.git
synced 2025-07-13 12:10:23 +00:00
50 lines
931 B
TypeScript
50 lines
931 B
TypeScript
import Component from 'ember-modal-dialog/components/modal-dialog';
|
|
import { get } from '@ember/object';
|
|
|
|
/**
|
|
* The default value for content when component is rendered inline
|
|
* @type {string}
|
|
*/
|
|
const defaultInlineContent = '';
|
|
|
|
enum Key {
|
|
Escape = 27
|
|
}
|
|
|
|
export default Component.extend({
|
|
containerClassNames: ['notification-confirm-modal'],
|
|
|
|
/**
|
|
* Default value for modal content
|
|
* @type {string}
|
|
*/
|
|
content: defaultInlineContent,
|
|
|
|
init() {
|
|
this._super(...Array.from(arguments));
|
|
},
|
|
|
|
actions: {
|
|
/**
|
|
* Handles user dismissal of modal
|
|
*/
|
|
onClose() {
|
|
get(this, 'onClose')();
|
|
},
|
|
|
|
/**
|
|
* On user confirmation / affirm
|
|
*/
|
|
onConfirm() {
|
|
get(this, 'onConfirm')();
|
|
},
|
|
|
|
//TODO: META-91
|
|
onKeyUp({ key, which }: { key: any; which: any }) {
|
|
if (which === Key.Escape || key === 'Escape') {
|
|
get(this, 'onClose')();
|
|
}
|
|
}
|
|
}
|
|
});
|