Watch
0
0
Fork
You've already forked hyperhive
0

swarm-ui: a header bell with the count of firing alerts opens a list of them and a link to Grafana

This commit is contained in:
iris 2026-11-21 15:01:16 +01:00
commit 70e5de5571
2 changed files with 218 additions and 5 deletions

View file

@ -19,7 +19,13 @@ import { StaleNote } from "../ui/polled/StaleNote.js";
import { Table, type TableColumn } from "../ui/table/Table.js";
import { TableSkeleton } from "../ui/table/TableSkeleton.js";
import { Toolbar } from "../ui/toolbar/Toolbar.js";
import { activeSinceMs, alertKey, listedAlerts, type Alert } from "./alerts.js";
import {
GRAFANA_ALERTS_URL,
activeSinceMs,
alertKey,
listedAlerts,
type Alert,
} from "./alerts.js";
const STATE_TONE: Record<string, BadgeTone> = {
Alerting: "negative",
@ -28,10 +34,6 @@ const STATE_TONE: Record<string, BadgeTone> = {
Pending: "warning",
};
// Grafana's own alert list, for what this page does not show.
const GRAFANA_ALERTS_URL =
"https://grafana.constellation.darkest.space/alerting/groups";
const COLUMNS: TableColumn<Alert>[] = [
{
key: "name",

View file

@ -2,6 +2,15 @@
// instance from swarm-controller's `GET /api/alerts` and which of them count
// as firing.
// Grafana's own alert list, for what the swarm UI does not show.
export const GRAFANA_ALERTS_URL =
"https://grafana.constellation.darkest.space/alerting/groups";
// What the header's alert button is called for `count` firing alerts.
export function alertsLabel(count: number): string {
return count === 1 ? "1 alert firing" : `${count} alerts firing`;
}
export interface Alert {
name: string;
// Grafana's state for the instance: `Alerting`, `Pending`, `NoData` or