Runbooks per alert kind, high-vulnerability threshold, wall display extras

A "What to do" note (text and/or link) can be written once for a whole kind of alert and
shows beside every alert of that kind; alerts now carry their kind and source type.
New optional setting: warn when a Docker host has N or more high vulnerabilities (off by
default). The wall display gains tiles (Hetzner and game servers running, critical
vulnerabilities, stuck downloads) and a summary line for each group of integrations,
also in share links. Migration 0074; docs and tests included.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
bobbanandClaude Sonnet 5.5 committed 2026-10-27 21:15:45 +01:00
1 parent d9083adb5b
commit 3d9a2310bb
35 files changed
+9129 -30

No files matched your search

+42
View File
@@ -0,0 +1,42 @@
import { useEffect, useSyncExternalStore } from "react";
import { api, type AlertKindRunbook } from "../api/client";
// What is written down for each kind of alert, shared by every alert on the page and fetched once — and again whenever one is added, changed or
// removed (ALERT_KIND_RUNBOOKS_CHANGED). The texts come with the list: there are few of them, and the drawer should open at once.
export const ALERT_KIND_RUNBOOKS_CHANGED = "alert-kind-runbooks-changed";
let items: AlertKindRunbook[] | null = null;
let loading = false;
const listeners = new Set<() => void>();
function load(force = false): void {
if (loading || (items !== null && !force)) return;
loading = true;
api.runbooks.kinds
.list()
.then((res) => {
items = res.kinds;
listeners.forEach((l) => l());
})
.catch(() => {
// Only a convenience on top of the page: without it the alerts simply show no runbook link.
})
.finally(() => {
loading = false;
});
}
if (typeof window !== "undefined") window.addEventListener(ALERT_KIND_RUNBOOKS_CHANGED, () => load(true));
function subscribe(listener: () => void): () => void {
listeners.add(listener);
return () => {
listeners.delete(listener);
};
}
/** What is written down for each kind of alert; null until loaded. */
export function useAlertKindRunbooks(): AlertKindRunbook[] | null {
useEffect(() => load(), []);
return useSyncExternalStore(subscribe, () => items);
}