2022-12-13 20:32:34 +08:00
|
|
|
import Component from "@glimmer/component";
|
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-12-17 23:52:29 +08:00
|
|
|
statusClasses = ["--inactive", "--critical", "--success", "--inactive"];
|
2022-12-13 20:32:34 +08:00
|
|
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2024-12-17 23:52:29 +08:00
|
|
|
get statusClass() {
|
|
|
|
return this.statusClasses[this.status.id - 1];
|
2022-12-13 20:32:34 +08:00
|
|
|
}
|
2024-08-17 23:44:56 +08:00
|
|
|
|
|
|
|
<template>
|
2024-12-17 23:52:29 +08:00
|
|
|
<div role="status" class="status-label {{this.statusClass}}">
|
|
|
|
<div class="status-label-indicator">
|
|
|
|
</div>
|
|
|
|
<div class="status-label-text">
|
|
|
|
{{this.deliveryStatus}}
|
|
|
|
</div>
|
|
|
|
</div>
|
2024-08-17 23:44:56 +08:00
|
|
|
</template>
|
2022-12-13 20:32:34 +08:00
|
|
|
}
|