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