Add runbooks, backup coverage, inventory, roles from groups, Prometheus metrics and event webhooks
- Runbooks: notes per server/integration, shown next to matching alerts - Backup coverage page across Proxmox and PBS, with a digest section - Hardware inventory with warranty, power and running cost - Authentik group to role mapping with preview and safeguards - /metrics (bearer token) and signed outgoing event webhooks - Docs: README, DATABASE, NOTIFICATIONS, ROLES and new API.md Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c36e2092c5
commit
c17e9aa140
55 files changed
+7177
-27
No files matched your search
@@ -0,0 +1,42 @@
|
||||
import { useEffect, useSyncExternalStore } from "react";
|
||||
import { api, type RunbookSummary } from "../api/client";
|
||||
|
||||
// The list of runbook titles, by what they are about — shared by every page that shows a "runbook" button, fetched once, and fetched
|
||||
// again whenever one is added, changed or removed (RUNBOOKS_CHANGED).
|
||||
export const RUNBOOKS_CHANGED = "runbooks-changed";
|
||||
|
||||
let items: RunbookSummary[] | 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
|
||||
.summary()
|
||||
.then((res) => {
|
||||
items = res.runbooks;
|
||||
listeners.forEach((l) => l());
|
||||
})
|
||||
.catch(() => {
|
||||
// Only a convenience on top of the pages: without it they simply show no runbook buttons.
|
||||
})
|
||||
.finally(() => {
|
||||
loading = false;
|
||||
});
|
||||
}
|
||||
|
||||
if (typeof window !== "undefined") window.addEventListener(RUNBOOKS_CHANGED, () => load(true));
|
||||
|
||||
function subscribe(listener: () => void): () => void {
|
||||
listeners.add(listener);
|
||||
return () => {
|
||||
listeners.delete(listener);
|
||||
};
|
||||
}
|
||||
|
||||
/** Every runbook's title and what it is for; null until loaded. */
|
||||
export function useRunbookSummary(): RunbookSummary[] | null {
|
||||
useEffect(() => load(), []);
|
||||
return useSyncExternalStore(subscribe, () => items);
|
||||
}
|
||||
Reference in new issue
Block a user