mirror of
https://github.com/discourse/discourse.git
synced 2024-12-01 14:35:58 +08:00
eab560fe2a
Co-authored-by: Mark VanLandingham <markvanlan@gmail.com> Co-authored-by: Robin Ward <robin.ward@gmail.com> Co-authored-by: Mark VanLandingham <markvanlan@gmail.com>
39 lines
1.1 KiB
JavaScript
39 lines
1.1 KiB
JavaScript
import I18n from "I18n";
|
|
import discourseComputed from "discourse-common/utils/decorators";
|
|
import Component from "@ember/component";
|
|
import { iconHTML } from "discourse-common/lib/icon-library";
|
|
|
|
export default Component.extend({
|
|
classes: ["text-muted", "text-danger", "text-successful", "text-muted"],
|
|
icons: ["far-circle", "times-circle", "circle", "circle"],
|
|
circleIcon: null,
|
|
deliveryStatus: null,
|
|
|
|
@discourseComputed("deliveryStatuses", "model.last_delivery_status")
|
|
status(deliveryStatuses, lastDeliveryStatus) {
|
|
return deliveryStatuses.find(s => s.id === lastDeliveryStatus);
|
|
},
|
|
|
|
@discourseComputed("status.id", "icons")
|
|
icon(statusId, icons) {
|
|
return icons[statusId - 1];
|
|
},
|
|
|
|
@discourseComputed("status.id", "classes")
|
|
class(statusId, classes) {
|
|
return classes[statusId - 1];
|
|
},
|
|
|
|
didReceiveAttrs() {
|
|
this._super(...arguments);
|
|
this.set(
|
|
"circleIcon",
|
|
iconHTML(this.icon, { class: this.class }).htmlSafe()
|
|
);
|
|
this.set(
|
|
"deliveryStatus",
|
|
I18n.t(`admin.web_hooks.delivery_status.${this.get("status.name")}`)
|
|
);
|
|
}
|
|
});
|