2022-12-13 20:32:34 +08:00
|
|
|
import Component from "@glimmer/component";
|
2024-08-17 23:44:56 +08:00
|
|
|
import icon from "discourse-common/helpers/d-icon";
|
2024-11-20 04:45:18 +08:00
|
|
|
import { i18n } from "discourse-i18n";
|
2022-12-13 20:32:34 +08:00
|
|
|
|
|
|
|
export default class WebhookStatus extends Component {
|
2024-09-13 23:50:52 +08:00
|
|
|
iconNames = ["far-circle", "circle-xmark", "circle", "circle"];
|
2022-12-13 20:32:34 +08:00
|
|
|
iconClasses = ["text-muted", "text-danger", "text-successful", "text-muted"];
|
|
|
|
|
|
|
|
get status() {
|
2024-08-17 23:44:56 +08:00
|
|
|
const lastStatus = this.args.webhook.get("last_delivery_status");
|
2022-12-13 20:32:34 +08:00
|
|
|
return this.args.deliveryStatuses.find((s) => s.id === lastStatus);
|
|
|
|
}
|
|
|
|
|
|
|
|
get deliveryStatus() {
|
2024-11-20 04:45:18 +08:00
|
|
|
return i18n(`admin.web_hooks.delivery_status.${this.status.name}`);
|
2022-12-13 20:32:34 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
get iconName() {
|
|
|
|
return this.iconNames[this.status.id - 1];
|
|
|
|
}
|
|
|
|
|
|
|
|
get iconClass() {
|
|
|
|
return this.iconClasses[this.status.id - 1];
|
|
|
|
}
|
2024-08-17 23:44:56 +08:00
|
|
|
|
|
|
|
<template>
|
|
|
|
{{icon this.iconName class=this.iconClass}}
|
|
|
|
{{this.deliveryStatus}}
|
|
|
|
</template>
|
2022-12-13 20:32:34 +08:00
|
|
|
}
|