1
0
Fork 0
discourse-custom-wizard-unl.../assets/javascripts/discourse/components/wizard-notice.js.es6

36 Zeilen
1.000 B
Text

2021-09-24 11:58:42 +02:00
import Component from "@ember/component";
import discourseComputed from "discourse-common/utils/decorators";
2021-10-05 14:54:06 +02:00
import { not, notEmpty } from "@ember/object/computed";
2021-09-24 11:58:42 +02:00
import I18n from "I18n";
export default Component.extend({
2021-10-05 14:54:06 +02:00
classNameBindings: [':wizard-notice', 'notice.type', 'dismissed', 'expired', 'resolved'],
2021-09-24 11:58:42 +02:00
showFull: false,
resolved: notEmpty('notice.expired_at'),
dismissed: notEmpty('notice.dismissed_at'),
canDismiss: not('dismissed'),
@discourseComputed('notice.type')
title(type) {
return I18n.t(`admin.wizard.notice.title.${type}`);
},
@discourseComputed('notice.type')
icon(type) {
return {
2021-10-05 14:54:06 +02:00
plugin_status_warning: 'exclamation-circle',
plugin_status_connection_error: 'bolt',
subscription_messages_connection_error: 'bolt',
2021-09-24 11:58:42 +02:00
info: 'info-circle'
}[type];
},
actions: {
dismiss() {
2021-10-05 14:54:06 +02:00
this.set('dismissing', true);
2021-09-24 11:58:42 +02:00
this.notice.dismiss().then(() => {
this.set('dismissing', false);
});
}
}
});