0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-12-02 05:21:10 +01:00
discourse-custom-wizard/assets/javascripts/discourse/components/wizard-notice.js.es6

43 Zeilen
1 KiB
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-19 14:49:06 +02:00
classNameBindings: [
":wizard-notice",
"notice.type",
"dismissed",
"expired",
"resolved",
],
2021-09-24 11:58:42 +02:00
showFull: false,
2021-10-19 14:49:06 +02:00
resolved: notEmpty("notice.expired_at"),
dismissed: notEmpty("notice.dismissed_at"),
canDismiss: not("dismissed"),
2021-09-24 11:58:42 +02:00
2021-10-19 14:49:06 +02:00
@discourseComputed("notice.type")
2021-09-24 11:58:42 +02:00
title(type) {
return I18n.t(`admin.wizard.notice.title.${type}`);
},
2021-10-19 14:49:06 +02:00
@discourseComputed("notice.type")
2021-09-24 11:58:42 +02:00
icon(type) {
return {
2021-10-19 14:49:06 +02:00
plugin_status_warning: "exclamation-circle",
plugin_status_connection_error: "bolt",
subscription_messages_connection_error: "bolt",
info: "info-circle",
2021-09-24 11:58:42 +02:00
}[type];
},
actions: {
dismiss() {
2021-10-19 14:49:06 +02:00
this.set("dismissing", true);
2021-09-24 11:58:42 +02:00
this.notice.dismiss().then(() => {
2021-10-19 14:49:06 +02:00
this.set("dismissing", false);
2021-09-24 11:58:42 +02:00
});
2021-10-19 14:49:06 +02:00
},
},
});