2018-09-25 16:28:26 +00:00
|
|
|
import Component from '@ember/component';
|
|
|
|
import { computed } from '@ember/object';
|
2018-04-03 14:16:57 +00:00
|
|
|
import { messageTypes } from 'vault/helpers/message-types';
|
|
|
|
|
2019-04-03 21:06:20 +00:00
|
|
|
/**
|
|
|
|
* @module AlertBanner
|
|
|
|
* `AlertBanner` components are used to inform users of important messages.
|
|
|
|
*
|
|
|
|
* @example
|
|
|
|
* ```js
|
|
|
|
* <AlertBanner @type="danger" @message="{{model.keyId}} is not a valid lease ID"/>
|
|
|
|
* ```
|
|
|
|
*
|
|
|
|
* @param type=null {String} - The banner type. This comes from the message-types helper.
|
|
|
|
* @param [message=null {String}] - The message to display within the banner.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2018-09-25 16:28:26 +00:00
|
|
|
export default Component.extend({
|
2018-04-03 14:16:57 +00:00
|
|
|
type: null,
|
2019-04-03 21:06:20 +00:00
|
|
|
message: null,
|
2018-05-24 03:10:21 +00:00
|
|
|
yieldWithoutColumn: false,
|
2018-04-03 14:16:57 +00:00
|
|
|
classNameBindings: ['containerClass'],
|
|
|
|
|
|
|
|
containerClass: computed('type', function() {
|
|
|
|
return 'message ' + messageTypes([this.get('type')]).class;
|
|
|
|
}),
|
|
|
|
|
|
|
|
alertType: computed('type', function() {
|
|
|
|
return messageTypes([this.get('type')]);
|
|
|
|
}),
|
|
|
|
});
|