2018-11-02 16:02:45 +00:00
|
|
|
import Component from '@ember/component';
|
|
|
|
import { computed } from '@ember/object';
|
|
|
|
import { messageTypes } from 'vault/helpers/message-types';
|
|
|
|
|
2019-04-03 21:06:20 +00:00
|
|
|
/**
|
|
|
|
* @module AlertInline
|
|
|
|
* `AlertInline` components are used to inform users of important messages.
|
|
|
|
*
|
|
|
|
* @example
|
|
|
|
* ```js
|
|
|
|
* <AlertInline @type="danger" @message="{{model.keyId}} is not a valid lease ID"/>
|
|
|
|
* ```
|
|
|
|
*
|
|
|
|
* @param type=null{String} - The alert type. This comes from the message-types helper.
|
|
|
|
* @param [message=null]{String} - The message to display within the alert.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2018-11-02 16:02:45 +00:00
|
|
|
export default Component.extend({
|
|
|
|
type: null,
|
2019-02-14 15:39:19 +00:00
|
|
|
message: null,
|
2018-11-02 16:02:45 +00:00
|
|
|
|
|
|
|
classNames: ['message-inline'],
|
|
|
|
|
|
|
|
textClass: computed('type', function() {
|
|
|
|
if (this.get('type') == 'danger') {
|
|
|
|
return messageTypes([this.get('type')]).glyphClass;
|
|
|
|
}
|
|
|
|
|
2018-11-05 16:56:59 +00:00
|
|
|
return;
|
2018-11-02 16:02:45 +00:00
|
|
|
}),
|
|
|
|
|
|
|
|
alertType: computed('type', function() {
|
|
|
|
return messageTypes([this.get('type')]);
|
|
|
|
}),
|
|
|
|
});
|