2019-10-24 00:30:52 +08:00
|
|
|
import Component from "@ember/component";
|
2018-06-15 23:03:24 +08:00
|
|
|
import computed from "ember-addons/ember-computed-decorators";
|
|
|
|
import { iconHTML } from "discourse-common/lib/icon-library";
|
|
|
|
import { bufferedRender } from "discourse-common/lib/buffered-render";
|
2016-06-16 01:49:57 +08:00
|
|
|
|
2019-10-24 00:30:52 +08:00
|
|
|
export default Component.extend(
|
2018-06-15 23:03:24 +08:00
|
|
|
bufferedRender({
|
2019-03-21 23:13:09 +08:00
|
|
|
classes: ["text-muted", "text-danger", "text-successful", "text-muted"],
|
2019-07-16 23:13:44 +08:00
|
|
|
icons: ["far-circle", "times-circle", "circle", "circle"],
|
2016-06-16 01:49:57 +08:00
|
|
|
|
2018-06-15 23:03:24 +08:00
|
|
|
@computed("deliveryStatuses", "model.last_delivery_status")
|
|
|
|
status(deliveryStatuses, lastDeliveryStatus) {
|
|
|
|
return deliveryStatuses.find(s => s.id === lastDeliveryStatus);
|
|
|
|
},
|
2016-06-16 01:49:57 +08:00
|
|
|
|
2018-06-15 23:03:24 +08:00
|
|
|
@computed("status.id", "icons")
|
|
|
|
icon(statusId, icons) {
|
|
|
|
return icons[statusId - 1];
|
|
|
|
},
|
2016-06-16 01:49:57 +08:00
|
|
|
|
2018-06-15 23:03:24 +08:00
|
|
|
@computed("status.id", "classes")
|
|
|
|
class(statusId, classes) {
|
|
|
|
return classes[statusId - 1];
|
|
|
|
},
|
2016-06-16 01:49:57 +08:00
|
|
|
|
2018-06-15 23:03:24 +08:00
|
|
|
buildBuffer(buffer) {
|
2019-05-27 16:15:39 +08:00
|
|
|
buffer.push(iconHTML(this.icon, { class: this.class }));
|
2018-06-15 23:03:24 +08:00
|
|
|
buffer.push(
|
|
|
|
I18n.t(`admin.web_hooks.delivery_status.${this.get("status.name")}`)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
})
|
|
|
|
);
|