discourse/app/assets/javascripts/admin/addon/components/webhook-status.gjs
Ella E. 37f032752e
UX: Apply admin table to webhooks (#30317)
* UX: Apply admin table classes for consistent mobile styling on the web hooks page

* DEV: Remove icon on the status component; update status classes

* DEV: Update tests for webhook status component

* DEV: add space var with a smaller value

* DEV: Add styling for different status labels
2024-12-17 08:52:29 -07:00

30 lines
804 B
Plaintext

import Component from "@glimmer/component";
import { i18n } from "discourse-i18n";
export default class WebhookStatus extends Component {
statusClasses = ["--inactive", "--critical", "--success", "--inactive"];
get status() {
const lastStatus = this.args.webhook.get("last_delivery_status");
return this.args.deliveryStatuses.find((s) => s.id === lastStatus);
}
get deliveryStatus() {
return i18n(`admin.web_hooks.delivery_status.${this.status.name}`);
}
get statusClass() {
return this.statusClasses[this.status.id - 1];
}
<template>
<div role="status" class="status-label {{this.statusClass}}">
<div class="status-label-indicator">
</div>
<div class="status-label-text">
{{this.deliveryStatus}}
</div>
</div>
</template>
}