2017-08-22 09:53:26 +02:00
|
|
|
import Component from '@ember/component';
|
|
|
|
import {computed} from '@ember/object';
|
2017-10-30 10:38:01 +01:00
|
|
|
import {inject as service} from '@ember/service';
|
2015-10-28 12:36:45 +01:00
|
|
|
|
|
|
|
export default Component.extend({
|
2017-10-30 10:38:01 +01:00
|
|
|
notifications: service(),
|
2015-05-26 04:10:50 +02:00
|
|
|
|
2018-01-11 18:43:23 +01:00
|
|
|
classNameBindings: ['typeClass'],
|
|
|
|
classNames: ['gh-alert'],
|
|
|
|
tagName: 'article',
|
|
|
|
|
2015-10-28 12:36:45 +01:00
|
|
|
typeClass: computed('message.type', function () {
|
|
|
|
let type = this.get('message.type');
|
|
|
|
let classes = '';
|
|
|
|
let typeMapping;
|
2015-06-18 23:56:18 +02:00
|
|
|
|
|
|
|
typeMapping = {
|
|
|
|
success: 'green',
|
|
|
|
error: 'red',
|
2017-07-20 16:00:41 +02:00
|
|
|
warn: 'blue',
|
2015-06-18 23:56:18 +02:00
|
|
|
info: 'blue'
|
|
|
|
};
|
|
|
|
|
|
|
|
if (typeMapping[type] !== undefined) {
|
2015-10-28 12:36:45 +01:00
|
|
|
classes += `gh-alert-${typeMapping[type]}`;
|
2015-05-21 19:03:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return classes;
|
|
|
|
}),
|
|
|
|
|
|
|
|
actions: {
|
2015-10-28 12:36:45 +01:00
|
|
|
closeNotification() {
|
2019-03-06 14:53:54 +01:00
|
|
|
this.notifications.closeNotification(this.message);
|
2015-05-21 19:03:24 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|