2021-03-28 11:06:49 +02:00
|
|
|
import { default as discourseComputed } from "discourse-common/utils/decorators";
|
2020-11-09 04:32:36 +01:00
|
|
|
import { not, notEmpty } from "@ember/object/computed";
|
2020-04-20 13:40:32 +02:00
|
|
|
import Component from "@ember/component";
|
2020-05-28 05:06:06 +02:00
|
|
|
import I18n from "I18n";
|
2020-04-20 13:40:32 +02:00
|
|
|
|
2020-11-09 04:32:36 +01:00
|
|
|
const icons = {
|
2021-03-28 11:06:49 +02:00
|
|
|
error: "times-circle",
|
|
|
|
success: "check-circle",
|
2021-08-10 08:45:23 +02:00
|
|
|
warn: "exclamation-circle",
|
2021-03-28 11:06:49 +02:00
|
|
|
info: "info-circle",
|
|
|
|
};
|
2020-11-09 04:32:36 +01:00
|
|
|
|
2020-04-20 13:40:32 +02:00
|
|
|
export default Component.extend({
|
2021-03-28 11:06:49 +02:00
|
|
|
classNameBindings: [":wizard-message", "type", "loading"],
|
|
|
|
showDocumentation: not("loading"),
|
|
|
|
showIcon: not("loading"),
|
|
|
|
hasItems: notEmpty("items"),
|
|
|
|
|
|
|
|
@discourseComputed("type")
|
2020-11-09 04:32:36 +01:00
|
|
|
icon(type) {
|
2021-03-28 11:06:49 +02:00
|
|
|
return icons[type] || "info-circle";
|
2020-11-09 04:32:36 +01:00
|
|
|
},
|
2021-03-28 11:06:49 +02:00
|
|
|
|
|
|
|
@discourseComputed("key", "component", "opts")
|
2020-11-09 04:32:36 +01:00
|
|
|
message(key, component, opts) {
|
|
|
|
return I18n.t(`admin.wizard.message.${component}.${key}`, opts || {});
|
2020-04-20 13:40:32 +02:00
|
|
|
},
|
2021-03-28 11:06:49 +02:00
|
|
|
|
|
|
|
@discourseComputed("component")
|
2020-04-20 13:40:32 +02:00
|
|
|
documentation(component) {
|
|
|
|
return I18n.t(`admin.wizard.message.${component}.documentation`);
|
2021-03-28 11:06:49 +02:00
|
|
|
},
|
|
|
|
});
|