Accessibility pass, command palette actions, row detail panel, server activity, map, wall display and setup guide

Accessibility: skip link, labelled landmarks, visible focus, page-change
announcements, sortable headings as real buttons, every label tied to its
field, named row checkboxes, and text contrast raised to 4.5:1 in both themes.
Command palette: also runs actions (silence/end maintenance, theme, density,
wall display, sign out) and is a proper dialog; g-then-letter shortcuts, "/" and
"?". Row detail panel for six tables. Server Activity card, with the health
check now recording offline/back-online and disk events in the audit log. Map
page of hosts, servers, DNS names and monitors. Full-screen wall display. A
getting-started checklist on the admin dashboard.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
bobbanandClaude Sonnet 5.5 committed 2026-10-15 21:10:56 +02:00
1 parent f7f5e1cd41
commit 57fd4f8c52
36 files changed
+2790 -210

No files matched your search

+38 -1
View File
@@ -14,6 +14,7 @@ import {
} from "../api/client";
import { formatAgo } from "../utils/duration";
import StatusStrip from "../components/StatusStrip";
import SetupGuide, { type SetupStep } from "../components/SetupGuide";
import { ErrorNotice } from "../components/Notice";
import { WidgetSkeleton } from "../components/Skeleton";
@@ -299,6 +300,25 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
const [uptimeKumaSummary, setUptimeKumaSummary] = useState<UptimeKumaSummary | null>(null);
const [pbsSummary, setPbsSummary] = useState<PbsSummary | null>(null);
const [osTicketSummary, setOsTicketSummary] = useState<OsTicketSummary | null>(null);
// For the getting-started guide; only an admin can read these, and only an admin has these steps to do.
const isAdmin = user.role === "admin";
const [notifyConfigured, setNotifyConfigured] = useState<boolean | null>(null);
const [userCount, setUserCount] = useState<number | null>(null);
useEffect(() => {
if (!isAdmin) return;
api.settings
.get()
.then((res) => {
const s = res.settings;
setNotifyConfigured(s.gotify.enabled || s.ntfy.enabled || s.smtp.enabled || s.webhook.enabled);
})
.catch(() => setNotifyConfigured(null));
api.users
.list()
.then((res) => setUserCount(res.users.length))
.catch(() => setUserCount(null));
}, [isAdmin]);
const [dnsStats, setDnsStats] = useState<Awaited<ReturnType<typeof api.dns.stats>> | null>(null);
const [dnsError, setDnsError] = useState<string | null>(null);
@@ -539,6 +559,15 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
}, {}),
).map(([type, count]) => ({ label: SECRET_TYPE_LABELS[type as SecretRecord["type"]] ?? type, count }));
const setupSteps: SetupStep[] = [
{ id: "integration", title: "Connect an integration", description: "Proxmox, Synology, Tailscale, Docker, Uptime Kuma… each gets its own page and shows up in alerts.", to: "/integrations", action: "Add one", done: (integrations?.length ?? 0) > 0 },
{ id: "server", title: "Add a server and install its agent", description: "The agent reports scheduled tasks, disks, memory and open ports, and lets the app tell when a server goes quiet.", to: "/servers", action: "Add a server", done: (serverSummary?.total ?? 0) > 0 },
{ id: "dns", title: "Connect a DNS provider", description: "See your zones and records, and have names matched to servers.", to: "/dns", action: "Connect", done: (dnsStats?.totalProviders ?? 0) > 0 },
{ id: "secret", title: "Track something that expires", description: "An API token, a certificate or a password — you're warned before it runs out.", to: "/secrets", action: "Add one", done: (secrets?.length ?? 0) > 0 },
{ id: "notify", title: "Choose how you'll be told about problems", description: "Gotify, ntfy, email or a webhook, with the checks you want.", to: "/settings/notifications", action: "Set up", done: notifyConfigured === true },
{ id: "people", title: "Let someone else in (optional)", description: "Others sign in with Authentik and appear under Users; you decide their role.", to: "/users", action: "Open Users", done: (userCount ?? 0) > 1 },
];
// What has nothing set up yet. These get one list at the bottom instead of a grey "Not configured" card each.
const notSetUp: { label: string; to: string; what: string }[] = [];
if (dnsStats?.totalProviders === 0) notSetUp.push({ label: "DNS", to: "/dns", what: "connect a DNS provider to see zones and records" });
@@ -555,11 +584,19 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
<>
<div className="row row-cards mb-3">
<div className="col-12">
<h2 className="page-title mb-3">Dashboard</h2>
<div className="d-flex flex-wrap align-items-center gap-2 mb-3">
<h2 className="page-title mb-0">Dashboard</h2>
<Link to="/wall" className="btn btn-sm btn-outline-secondary ms-auto" title="A full-screen status board for a spare monitor or tablet">
Wall display
</Link>
</div>
<p className="text-secondary">
Welcome back, {user.name ?? user.email ?? user.sub}.
</p>
<StatusStrip />
{isAdmin && integrations !== null && dnsStats !== null && serverSummary !== null && secrets !== null && notifyConfigured !== null && (
<SetupGuide steps={setupSteps} />
)}
</div>
</div>
+9 -1
View File
@@ -18,6 +18,8 @@ import { ErrorNotice } from "../components/Notice";
import { toast } from "../utils/toast";
import { SearchBox } from "../components/TableToolbar";
import { useTableSearch } from "../hooks/useTableSearch";
import DetailDrawer, { ObjectDetails } from "../components/DetailDrawer";
import { useRowDetail } from "../hooks/useRowDetail";
function updateBadge(c: DockhandContainer) {
if (c.updateAvailable === null) return <span className="text-secondary">—</span>;
@@ -98,6 +100,7 @@ export default function Docker({ user }: { user: CurrentUser }) {
const tableSearch = useTableSearch(filteredContainers);
const { sorted, sortKey, sortDir, requestSort } = useSortable(tableSearch.filtered);
const { pageItems, page, setPage, pageCount, totalCount } = usePagination(sorted);
const detail = useRowDetail<NonNullable<typeof pageItems>[number]>();
function exportCsv() {
if (!sorted) return;
@@ -259,7 +262,7 @@ export default function Docker({ user }: { user: CurrentUser }) {
</thead>
<tbody>
{pageItems?.map((c) => (
<tr key={`${c.environmentId}:${c.id}`}>
<tr key={`${c.environmentId}:${c.id}`} {...detail.rowProps(c)}>
{/* text-break: a long name or a digest-pinned image (name@sha256:…) has no spaces to wrap at, and would otherwise make the
table wider than the page and push the action buttons out of sight. */}
<td className="text-break">{c.name}</td>
@@ -319,6 +322,11 @@ export default function Docker({ user }: { user: CurrentUser }) {
)}
</>
)}
{detail.selected && (
<DetailDrawer title={((c) => c.name)(detail.selected)} subtitle={((c) => c.environmentName)(detail.selected)} onClose={detail.close}>
<ObjectDetails data={detail.selected} />
</DetailDrawer>
)}
</>
);
}
+3 -2
View File
@@ -116,7 +116,7 @@ export default function Generator({ user }: { user: CurrentUser }) {
</select>
<div className="form-hint mb-3">{themes ? `${pool.length} name${pool.length === 1 ? "" : "s"} to pick from.` : "Loading the lists…"}</div>
<div className="input-group">
<input type="text" className="form-control" readOnly value={serverName} placeholder="Click Generate…" />
<input type="text" className="form-control" readOnly value={serverName} placeholder="Click Generate…" aria-label="Generated server name" />
{serverName && <CopyButton text={serverName} />}
</div>
</div>
@@ -162,7 +162,7 @@ export default function Generator({ user }: { user: CurrentUser }) {
</div>
</div>
<div className="input-group">
<input type="text" className="form-control" readOnly value={username} placeholder="Click Generate…" />
<input type="text" className="form-control" readOnly value={username} placeholder="Click Generate…" aria-label="Generated username" />
{username && <CopyButton text={username} />}
</div>
</div>
@@ -227,6 +227,7 @@ export default function Generator({ user }: { user: CurrentUser }) {
className="form-control font-monospace"
readOnly
value={password}
aria-label="Generated password"
placeholder="Click Generate…"
/>
{password && (
+9 -1
View File
@@ -12,6 +12,8 @@ import { formatAgo } from "../utils/duration";
import { ErrorNotice } from "../components/Notice";
import { SearchBox } from "../components/TableToolbar";
import { useTableSearch } from "../hooks/useTableSearch";
import DetailDrawer, { ObjectDetails } from "../components/DetailDrawer";
import { useRowDetail } from "../hooks/useRowDetail";
function runStatusBadge(repo: GiteaRepo) {
const run = repo.latestRun;
@@ -99,6 +101,7 @@ export default function Gitea({ user }: { user: CurrentUser }) {
const tableSearch = useTableSearch(repos);
const { sorted, sortKey, sortDir, requestSort } = useSortable(tableSearch.filtered);
const { pageItems, page, setPage, pageCount, totalCount } = usePagination(sorted);
const detail = useRowDetail<NonNullable<typeof pageItems>[number]>();
function exportCsv() {
if (!sorted) return;
@@ -185,7 +188,7 @@ export default function Gitea({ user }: { user: CurrentUser }) {
</thead>
<tbody>
{pageItems?.map((r) => (
<tr key={r.fullName}>
<tr key={r.fullName} {...detail.rowProps(r)}>
<td>
<a href={r.htmlUrl} target="_blank" rel="noopener noreferrer">
{r.fullName}
@@ -245,6 +248,11 @@ export default function Gitea({ user }: { user: CurrentUser }) {
)}
</>
)}
{detail.selected && (
<DetailDrawer title={((r) => r.fullName)(detail.selected)} subtitle={((r) => undefined)(detail.selected)} onClose={detail.close}>
<ObjectDetails data={detail.selected} />
</DetailDrawer>
)}
</>
);
}
+187
View File
@@ -0,0 +1,187 @@
import { useEffect, useMemo, useState } from "react";
import { Link } from "react-router-dom";
import { api, type MapData, type MapNode } from "../api/client";
import { ErrorNotice } from "../components/Notice";
import { PageSkeleton } from "../components/Skeleton";
import { readableError } from "../utils/errors";
const NODE_W = 210;
const NODE_H = 46;
const GAP_Y = 12;
const COL_GAP = 130;
const STATUS_SYMBOL: Record<MapNode["status"], string> = { ok: "✓", bad: "✕", warn: "▲", unknown: "·" };
const STATUS_WORD: Record<MapNode["status"], string> = { ok: "working", bad: "problem", warn: "check", unknown: "no status" };
const KIND_WORD: Record<MapNode["kind"], string> = { host: "Proxmox host", server: "Server", dns: "DNS name", monitor: "Uptime Kuma monitor" };
interface Placed extends MapNode {
x: number;
y: number;
}
/** Places each node: hosts, then servers, then names and monitors, each column ordered so the lines cross as little as is easy. */
function layout(data: MapData): { placed: Map<string, Placed>; width: number; height: number; columns: { x: number; title: string }[] } {
const neighbours = new Map<string, string[]>();
for (const e of data.edges) {
neighbours.set(e.from, [...(neighbours.get(e.from) ?? []), e.to]);
neighbours.set(e.to, [...(neighbours.get(e.to) ?? []), e.from]);
}
const byKind = (kinds: MapNode["kind"][]) => data.nodes.filter((n) => kinds.includes(n.kind));
const hosts = byKind(["host"]).sort((a, b) => a.label.localeCompare(b.label));
const serverNodes = byKind(["server"]);
const rightNodes = byKind(["dns", "monitor"]);
// Servers grouped under their host, then those with none.
const hostOf = (s: MapNode) => (neighbours.get(s.id) ?? []).find((id) => id.startsWith("host:"));
const servers: MapNode[] = [];
for (const h of hosts) servers.push(...serverNodes.filter((s) => hostOf(s) === h.id).sort((a, b) => a.label.localeCompare(b.label)));
servers.push(...serverNodes.filter((s) => !hostOf(s)).sort((a, b) => a.label.localeCompare(b.label)));
const step = NODE_H + GAP_Y;
const placed = new Map<string, Placed>();
const hasHosts = hosts.length > 0;
const hasRight = rightNodes.length > 0;
const colX = [0, hasHosts ? NODE_W + COL_GAP : 0, 0];
colX[2] = colX[1] + (servers.length > 0 ? NODE_W + COL_GAP : 0);
servers.forEach((s, i) => placed.set(s.id, { ...s, x: colX[1], y: i * step }));
// A column of nodes sits at the average height of the servers it connects to, pushed down as needed so none overlap.
const stack = (nodes: MapNode[], x: number) => {
const wanted = nodes.map((n) => {
const ys = (neighbours.get(n.id) ?? []).map((id) => placed.get(id)?.y).filter((y): y is number => y !== undefined);
return { n, y: ys.length ? ys.reduce((a, b) => a + b, 0) / ys.length : Number.MAX_SAFE_INTEGER / 2 };
});
wanted.sort((a, b) => a.y - b.y || a.n.label.localeCompare(b.n.label));
let next = 0;
for (const { n, y } of wanted) {
const at = Math.max(next, y >= Number.MAX_SAFE_INTEGER / 4 ? next : y);
placed.set(n.id, { ...n, x, y: at });
next = at + step;
}
};
stack(hosts, colX[0]);
stack(rightNodes, colX[2]);
const all = [...placed.values()];
const height = all.length ? Math.max(...all.map((p) => p.y)) + NODE_H : 0;
const width = Math.max(...all.map((p) => p.x), 0) + NODE_W;
const columns = [
...(hasHosts ? [{ x: colX[0], title: "Proxmox hosts" }] : []),
...(servers.length > 0 ? [{ x: colX[1], title: "Servers" }] : []),
...(hasRight ? [{ x: colX[2], title: "DNS names & monitors" }] : []),
];
return { placed, width, height, columns };
}
/** The picture: how the servers, their Proxmox hosts, DNS names and monitors connect. Hover or tab to a box to light up its connections. */
export default function MapPage() {
const [data, setData] = useState<MapData | null>(null);
const [error, setError] = useState<string | null>(null);
const [focus, setFocus] = useState<string | null>(null);
useEffect(() => {
api.map
.get()
.then(setData)
.catch((err) => setError(readableError(err)));
}, []);
const view = useMemo(() => (data ? layout(data) : null), [data]);
const lit = useMemo(() => {
if (!data || !focus) return null;
const set = new Set<string>([focus]);
for (const e of data.edges) {
if (e.from === focus) set.add(e.to);
if (e.to === focus) set.add(e.from);
}
return set;
}, [data, focus]);
return (
<>
<h2 className="page-title mb-1">Map</h2>
<p className="text-secondary">
How things connect: which Proxmox host a server runs on, which DNS names point at it, and which Uptime Kuma monitors watch it. Hover or tab to a box to light up what it is
connected to.
</p>
<ErrorNotice error={error} />
{data?.notes.map((n) => (
<div key={n} className="alert alert-warning">
{n}
</div>
))}
{!data && !error && <PageSkeleton />}
{data && view && data.nodes.length === 0 && <div className="card"><div className="card-body text-secondary">Nothing to draw yet — add a server first.</div></div>}
{data && view && data.nodes.length > 0 && (
<div className="card">
<div className="card-body map-scroll">
<div className="map-columns" style={{ width: view.width }}>
{view.columns.map((c) => (
<div key={c.title} className="map-column-title" style={{ left: c.x, width: NODE_W }}>
{c.title}
</div>
))}
</div>
<div className="map-canvas" style={{ width: view.width, height: view.height }}>
<svg className="map-lines" width={view.width} height={view.height} aria-hidden="true">
{data.edges.map((e) => {
const a = view.placed.get(e.from);
const b = view.placed.get(e.to);
if (!a || !b) return null;
// Always drawn from the node on the left to the one on the right.
const [l, r] = a.x <= b.x ? [a, b] : [b, a];
const x1 = l.x + NODE_W;
const y1 = l.y + NODE_H / 2;
const x2 = r.x;
const y2 = r.y + NODE_H / 2;
const mid = (x1 + x2) / 2;
const active = !lit || (lit.has(e.from) && lit.has(e.to) && (e.from === focus || e.to === focus));
return <path key={`${e.from}>${e.to}`} d={`M${x1},${y1} C${mid},${y1} ${mid},${y2} ${x2},${y2}`} className={active ? "map-edge" : "map-edge map-dim"} fill="none" />;
})}
</svg>
{[...view.placed.values()].map((n) => {
const dim = lit && !lit.has(n.id);
const body = (
<>
<span className={`map-status map-status-${n.status}`} aria-hidden="true">
{STATUS_SYMBOL[n.status]}
</span>
<span className="map-label">
<span className="map-title">{n.label}</span>
{n.sub && <span className="map-sub">{n.sub}</span>}
</span>
</>
);
const props = {
className: `map-node map-node-${n.kind} ${dim ? "map-dim" : ""}`,
style: { left: n.x, top: n.y, width: NODE_W, height: NODE_H },
onMouseEnter: () => setFocus(n.id),
onMouseLeave: () => setFocus((f) => (f === n.id ? null : f)),
onFocus: () => setFocus(n.id),
onBlur: () => setFocus((f) => (f === n.id ? null : f)),
"aria-label": `${KIND_WORD[n.kind]}: ${n.label}${n.sub ? `, ${n.sub}` : ""}, ${STATUS_WORD[n.status]}`,
};
return n.href ? (
<Link key={n.id} to={n.href} {...props}>
{body}
</Link>
) : (
<div key={n.id} {...props}>
{body}
</div>
);
})}
</div>
</div>
<div className="card-footer text-secondary small d-flex flex-wrap gap-3">
<span>✓ working</span>
<span>✕ problem or not reporting</span>
<span>▲ needs a look</span>
<span>· no status</span>
<span className="ms-auto">DNS names appear where a record holds a server's own address; monitors where their target is the server's.</span>
</div>
</div>
)}
</>
);
}
+9 -1
View File
@@ -21,6 +21,8 @@ import { ErrorNotice } from "../components/Notice";
import { toast } from "../utils/toast";
import { SearchBox } from "../components/TableToolbar";
import { useTableSearch } from "../hooks/useTableSearch";
import DetailDrawer, { ObjectDetails } from "../components/DetailDrawer";
import { useRowDetail } from "../hooks/useRowDetail";
function proxmoxStatusBadge(status: string) {
return status === "running" ? (
@@ -198,6 +200,7 @@ export default function Proxmox({ user }: { user: CurrentUser }) {
const { sorted: sortedGuests, sortKey: guestSortKey, sortDir: guestSortDir, requestSort: requestGuestSort } = useSortable(tableSearch.filtered);
const { pageItems: guestPageItems, page: guestPage, setPage: setGuestPage, pageCount: guestPageCount, totalCount: guestTotalCount } =
usePagination(sortedGuests);
const detail = useRowDetail<NonNullable<typeof guestPageItems>[number]>();
function exportGuestsCsv() {
if (!sortedGuests) return;
@@ -523,7 +526,7 @@ export default function Proxmox({ user }: { user: CurrentUser }) {
</thead>
<tbody>
{guestPageItems?.map((g) => (
<tr key={`${g.node}:${g.type}:${g.vmid}`}>
<tr key={`${g.node}:${g.type}:${g.vmid}`} {...detail.rowProps(g)}>
<td>
{g.name} <span className="text-secondary">#{g.vmid}</span>
</td>
@@ -590,6 +593,11 @@ export default function Proxmox({ user }: { user: CurrentUser }) {
)}
</>
)}
{detail.selected && (
<DetailDrawer title={((g) => g.name)(detail.selected)} subtitle={((g) => `${g.type === "qemu" ? "Virtual machine" : "Container"} ${g.vmid} on ${g.node}`)(detail.selected)} onClose={detail.close}>
<ObjectDetails data={detail.selected} />
</DetailDrawer>
)}
</>
);
}
+9 -1
View File
@@ -18,6 +18,8 @@ import IntegrationPageTitle from "../components/IntegrationPageTitle";
import { ErrorNotice } from "../components/Notice";
import { SearchBox } from "../components/TableToolbar";
import { useTableSearch } from "../hooks/useTableSearch";
import DetailDrawer, { ObjectDetails } from "../components/DetailDrawer";
import { useRowDetail } from "../hooks/useRowDetail";
function semaphoreStatusBadge(template: SemaphoreTemplate) {
const status = template.lastTask?.status;
@@ -106,6 +108,7 @@ export default function Semaphore({ user }: { user: CurrentUser }) {
const tableSearch = useTableSearch(data?.templates);
const { sorted, sortKey, sortDir, requestSort } = useSortable(tableSearch.filtered);
const { pageItems, page, setPage, pageCount, totalCount } = usePagination(sorted);
const detail = useRowDetail<NonNullable<typeof pageItems>[number]>();
function exportCsv() {
if (!sorted) return;
@@ -201,7 +204,7 @@ export default function Semaphore({ user }: { user: CurrentUser }) {
</thead>
<tbody>
{pageItems?.map((t) => (
<tr key={`${t.projectId}:${t.id}`}>
<tr key={`${t.projectId}:${t.id}`} {...detail.rowProps(t)}>
<td>{t.name}</td>
<td className="text-secondary">{t.projectName}</td>
<td className="text-secondary">
@@ -238,6 +241,11 @@ export default function Semaphore({ user }: { user: CurrentUser }) {
)}
</>
)}
{detail.selected && (
<DetailDrawer title={((t) => t.name)(detail.selected)} subtitle={((t) => t.projectName)(detail.selected)} onClose={detail.close}>
<ObjectDetails data={detail.selected} />
</DetailDrawer>
)}
</>
);
}
+2
View File
@@ -14,6 +14,7 @@ import {
} from "../api/client";
import ServerPorts from "../components/ServerPorts";
import ServerTrends from "../components/ServerTrends";
import ServerActivity from "../components/ServerActivity";
import ServerTags from "../components/ServerTags";
import ServerTaskTable, { SCHEDULE_TYPE_LABELS } from "../components/ServerTaskTable";
import { formatDateTime } from "../utils/date";
@@ -755,6 +756,7 @@ export default function ServerDetail({ user }: { user: CurrentUser }) {
</div>
{hardware.source === "agent" && <ServerTrends serverId={serverId} />}
{(user.role === "admin" || user.role === "operator") && <ServerActivity serverId={serverId} />}
<ServerPorts
serverId={serverId}
+9 -1
View File
@@ -20,6 +20,8 @@ import { ErrorNotice } from "../components/Notice";
import { toast } from "../utils/toast";
import { SearchBox } from "../components/TableToolbar";
import { useTableSearch } from "../hooks/useTableSearch";
import DetailDrawer, { ObjectDetails } from "../components/DetailDrawer";
import { useRowDetail } from "../hooks/useRowDetail";
const KEY_EXPIRY_WARN_DAYS = 30;
@@ -144,6 +146,7 @@ export default function Tailscale({ user }: { user: CurrentUser }) {
const tableSearch = useTableSearch(data?.devices);
const { sorted, sortKey, sortDir, requestSort } = useSortable(tableSearch.filtered);
const { pageItems, page, setPage, pageCount, totalCount } = usePagination(sorted);
const detail = useRowDetail<NonNullable<typeof pageItems>[number]>();
function exportCsv() {
if (!sorted) return;
@@ -287,7 +290,7 @@ export default function Tailscale({ user }: { user: CurrentUser }) {
</thead>
<tbody>
{pageItems?.map((d) => (
<tr key={d.id}>
<tr key={d.id} {...detail.rowProps(d)}>
{canEdit && (
<td>
<input
@@ -349,6 +352,11 @@ export default function Tailscale({ user }: { user: CurrentUser }) {
)}
</>
)}
{detail.selected && (
<DetailDrawer title={((d) => d.label || d.hostname)(detail.selected)} subtitle={((d) => d.hostname)(detail.selected)} onClose={detail.close}>
<ObjectDetails data={detail.selected} />
</DetailDrawer>
)}
</>
);
}
+9 -1
View File
@@ -11,6 +11,8 @@ import IntegrationPageTitle from "../components/IntegrationPageTitle";
import { ErrorNotice } from "../components/Notice";
import { SearchBox } from "../components/TableToolbar";
import { useTableSearch } from "../hooks/useTableSearch";
import DetailDrawer, { ObjectDetails } from "../components/DetailDrawer";
import { useRowDetail } from "../hooks/useRowDetail";
function statusBadge(monitor: UptimeKumaMonitor) {
switch (monitor.status) {
@@ -80,6 +82,7 @@ export default function UptimeKuma({ user: _user }: { user: CurrentUser }) {
const tableSearch = useTableSearch(data?.monitors);
const { sorted, sortKey, sortDir, requestSort } = useSortable(tableSearch.filtered, "name");
const { pageItems, page, setPage, pageCount, totalCount } = usePagination(sorted);
const detail = useRowDetail<NonNullable<typeof pageItems>[number]>();
function exportCsv() {
if (!sorted) return;
@@ -173,7 +176,7 @@ export default function UptimeKuma({ user: _user }: { user: CurrentUser }) {
</thead>
<tbody>
{pageItems?.map((m) => (
<tr key={m.id}>
<tr key={m.id} {...detail.rowProps(m)}>
<td>
{m.name}
<div className="text-secondary small">{m.type}</div>
@@ -219,6 +222,11 @@ export default function UptimeKuma({ user: _user }: { user: CurrentUser }) {
)}
</>
)}
{detail.selected && (
<DetailDrawer title={((m) => m.name)(detail.selected)} subtitle={((m) => m.type)(detail.selected)} onClose={detail.close}>
<ObjectDetails data={detail.selected} />
</DetailDrawer>
)}
</>
);
}
+238
View File
@@ -0,0 +1,238 @@
import { useEffect, useState } from "react";
import { Link, useNavigate } from "react-router-dom";
import { api, type IntegrationSummary, type MaintenanceWindow, type ServerSummary } from "../api/client";
import { alertBadge, useAlertsReport } from "../hooks/useAlertsReport";
import { useEnvironment } from "../utils/environment";
import { formatRemaining } from "../utils/duration";
const REFRESH_MS = 30_000;
const TYPE_LABELS: Record<IntegrationSummary["type"], string> = {
tailscale: "Tailscale",
proxmox: "Proxmox",
synology: "Synology",
semaphore: "Semaphore",
gitea: "Gitea",
dockhand: "Docker",
uptimekuma: "Uptime Kuma",
phpipam: "phpIPAM",
pbs: "Proxmox Backup",
osticket: "osTicket",
};
function useClock(): Date {
const [now, setNow] = useState(() => new Date());
useEffect(() => {
const t = setInterval(() => setNow(new Date()), 1000);
return () => clearInterval(t);
}, []);
return now;
}
/** Keeps the screen awake while the page is open, where the browser allows it. */
function useWakeLock() {
useEffect(() => {
let lock: { release: () => Promise<void> } | null = null;
let gone = false;
const request = async () => {
try {
const nav = navigator as Navigator & { wakeLock?: { request: (type: "screen") => Promise<{ release: () => Promise<void> }> } };
if (nav.wakeLock && !gone) lock = await nav.wakeLock.request("screen");
} catch {
// not allowed (battery saver, no permission): the screen may sleep like any other
}
};
void request();
const onVisible = () => document.visibilityState === "visible" && void request();
document.addEventListener("visibilitychange", onVisible);
return () => {
gone = true;
document.removeEventListener("visibilitychange", onVisible);
void lock?.release().catch(() => {});
};
}, []);
}
/**
* A full-screen status board for a spare monitor or tablet: how things are, in type big enough to read across a room, refreshing
* by itself. Nothing on it can be clicked into, so it can be left alone; Esc (or the corner link) goes back to the app.
*/
export default function Wall() {
const navigate = useNavigate();
const environment = useEnvironment();
const now = useClock();
const { report, failed, reload } = useAlertsReport();
const [servers, setServers] = useState<ServerSummary | null>(null);
const [integrations, setIntegrations] = useState<IntegrationSummary[] | null>(null);
const [windows, setWindows] = useState<MaintenanceWindow[]>([]);
const [updatedAt, setUpdatedAt] = useState<Date | null>(null);
const [idle, setIdle] = useState(false);
useWakeLock();
useEffect(() => {
let alive = true;
const load = () => {
reload();
Promise.allSettled([api.servers.summary(), api.integrations.list(), api.maintenance.list()]).then(([s, i, m]) => {
if (!alive) return;
if (s.status === "fulfilled") setServers(s.value);
if (i.status === "fulfilled") setIntegrations(i.value.integrations);
if (m.status === "fulfilled") setWindows(m.value.windows);
setUpdatedAt(new Date());
});
};
load();
const t = setInterval(load, REFRESH_MS);
return () => {
alive = false;
clearInterval(t);
};
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
// Esc leaves; the pointer hides itself when nobody is using it.
useEffect(() => {
const onKey = (e: KeyboardEvent) => e.key === "Escape" && !document.fullscreenElement && navigate("/");
let timer: ReturnType<typeof setTimeout>;
const onMove = () => {
setIdle(false);
clearTimeout(timer);
timer = setTimeout(() => setIdle(true), 5000);
};
onMove();
window.addEventListener("keydown", onKey);
window.addEventListener("mousemove", onMove);
return () => {
window.removeEventListener("keydown", onKey);
window.removeEventListener("mousemove", onMove);
clearTimeout(timer);
};
}, [navigate]);
const badge = alertBadge(report);
const blind = report?.couldntCheck.length ?? 0;
const level: "critical" | "warning" | "ok" | "unsure" = !report ? "unsure" : badge ? badge.level : blind > 0 ? "unsure" : "ok";
const active = (report?.alerts ?? []).filter((a) => !a.silenced && a.severity !== "info").sort((a, b) => (a.severity === b.severity ? 0 : a.severity === "critical" ? -1 : 1));
const failing = (integrations ?? []).filter((i) => i.enabled && i.health?.status === "failing");
const offline = servers?.offline.length ?? 0;
const headline =
level === "critical" || level === "warning"
? `${badge!.count} ${badge!.count === 1 ? "thing needs" : "things need"} attention`
: level === "unsure"
? report
? "No alerts — but some checks couldn't run"
: failed
? "Can't reach the server"
: "Checking…"
: "All clear";
return (
<div className={`wall ${idle ? "wall-idle" : ""}`} data-bs-theme="dark">
<header className="wall-header">
<img src="/logo.webp" alt="Homelab Manager" width={901} height={460} className="wall-logo" />
{environment?.name && <span className="badge env-badge">{environment.name}</span>}
<div className="wall-clock" aria-label="Time">
<div className="wall-time">{now.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" })}</div>
<div className="wall-date">{now.toLocaleDateString([], { weekday: "long", day: "numeric", month: "long" })}</div>
</div>
</header>
<section className={`wall-status wall-status-${level}`} role="status" aria-live="polite">
<span className="wall-status-symbol" aria-hidden="true">
{level === "critical" ? "✕" : level === "warning" ? "▲" : level === "ok" ? "✓" : "?"}
</span>
<span>{headline}</span>
</section>
<section className="wall-tiles" aria-label="Summary">
<div className={`wall-tile ${offline > 0 ? "wall-tile-bad" : ""}`}>
<div className="wall-tile-figure">{servers ? (servers.online + offline === 0 ? "—" : `${servers.online}/${servers.online + offline}`) : "…"}</div>
<div className="wall-tile-label">servers online</div>
</div>
<div className={`wall-tile ${(report?.counts.critical ?? 0) > 0 ? "wall-tile-bad" : (report?.counts.warning ?? 0) > 0 ? "wall-tile-warn" : ""}`}>
<div className="wall-tile-figure">{report ? report.counts.critical + report.counts.warning : "…"}</div>
<div className="wall-tile-label">
alerts{report && report.counts.critical + report.counts.warning > 0 ? ` (${report.counts.critical} critical, ${report.counts.warning} warning)` : ""}
</div>
</div>
<div className={`wall-tile ${windows.length > 0 ? "wall-tile-info" : ""}`}>
<div className="wall-tile-figure">{windows.length}</div>
<div className="wall-tile-label">in maintenance</div>
</div>
<div className={`wall-tile ${failing.length > 0 ? "wall-tile-bad" : ""}`}>
<div className="wall-tile-figure">{integrations ? failing.length : "…"}</div>
<div className="wall-tile-label">integrations failing</div>
</div>
</section>
<section className="wall-columns">
<div>
<h2 className="wall-heading">Needs attention</h2>
{active.length === 0 ? (
<div className="wall-empty">Nothing right now.</div>
) : (
<ul className="wall-list">
{active.slice(0, 7).map((a) => (
<li key={a.id} className={a.severity === "critical" ? "wall-bad" : "wall-warn"}>
<span aria-hidden="true">{a.severity === "critical" ? "✕" : "▲"}</span> <span className="visually-hidden">{a.severity}: </span>
{a.message}
</li>
))}
{active.length > 7 && <li className="wall-more">and {active.length - 7} more</li>}
</ul>
)}
{windows.length > 0 && (
<>
<h2 className="wall-heading mt-4">In maintenance</h2>
<ul className="wall-list wall-list-small">
{windows.map((w) => (
<li key={w.id}>
{w.targetName} <span className="wall-dim">· {formatRemaining(w.endsAt, now.getTime())} left</span>
</li>
))}
</ul>
</>
)}
</div>
<div>
<h2 className="wall-heading">Integrations</h2>
{(integrations ?? []).filter((i) => i.enabled).length === 0 ? (
<div className="wall-empty">None connected.</div>
) : (
<ul className="wall-list wall-list-small">
{[...(integrations ?? [])]
.filter((i) => i.enabled)
.sort((a, b) => Number(b.health?.status === "failing") - Number(a.health?.status === "failing") || a.name.localeCompare(b.name))
.map((i) => {
const status = i.health?.status;
return (
<li key={i.id} className={status === "failing" ? "wall-bad" : status === "ok" ? "wall-good" : "wall-dim"}>
<span aria-hidden="true">{status === "failing" ? "✕" : status === "ok" ? "✓" : "·"}</span> {i.name}{" "}
<span className="wall-dim">
{TYPE_LABELS[i.type]} — {status === "failing" ? "failing" : status === "ok" ? "working" : "not checked yet"}
</span>
</li>
);
})}
</ul>
)}
</div>
</section>
<footer className="wall-footer">
<span>
{updatedAt ? `Updated ${updatedAt.toLocaleTimeString()}` : "Loading…"} · refreshes every {REFRESH_MS / 1000} s
</span>
<span className="wall-footer-actions">
<button type="button" className="wall-link" onClick={() => void document.documentElement.requestFullscreen?.().catch(() => {})}>
Full screen
</button>
<Link to="/" className="wall-link">
Exit (Esc)
</Link>
</span>
</footer>
</div>
);
}