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

+13
View File
@@ -42,6 +42,8 @@ import NameSettings from "./pages/settings/NameSettings";
import AlertTicketSettings from "./pages/settings/AlertTicketSettings";
import AppShell from "./layout/AppShell";
import DialogHost from "./components/DialogHost";
import Wall from "./pages/Wall";
import MapPage from "./pages/Map";
import { setDateTimeSettings } from "./utils/date";
import { setPageSize } from "./utils/pageSize";
import ToastHost from "./components/ToastHost";
@@ -92,10 +94,21 @@ export default function App() {
return <Login />;
}
// The wall display is a screen of its own, with none of the app's menu around it; everything else sits inside the shell.
return (
<Routes>
<Route path="/wall" element={<Wall />} />
<Route path="*" element={<Shelled user={user} />} />
</Routes>
);
}
function Shelled({ user }: { user: CurrentUser }) {
return (
<AppShell user={user}>
<Routes>
<Route path="/" element={<Dashboard user={user} />} />
<Route path="/map" element={<MapPage />} />
<Route path="/servers" element={<Servers user={user} />} />
<Route path="/servers/:id" element={<ServerDetail user={user} />} />
<Route path="/dns" element={<Dns user={user} />} />
+31
View File
@@ -126,6 +126,33 @@ export interface SecretInput {
checkPort?: number | null;
}
export interface MapNode {
id: string;
kind: "host" | "server" | "dns" | "monitor";
label: string;
sub: string | null;
status: "ok" | "bad" | "warn" | "unknown";
href: string | null;
}
export interface MapData {
nodes: MapNode[];
edges: { from: string; to: string }[];
/** Things that couldn't be read, so the picture is incomplete. */
notes: string[];
}
export interface ServerActivityEvent {
/** ISO. */
at: string;
kind: "change" | "health" | "maintenance";
tone: "good" | "bad" | "neutral" | "info";
title: string;
detail: string | null;
/** Who did it; "system" for the app's own checks. */
actor: string | null;
}
export interface ServerMetricSeries {
metric: string;
kind: "cpu" | "mem" | "disk";
@@ -1154,6 +1181,9 @@ export const api = {
importNames: (sex: "girls" | "boys", years: number, count: number) =>
request<NameImportPreview>("/api/generator/themes/import", { method: "POST", body: JSON.stringify({ sex, years, count }) }),
},
map: {
get: () => request<MapData>("/api/map"),
},
alerts: {
list: (refresh = false) => request<AlertsReport>(`/api/alerts${refresh ? "?refresh=1" : ""}`),
},
@@ -1251,6 +1281,7 @@ export const api = {
request<{ server: ServerRecord }>(`/api/servers/${id}`, { method: "PATCH", body: JSON.stringify(data) }),
summary: () => request<ServerSummary>("/api/servers/summary"),
detail: (id: number) => request<ServerDetail>(`/api/servers/${id}/detail`),
activity: (id: number) => request<{ events: ServerActivityEvent[] }>(`/api/servers/${id}/activity`),
metrics: (id: number, days: number) => request<{ days: number; series: ServerMetricSeries[] }>(`/api/servers/${id}/metrics?days=${days}`),
remove: (id: number) => request<void>(`/api/servers/${id}`, { method: "DELETE" }),
setTags: (id: number, tags: string[]) =>
+232 -39
View File
@@ -1,7 +1,23 @@
import { useEffect, useRef, useState, type KeyboardEvent as ReactKeyboardEvent } from "react";
import { useEffect, useMemo, useRef, useState, type KeyboardEvent as ReactKeyboardEvent } from "react";
import { useNavigate } from "react-router-dom";
import { IconSearch } from "@tabler/icons-react";
import { api, type SearchResponse, type IntegrationType, type DnsProviderType, type SecretType } from "../api/client";
import {
api,
type CurrentUser,
type DnsProviderType,
type IntegrationType,
type MaintenanceTargetType,
type MaintenanceTargets,
type MaintenanceWindow,
type SearchResponse,
type SecretType,
} from "../api/client";
import { isGroup, visibleNav } from "../layout/nav";
import { SHOW_SHORTCUTS_EVENT, shortcutHintFor } from "../layout/shortcuts";
import { DENSITIES, type Density } from "../utils/density";
import { readableError } from "../utils/errors";
import { toast } from "../utils/toast";
import { SHOW_SETUP_EVENT } from "./SetupGuide";
const SECRET_TYPE_LABELS: Record<SecretType, string> = {
api_token: "API Token",
@@ -37,10 +53,17 @@ interface PaletteItem {
category: string;
title: string;
subtitle: string;
path: string;
/** A shortcut to show beside it, e.g. "g s". */
hint?: string;
/** Go to a page… */
path?: string;
/** …or do something. */
run?: () => void | Promise<void>;
/** Extra words it can be found by. */
keywords?: string;
}
function buildItems(res: SearchResponse): PaletteItem[] {
function buildSearchItems(res: SearchResponse): PaletteItem[] {
const items: PaletteItem[] = [];
for (const s of res.servers) {
items.push({ key: `server-${s.id}`, category: "Servers", title: s.name, subtitle: s.hostname ?? "", path: `/servers/${s.id}` });
@@ -109,21 +132,45 @@ function buildItems(res: SearchResponse): PaletteItem[] {
return items;
}
export default function CommandPalette() {
/** Every word typed must appear somewhere in the item's title, subtitle or keywords. */
function matches(item: PaletteItem, terms: string[]): boolean {
if (terms.length === 0) return true;
const hay = `${item.title} ${item.subtitle} ${item.keywords ?? ""}`.toLowerCase();
return terms.every((t) => hay.includes(t));
}
const SUGGESTED_LIMIT = 9;
export default function CommandPalette({
user,
onToggleTheme,
onSetDensity,
}: {
user: CurrentUser;
onToggleTheme: () => void;
onSetDensity: (density: Density) => void;
}) {
const [open, setOpen] = useState(false);
const [query, setQuery] = useState("");
const [items, setItems] = useState<PaletteItem[]>([]);
const [loading, setLoading] = useState(false);
const [found, setFound] = useState<PaletteItem[]>([]);
const [searching, setSearching] = useState(false);
const [activeIndex, setActiveIndex] = useState(0);
const [targets, setTargets] = useState<MaintenanceTargets | null>(null);
const [windows, setWindows] = useState<MaintenanceWindow[]>([]);
const inputRef = useRef<HTMLInputElement>(null);
const opener = useRef<HTMLElement | null>(null);
const navigate = useNavigate();
const canAct = user.role === "admin" || user.role === "operator";
// Global Ctrl/Cmd+K opens the palette from anywhere in the app; Escape closes it.
// Ctrl/Cmd+K opens it from anywhere in the app; Escape closes it.
useEffect(() => {
function onKeyDown(e: KeyboardEvent) {
if ((e.ctrlKey || e.metaKey) && e.key.toLowerCase() === "k") {
e.preventDefault();
setOpen((o) => !o);
setOpen((o) => {
if (!o) opener.current = document.activeElement as HTMLElement | null;
return !o;
});
} else if (e.key === "Escape") {
setOpen(false);
}
@@ -132,37 +179,158 @@ export default function CommandPalette() {
return () => window.removeEventListener("keydown", onKeyDown);
}, []);
// On open: start clean, focus the box, and fetch what the maintenance actions need; on close: hand the focus back.
useEffect(() => {
if (open) {
setQuery("");
setItems([]);
setActiveIndex(0);
setTimeout(() => inputRef.current?.focus(), 0);
}
}, [open]);
useEffect(() => {
if (!open || query.trim().length < 2) {
setItems([]);
if (!open) {
opener.current?.focus?.();
return;
}
setLoading(true);
setQuery("");
setFound([]);
setActiveIndex(0);
setTimeout(() => inputRef.current?.focus(), 0);
api.maintenance
.list()
.then((res) => {
setTargets(res.targets);
setWindows(res.windows);
})
.catch(() => {});
}, [open]);
// The commands: pages to go to, and things to do.
const commands = useMemo<PaletteItem[]>(() => {
const items: PaletteItem[] = [];
const pages: { to: string; label: string; group: string }[] = [];
for (const entry of visibleNav(user.role)) {
if (isGroup(entry)) entry.items.forEach((i) => pages.push({ to: i.to, label: i.label, group: entry.label }));
else pages.push({ to: entry.to, label: entry.label, group: "" });
}
pages.push({ to: "/wall", label: "Wall display", group: "" });
for (const p of pages) {
items.push({ key: `page-${p.to}`, category: "Go to", title: p.label, subtitle: p.group, hint: shortcutHintFor(p.to) ?? undefined, path: p.to, keywords: "go open page" });
}
items.push({ key: "act-theme", category: "Actions", title: "Switch between light and dark mode", subtitle: "", run: onToggleTheme, keywords: "theme dark light mode appearance" });
for (const d of DENSITIES) {
items.push({ key: `act-density-${d.value}`, category: "Actions", title: `Density: ${d.label}`, subtitle: "How tightly pages are packed", run: () => onSetDensity(d.value), keywords: "density compact roomy spacing size" });
}
items.push({
key: "act-refresh-alerts",
category: "Actions",
title: "Check alerts again",
subtitle: "",
run: () => {
window.dispatchEvent(new Event("maintenance-changed"));
toast.info("Checking alerts again…");
},
keywords: "refresh reload alerts",
});
items.push({ key: "act-shortcuts", category: "Actions", title: "Show keyboard shortcuts", subtitle: "", hint: "?", run: () => void window.dispatchEvent(new Event(SHOW_SHORTCUTS_EVENT)), keywords: "keys help" });
if (user.role === "admin") {
items.push({
key: "act-setup",
category: "Actions",
title: "Show the getting started guide",
subtitle: "on the dashboard",
run: () => {
window.dispatchEvent(new Event(SHOW_SETUP_EVENT));
navigate("/");
},
keywords: "setup onboarding checklist first run",
});
}
items.push({ key: "act-signout", category: "Actions", title: "Sign out", subtitle: "", run: () => void (window.location.href = "/auth/logout"), keywords: "log out logout" });
if (canAct && targets) {
const start = (type: MaintenanceTargetType, id: number, name: string, minutes: number, words: string) => async () => {
try {
await api.maintenance.start({ targetType: type, targetId: id, minutes, reason: "Started from the command palette" });
toast.success(`${name} is silenced for ${words}. End it early under Maintenance.`);
window.dispatchEvent(new Event("maintenance-changed"));
} catch (err) {
toast.error(readableError(err));
}
};
const targetList: { type: MaintenanceTargetType; id: number; name: string; kind: string }[] = [
...targets.servers.map((s) => ({ type: "server" as const, id: s.id, name: s.name, kind: "server" })),
...targets.integrations.map((i) => ({ type: "integration" as const, id: i.id, name: i.name, kind: i.type })),
...targets.dnsProviders.map((p) => ({ type: "dns_provider" as const, id: p.id, name: p.name, kind: "DNS provider" })),
];
for (const t of targetList) {
for (const [minutes, words] of [
[60, "1 hour"],
[240, "4 hours"],
] as const) {
items.push({
key: `maint-${t.type}-${t.id}-${minutes}`,
category: "Maintenance",
title: `Silence ${t.name} for ${words}`,
subtitle: `${t.kind} · starts a maintenance window`,
run: start(t.type, t.id, t.name, minutes, words),
keywords: "maintenance silence mute window",
});
}
}
for (const w of windows) {
items.push({
key: `maint-end-${w.id}`,
category: "Maintenance",
title: `End maintenance on ${w.targetName}`,
subtitle: "alerts about it become active again",
run: async () => {
try {
await api.maintenance.end(w.id);
toast.success(`Maintenance on ${w.targetName} ended.`);
window.dispatchEvent(new Event("maintenance-changed"));
} catch (err) {
toast.error(readableError(err));
}
},
keywords: "maintenance end stop silence window",
});
}
}
return items;
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [user.role, canAct, targets, windows, onToggleTheme, onSetDensity]);
const terms = query.trim().toLowerCase().split(/\s+/).filter(Boolean);
// Data search, for two characters or more.
useEffect(() => {
if (!open || query.trim().length < 2) {
setFound([]);
setSearching(false);
return;
}
setSearching(true);
const handle = setTimeout(() => {
api.search
.query(query.trim())
.then((res) => {
setItems(buildItems(res));
setActiveIndex(0);
})
.catch(() => setItems([]))
.finally(() => setLoading(false));
.then((res) => setFound(buildSearchItems(res)))
.catch(() => setFound([]))
.finally(() => setSearching(false));
}, 200);
return () => clearTimeout(handle);
}, [query, open]);
// What is listed: with nothing typed, a few suggestions; otherwise every command that matches, then the data search results.
const items = useMemo(() => {
if (terms.length === 0) {
const wanted = ["page-/", "page-/alerts", "page-/servers", "page-/maintenance", "page-/wall", "act-theme", "act-shortcuts"];
return wanted.map((k) => commands.find((c) => c.key === k)).filter((c): c is PaletteItem => !!c).slice(0, SUGGESTED_LIMIT);
}
return [...commands.filter((c) => matches(c, terms)).slice(0, 14), ...found];
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [commands, found, query]);
useEffect(() => setActiveIndex(0), [items.length, query]);
function go(item: PaletteItem) {
setOpen(false);
navigate(item.path);
if (item.run) void item.run();
else if (item.path) navigate(item.path);
}
function handleInputKeyDown(e: ReactKeyboardEvent<HTMLInputElement>) {
@@ -175,16 +343,28 @@ export default function CommandPalette() {
} else if (e.key === "Enter") {
e.preventDefault();
if (items[activeIndex]) go(items[activeIndex]);
} else if (e.key === "Tab") {
// Nothing else in here is worth tabbing to: the list is driven from the box.
e.preventDefault();
}
}
// Keep the highlighted row in view as the arrows move it.
useEffect(() => {
document.getElementById(`palette-opt-${activeIndex}`)?.scrollIntoView({ block: "nearest" });
}, [activeIndex]);
if (!open) {
return (
<button
type="button"
className="btn btn-outline-secondary btn-sm w-100 d-flex align-items-center justify-content-center gap-2"
onClick={() => setOpen(true)}
title="Search (Ctrl/Cmd+K)"
onClick={() => {
opener.current = document.activeElement as HTMLElement | null;
setOpen(true);
}}
title="Search and actions (Ctrl/Cmd+K)"
aria-keyshortcuts="Control+K Meta+K"
>
<IconSearch size={16} />
Search
@@ -194,6 +374,7 @@ export default function CommandPalette() {
}
let lastCategory = "";
const empty = terms.length > 0 && items.length === 0 && !searching;
return (
<>
@@ -204,7 +385,7 @@ export default function CommandPalette() {
for a result row. */}
<div className="modal-backdrop show"></div>
<div className="modal modal-blur show" style={{ display: "block" }} onClick={() => setOpen(false)}>
<div className="modal-dialog modal-dialog-centered" style={{ maxWidth: 600 }} onClick={(e) => e.stopPropagation()}>
<div className="modal-dialog modal-dialog-centered" role="dialog" aria-modal="true" aria-label="Search and actions" style={{ maxWidth: 640 }} onClick={(e) => e.stopPropagation()}>
<div className="modal-content">
<div className="modal-body p-0">
<div className="p-2 border-bottom">
@@ -215,41 +396,53 @@ export default function CommandPalette() {
<input
ref={inputRef}
type="text"
role="combobox"
aria-expanded="true"
aria-controls="palette-list"
aria-activedescendant={items[activeIndex] ? `palette-opt-${activeIndex}` : undefined}
aria-autocomplete="list"
aria-label="Search, or type a command"
className="form-control form-control-lg border-0"
placeholder="Search servers, DNS, secrets, IPs, integrations…"
placeholder="Search, or type a command: silence, theme, wall…"
value={query}
onChange={(e) => setQuery(e.target.value)}
onKeyDown={handleInputKeyDown}
/>
</div>
</div>
<div style={{ maxHeight: "60vh", overflowY: "auto" }}>
{loading && <div className="p-3 text-secondary">Searching…</div>}
{!loading && query.trim().length >= 2 && items.length === 0 && <div className="p-3 text-secondary">No matches.</div>}
{!loading && query.trim().length < 2 && <div className="p-3 text-secondary">Type at least 2 characters…</div>}
<div id="palette-list" role="listbox" aria-label="Results" style={{ maxHeight: "60vh", overflowY: "auto" }}>
{items.map((item, index) => {
const showHeader = item.category !== lastCategory;
lastCategory = item.category;
return (
<div key={item.key}>
<div key={item.key} role="presentation">
{showHeader && (
<div className="px-3 pt-2 pb-1 text-uppercase text-secondary" style={{ fontSize: "0.7rem" }}>
<div role="presentation" className="px-3 pt-2 pb-1 text-uppercase text-secondary" style={{ fontSize: "0.7rem" }}>
{item.category}
</div>
)}
<div
id={`palette-opt-${index}`}
role="option"
aria-selected={index === activeIndex}
className={`px-3 py-2 d-flex justify-content-between align-items-center gap-3 ${index === activeIndex ? "bg-secondary-lt" : ""}`}
style={{ cursor: "pointer" }}
onMouseEnter={() => setActiveIndex(index)}
onClick={() => go(item)}
>
<div className="text-truncate">{item.title}</div>
{item.subtitle && <div className="text-secondary small text-truncate">{item.subtitle}</div>}
<div className="d-flex align-items-center gap-2 flex-shrink-0">
{item.subtitle && <span className="text-secondary small text-truncate">{item.subtitle}</span>}
{item.hint && <kbd>{item.hint}</kbd>}
</div>
</div>
</div>
);
})}
</div>
<div className="px-3 py-2 border-top text-secondary small" role="status" aria-live="polite">
{searching ? "Searching…" : empty ? "No matches." : terms.length === 0 ? "Type to search servers, DNS, secrets and more — or a command." : `${items.length} result${items.length === 1 ? "" : "s"}`}
</div>
</div>
</div>
</div>
+134
View File
@@ -0,0 +1,134 @@
import { useEffect, useId, useRef, type ReactNode } from "react";
import { createPortal } from "react-dom";
import { IconX } from "@tabler/icons-react";
import { formatDateTime } from "../utils/date";
/**
* A panel that slides in from the right with everything about one row, so the table stays where it was. Mount it only while a row
* is selected. Escape or a click outside closes it, the keyboard stays inside while it is open, and the focus goes back to the
* row it came from.
*/
export default function DetailDrawer({ title, subtitle, onClose, children }: { title: string; subtitle?: string; onClose: () => void; children: ReactNode }) {
const titleId = useId();
const closeRef = useRef<HTMLButtonElement>(null);
const panelRef = useRef<HTMLDivElement>(null);
useEffect(() => {
const opener = document.activeElement as HTMLElement | null;
closeRef.current?.focus();
const onKey = (e: KeyboardEvent) => {
if (e.key === "Escape") {
e.stopPropagation();
onClose();
} else if (e.key === "Tab" && panelRef.current) {
const focusable = panelRef.current.querySelectorAll<HTMLElement>('a[href], button:not([disabled]), input:not([disabled]), select, textarea, [tabindex]:not([tabindex="-1"])');
if (focusable.length === 0) return;
const first = focusable[0];
const last = focusable[focusable.length - 1];
if (e.shiftKey && document.activeElement === first) {
e.preventDefault();
last.focus();
} else if (!e.shiftKey && document.activeElement === last) {
e.preventDefault();
first.focus();
}
}
};
document.addEventListener("keydown", onKey, true);
return () => {
document.removeEventListener("keydown", onKey, true);
opener?.focus?.();
};
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
return createPortal(
<>
<div className="detail-backdrop" onClick={onClose} />
<div ref={panelRef} className="detail-drawer" role="dialog" aria-modal="true" aria-labelledby={titleId}>
<div className="detail-drawer-header">
<div className="flex-fill" style={{ minWidth: 0 }}>
<h3 className="mb-0 text-truncate" id={titleId}>
{title}
</h3>
{subtitle && <div className="text-secondary small text-truncate">{subtitle}</div>}
</div>
<button ref={closeRef} type="button" className="btn btn-icon btn-ghost-secondary" aria-label="Close" onClick={onClose}>
<IconX size={18} />
</button>
</div>
<div className="detail-drawer-body">{children}</div>
</div>
</>,
document.body,
);
}
// ─── Showing every field of a record ────────────────────────────────────────
/** "environmentName" → "Environment name". */
function humanize(key: string): string {
const spaced = key
.replace(/([a-z])([A-Z])/g, "$1 $2")
.replace(/([a-zA-Z])(\d)/g, "$1 $2")
.replace(/[_-]+/g, " ")
.toLowerCase()
// A trailing unit reads better in brackets: "Response time (ms)".
.replace(/ (ms|kb|mb|gb|tb)$/, " ($1)");
return spaced.charAt(0).toUpperCase() + spaced.slice(1);
}
function formatBytes(bytes: number): string {
const units = ["B", "KB", "MB", "GB", "TB", "PB"];
let value = bytes;
let unit = 0;
while (value >= 1024 && unit < units.length - 1) {
value /= 1024;
unit++;
}
return `${value.toFixed(unit === 0 ? 0 : 1)} ${units[unit]}`;
}
const ISO_DATE = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/;
function formatValue(key: string, value: unknown): ReactNode {
if (value === null || value === undefined || value === "") return <span className="text-secondary">—</span>;
if (typeof value === "boolean") return value ? "Yes" : "No";
if (typeof value === "number") return /bytes?$/i.test(key) ? `${formatBytes(value)} (${value.toLocaleString()} bytes)` : value.toLocaleString();
if (typeof value === "string") {
if (ISO_DATE.test(value) && !Number.isNaN(Date.parse(value))) return formatDateTime(new Date(value));
return value;
}
return null;
}
/** Every field of a record as a labelled list: dates and sizes made readable, lists joined, nested records indented. */
export function ObjectDetails({ data, omit = [], labels = {}, depth = 0 }: { data: object; omit?: string[]; labels?: Record<string, string>; depth?: number }) {
const entries = Object.entries(data).filter(([k]) => !omit.includes(k));
return (
<dl className={`detail-list ${depth > 0 ? "detail-list-nested" : ""}`}>
{entries.map(([key, value]) => {
const label = labels[key] ?? humanize(key);
let shown: ReactNode = formatValue(key, value);
if (shown === null) {
if (Array.isArray(value)) {
if (value.length === 0) shown = <span className="text-secondary">—</span>;
else if (value.every((v) => v === null || typeof v !== "object")) shown = value.map((v) => String(v)).join(", ");
else if (depth < 2) shown = value.map((v, i) => <ObjectDetails key={i} data={v as object} depth={depth + 1} />);
else shown = `${value.length} items`;
} else if (typeof value === "object" && depth < 2) {
shown = <ObjectDetails data={value as object} depth={depth + 1} />;
} else {
shown = String(value);
}
}
return (
<div key={key}>
<dt>{label}</dt>
<dd>{shown}</dd>
</div>
);
})}
</dl>
);
}
+72
View File
@@ -0,0 +1,72 @@
import { useEffect, useState } from "react";
import { IconAlertTriangle, IconCircleCheck, IconEdit, IconTool } from "@tabler/icons-react";
import { api, type ServerActivityEvent } from "../api/client";
import { formatDateTime } from "../utils/date";
import { formatAgo } from "../utils/duration";
import { BlockSkeleton } from "./Skeleton";
const TONE_CLASS: Record<ServerActivityEvent["tone"], string> = {
good: "text-green",
bad: "text-red",
info: "text-blue",
neutral: "text-secondary",
};
function EventIcon({ event }: { event: ServerActivityEvent }) {
const cls = TONE_CLASS[event.tone];
if (event.kind === "maintenance") return <IconTool size={18} className={cls} aria-hidden="true" />;
if (event.kind === "health") return event.tone === "good" ? <IconCircleCheck size={18} className={cls} aria-hidden="true" /> : <IconAlertTriangle size={18} className={cls} aria-hidden="true" />;
return <IconEdit size={18} className={cls} aria-hidden="true" />;
}
/** What has happened to a server, newest first. For operators and admins, since it draws on the audit log. */
export default function ServerActivity({ serverId }: { serverId: number }) {
const [events, setEvents] = useState<ServerActivityEvent[] | null>(null);
const [failed, setFailed] = useState(false);
useEffect(() => {
let alive = true;
api.servers
.activity(serverId)
.then((res) => alive && setEvents(res.events))
.catch(() => alive && setFailed(true));
return () => {
alive = false;
};
}, [serverId]);
return (
<div className="card mb-3">
<div className="card-header">
<h3 className="card-title">Activity</h3>
</div>
<div className="card-body">
{failed ? (
<div className="text-secondary">Couldn't load the activity.</div>
) : events === null ? (
<BlockSkeleton lines={4} />
) : events.length === 0 ? (
<div className="text-secondary">Nothing recorded yet. Changes to this server, times it stopped reporting, and its maintenance windows will be listed here.</div>
) : (
<ol className="activity-list">
{events.map((e, i) => (
<li key={`${e.at}-${i}`}>
<EventIcon event={e} />
<div className="flex-fill" style={{ minWidth: 0 }}>
<div>
{e.title}
{e.actor && <span className="text-secondary"> · {e.actor === "system" ? "automatic" : e.actor}</span>}
</div>
{e.detail && <div className="text-secondary small">{e.detail}</div>}
</div>
<time className="text-secondary small text-nowrap" dateTime={e.at} title={formatDateTime(new Date(e.at))}>
{Date.parse(e.at) > Date.now() ? `at ${formatDateTime(new Date(e.at))}` : formatAgo(e.at)}
</time>
</li>
))}
</ol>
)}
</div>
</div>
);
}
+97
View File
@@ -0,0 +1,97 @@
import { useEffect, useState } from "react";
import { Link } from "react-router-dom";
import { IconCircle, IconCircleCheck, IconX } from "@tabler/icons-react";
export interface SetupStep {
id: string;
title: string;
description: string;
to: string;
/** What to call the button that goes there. */
action: string;
done: boolean;
}
const DISMISSED_KEY = "hlm-setup-dismissed";
export const SHOW_SETUP_EVENT = "show-setup-guide";
function wasDismissed(): boolean {
try {
return localStorage.getItem(DISMISSED_KEY) === "1";
} catch {
return false;
}
}
/**
* A checklist for a new installation, at the top of the dashboard: what to set up, which steps are already done (worked out from
* what exists, never ticked by hand), and a way to put it away. It goes by itself once everything is done.
*/
export default function SetupGuide({ steps }: { steps: SetupStep[] }) {
const [dismissed, setDismissed] = useState(wasDismissed);
// The command palette can bring it back.
useEffect(() => {
const show = () => {
try {
localStorage.removeItem(DISMISSED_KEY);
} catch {
// not remembered; it shows for this visit anyway
}
setDismissed(false);
};
window.addEventListener(SHOW_SETUP_EVENT, show);
return () => window.removeEventListener(SHOW_SETUP_EVENT, show);
}, []);
const done = steps.filter((s) => s.done).length;
if (dismissed || steps.length === 0 || done === steps.length) return null;
const dismiss = () => {
try {
localStorage.setItem(DISMISSED_KEY, "1");
} catch {
// not remembered; it is gone for this visit anyway
}
setDismissed(true);
};
return (
<div className="card mb-3" role="region" aria-labelledby="setup-guide-title">
<div className="card-header">
<div>
<h3 className="card-title" id="setup-guide-title">
Getting started
</h3>
<div className="text-secondary small">
{done} of {steps.length} done
</div>
</div>
<div className="card-actions">
<button type="button" className="btn btn-sm btn-ghost-secondary" onClick={dismiss} aria-label="Hide the getting started guide" title="Hide this guide (bring it back from the search box: Ctrl K)">
<IconX size={16} />
</button>
</div>
</div>
<div className="progress progress-sm rounded-0" role="progressbar" aria-label="Setup progress" aria-valuemin={0} aria-valuemax={steps.length} aria-valuenow={done}>
<div className="progress-bar bg-green" style={{ width: `${(done / steps.length) * 100}%` }} />
</div>
<ul className="list-group list-group-flush">
{steps.map((s) => (
<li key={s.id} className="list-group-item d-flex align-items-center gap-3">
{s.done ? <IconCircleCheck size={22} className="text-green flex-shrink-0" aria-label="Done" /> : <IconCircle size={22} className="text-secondary flex-shrink-0" aria-label="Not done yet" />}
<div className="flex-fill" style={{ minWidth: 0 }}>
<div className={s.done ? "text-secondary" : "fw-medium"}>{s.title}</div>
{!s.done && <div className="text-secondary small">{s.description}</div>}
</div>
{!s.done && (
<Link to={s.to} className="btn btn-sm btn-primary flex-shrink-0">
{s.action}
</Link>
)}
</li>
))}
</ul>
</div>
);
}
+85
View File
@@ -0,0 +1,85 @@
import { useEffect, useId, useRef, useState } from "react";
import { createPortal } from "react-dom";
import { GO_SHORTCUTS, OTHER_SHORTCUTS, SHOW_SHORTCUTS_EVENT } from "../layout/shortcuts";
/** The keyboard shortcuts, listed. Opens on "?", from the command palette, or when asked for by event. Mount once, near the root. */
export default function ShortcutHelp() {
const [open, setOpen] = useState(false);
const titleId = useId();
const closeRef = useRef<HTMLButtonElement>(null);
const opener = useRef<HTMLElement | null>(null);
useEffect(() => {
const show = () => {
opener.current = document.activeElement as HTMLElement | null;
setOpen(true);
};
window.addEventListener(SHOW_SHORTCUTS_EVENT, show);
return () => window.removeEventListener(SHOW_SHORTCUTS_EVENT, show);
}, []);
useEffect(() => {
if (!open) return;
closeRef.current?.focus();
const onKey = (e: KeyboardEvent) => {
if (e.key === "Escape") {
e.stopPropagation();
setOpen(false);
} else if (e.key === "Tab") {
// The only thing to reach is the close button, so keep the keyboard on it.
e.preventDefault();
closeRef.current?.focus();
}
};
document.addEventListener("keydown", onKey, true);
return () => {
document.removeEventListener("keydown", onKey, true);
opener.current?.focus?.();
};
}, [open]);
if (!open) return null;
return createPortal(
<>
<div className="modal-backdrop show" />
<div className="modal modal-blur show" style={{ display: "block" }} onClick={() => setOpen(false)}>
<div className="modal-dialog modal-dialog-centered" role="dialog" aria-modal="true" aria-labelledby={titleId} onClick={(e) => e.stopPropagation()}>
<div className="modal-content">
<div className="modal-header">
<h3 className="modal-title" id={titleId}>
Keyboard shortcuts
</h3>
<button ref={closeRef} type="button" className="btn-close" aria-label="Close" onClick={() => setOpen(false)} />
</div>
<div className="modal-body">
<div className="fw-bold mb-2">Go to a page — press g, then…</div>
<dl className="shortcut-list mb-3">
{GO_SHORTCUTS.map((s) => (
<div key={s.key}>
<dt>
<kbd>g</kbd> <kbd>{s.key}</kbd>
</dt>
<dd>{s.label}</dd>
</div>
))}
</dl>
<div className="fw-bold mb-2">Anywhere</div>
<dl className="shortcut-list mb-0">
{OTHER_SHORTCUTS.map((s) => (
<div key={s.keys}>
<dt>
<kbd>{s.keys}</kbd>
</dt>
<dd>{s.label}</dd>
</div>
))}
</dl>
<div className="text-secondary small mt-3">Shortcuts for pages you can't open are ignored. They don't fire while you are typing in a box.</div>
</div>
</div>
</div>
</div>
</>,
document.body,
);
}
+11 -10
View File
@@ -1,6 +1,10 @@
import type { ReactNode } from "react";
import type { SortDirection } from "../hooks/useSortable";
/**
* A column heading that sorts the table. The button inside is what the keyboard reaches and a screen reader announces ("Name,
* sorted ascending"); the heading itself stays a real column header, so the table keeps its meaning for assistive technology.
*/
export default function SortableTh<T>({
label,
sortKeyName,
@@ -18,16 +22,13 @@ export default function SortableTh<T>({
}) {
const active = activeKey === sortKeyName;
return (
<th
className={className}
role="button"
style={{ cursor: "pointer", userSelect: "none", whiteSpace: "nowrap" }}
onClick={() => onSort(sortKeyName)}
>
{label}
<span className={active ? "" : "text-secondary"} style={{ marginLeft: 4, opacity: active ? 1 : 0.4 }}>
{active ? (direction === "asc" ? "▲" : "▼") : "↕"}
</span>
<th className={className} scope="col" aria-sort={active ? (direction === "asc" ? "ascending" : "descending") : "none"}>
<button type="button" className="th-sort" onClick={() => onSort(sortKeyName)}>
{label}
<span aria-hidden="true" className={active ? "" : "text-secondary"} style={{ marginLeft: 4, opacity: active ? 1 : 0.4 }}>
{active ? (direction === "asc" ? "▲" : "▼") : "↕"}
</span>
</button>
</th>
);
}
+52
View File
@@ -0,0 +1,52 @@
import { useEffect } from "react";
const CONTROL = "input:not([type=hidden]), select, textarea";
let counter = 0;
/**
* Tabler's forms put a <label class="form-label"> beside its field without tying the two together, so a screen reader reaches
* the field and hears nothing. This ties each such label to the first field after it (inside the same block), by giving the
* field an id and the label a "for". Fields that are already labelled are left alone.
*/
function associate(label: HTMLLabelElement): void {
if (label.htmlFor || label.querySelector(CONTROL)) return;
let sibling = label.nextElementSibling as HTMLElement | null;
while (sibling && !sibling.matches("label")) {
const control = sibling.matches(CONTROL) ? sibling : sibling.querySelector<HTMLElement>(CONTROL);
if (control) {
if (!control.id) control.id = `fld-${++counter}`;
label.htmlFor = control.id;
return;
}
sibling = sibling.nextElementSibling as HTMLElement | null;
}
}
/** The tick-boxes that select rows have no text of their own; say what they are. */
function nameRowCheckboxes(root: ParentNode): void {
root.querySelectorAll<HTMLInputElement>("input[type=checkbox].form-check-input").forEach((box) => {
if (box.getAttribute("aria-label") || box.closest("label") || box.labels?.length) return;
box.setAttribute("aria-label", box.closest("thead") ? "Select all rows on this page" : "Select this row");
});
}
/** Keeps every form in the app readable to assistive technology as pages load and change, without each form doing it. */
export function useFormLabels(): void {
useEffect(() => {
let timer: ReturnType<typeof setTimeout> | null = null;
const run = () => {
timer = null;
document.querySelectorAll<HTMLLabelElement>("label.form-label").forEach(associate);
nameRowCheckboxes(document);
};
const observer = new MutationObserver(() => {
if (!timer) timer = setTimeout(run, 30);
});
observer.observe(document.body, { childList: true, subtree: true });
run();
return () => {
observer.disconnect();
if (timer) clearTimeout(timer);
};
}, []);
}
+31
View File
@@ -0,0 +1,31 @@
import { useState, type KeyboardEvent, type MouseEvent } from "react";
/**
* Makes the rows of a table open a detail panel. Spread `rowProps(item)` onto the row: a click or Enter on the row opens it, but
* a click on a button, link or tick-box inside the row does its own thing and leaves the panel alone.
*/
export function useRowDetail<T>() {
const [selected, setSelected] = useState<T | null>(null);
function rowProps(item: T) {
return {
className: "row-clickable",
tabIndex: 0,
"aria-haspopup": "dialog" as const,
onClick: (e: MouseEvent<HTMLElement>) => {
if ((e.target as HTMLElement).closest("a, button, input, select, textarea, label, summary")) return;
// The row takes the focus, so it is what the keyboard comes back to when the panel closes.
e.currentTarget.focus({ preventScroll: true });
setSelected(item);
},
onKeyDown: (e: KeyboardEvent<HTMLElement>) => {
if (e.key === "Enter" && e.target === e.currentTarget) {
e.preventDefault();
setSelected(item);
}
},
};
}
return { selected, close: () => setSelected(null), rowProps };
}
+72
View File
@@ -0,0 +1,72 @@
import { useEffect } from "react";
import { useNavigate } from "react-router-dom";
import type { CurrentUser } from "../api/client";
import { visibleNav, isGroup } from "../layout/nav";
import { GO_SHORTCUTS, SHOW_SHORTCUTS_EVENT } from "../layout/shortcuts";
/** Whether the keyboard is typing into something, in which case a letter is a letter and not a shortcut. */
function isTyping(target: EventTarget | null): boolean {
const el = target as HTMLElement | null;
if (!el || !el.tagName) return false;
return el.isContentEditable || ["INPUT", "TEXTAREA", "SELECT"].includes(el.tagName);
}
/**
* Page shortcuts for anyone signed in: "g" then a letter goes to a page they are allowed to see, "/" jumps to the table's
* search box, "?" shows the list. Ignored while typing, while a dialog is open, and with Ctrl/Alt/Cmd held (those are the
* browser's and the command palette's).
*/
export function useShortcuts(user: CurrentUser): void {
const navigate = useNavigate();
useEffect(() => {
const allowed = new Set<string>(["/", "/wall"]);
for (const entry of visibleNav(user.role)) {
if (isGroup(entry)) entry.items.forEach((i) => allowed.add(i.to));
else allowed.add(entry.to);
}
let waitingForSecondKey = false;
let timer: ReturnType<typeof setTimeout> | null = null;
const reset = () => {
waitingForSecondKey = false;
if (timer) clearTimeout(timer);
timer = null;
};
function onKeyDown(e: KeyboardEvent) {
if (e.ctrlKey || e.metaKey || e.altKey || isTyping(e.target)) return;
if (document.querySelector('[role="dialog"][aria-modal="true"]')) return;
if (waitingForSecondKey) {
reset();
const hit = GO_SHORTCUTS.find((s) => s.key === e.key.toLowerCase());
if (hit && allowed.has(hit.to)) {
e.preventDefault();
navigate(hit.to);
}
return;
}
if (e.key === "g") {
waitingForSecondKey = true;
timer = setTimeout(reset, 1200);
} else if (e.key === "?") {
e.preventDefault();
window.dispatchEvent(new Event(SHOW_SHORTCUTS_EVENT));
} else if (e.key === "/") {
const box = document.querySelector<HTMLInputElement>(".table-search input");
if (box) {
e.preventDefault();
box.focus();
box.select();
}
}
}
window.addEventListener("keydown", onKeyDown);
return () => {
window.removeEventListener("keydown", onKeyDown);
reset();
};
}, [user.role, navigate]);
}
+65 -151
View File
@@ -1,42 +1,8 @@
import { useEffect, useRef, useState, type ReactNode } from "react";
import { Link, NavLink, useLocation } from "react-router-dom";
import {
IconLayoutDashboard,
IconServer2,
IconWorld,
IconNetwork,
IconKey,
IconPlugConnected,
IconBrandDocker,
IconAffiliate,
IconPlayerPlay,
IconBrandGit,
IconServerCog,
IconDatabase,
IconUsers,
IconDevices,
IconHistory,
IconStethoscope,
IconSettings,
IconMenu2,
IconSun,
IconMoon,
IconWand,
IconTool,
IconWorldWww,
IconListCheck,
IconShieldLock,
IconRefresh,
IconActivityHeartbeat,
IconShieldCheck,
IconTicket,
IconPlug,
IconExternalLink,
IconAlertTriangle,
IconChevronUp,
IconLogout,
} from "@tabler/icons-react";
import { IconMenu2, IconSun, IconMoon, IconShieldLock, IconTool, IconChevronUp, IconLogout, IconDeviceDesktop } from "@tabler/icons-react";
import { api, type CurrentUser, type MaintenanceWindow } from "../api/client";
import { isCurrent, isGroup, visibleNav, type NavGroup } from "./nav";
import { formatRemaining } from "../utils/duration";
import { getTheme, setTheme, type Theme } from "../utils/theme";
import { DENSITIES, getDensity, setDensity, type Density } from "../utils/density";
@@ -44,6 +10,9 @@ import CommandPalette from "../components/CommandPalette";
import { isLightColor, useEnvironment } from "../utils/environment";
import { alertBadge, useAlertsReport } from "../hooks/useAlertsReport";
import { useStackedTables } from "../hooks/useStackedTables";
import { useShortcuts } from "../hooks/useShortcuts";
import { useFormLabels } from "../hooks/useFormLabels";
import ShortcutHelp from "../components/ShortcutHelp";
import { useBreadcrumbTailValue } from "../utils/breadcrumb";
interface NavBadge {
@@ -58,110 +27,6 @@ function initialsOf(name: string): string {
return (words.length > 1 ? words[0][0] + words[1][0] : (words[0] ?? "?").slice(0, 2)).toUpperCase();
}
type Role = "operator" | "admin";
interface NavLeaf {
to: string;
label: string;
/** Shown for top-level links, and when a group is left with a single visible page and so is drawn as that page's own link. */
icon: ReactNode;
minRole?: Role;
}
interface NavGroup {
id: string;
label: string;
icon: ReactNode;
items: NavLeaf[];
}
type NavEntry = NavLeaf | NavGroup;
const isGroup = (entry: NavEntry): entry is NavGroup => "items" in entry;
const NAV: NavEntry[] = [
{ to: "/", label: "Dashboard", icon: <IconLayoutDashboard size={20} /> },
{
id: "infrastructure",
label: "Infrastructure",
icon: <IconServer2 size={20} />,
items: [
{ to: "/servers", label: "Servers", icon: <IconServer2 size={20} /> },
{ to: "/proxmox", label: "Proxmox", icon: <IconServerCog size={20} /> },
{ to: "/synology", label: "Synology", icon: <IconDatabase size={20} /> },
{ to: "/pbs", label: "Proxmox Backup", icon: <IconShieldCheck size={20} /> },
{ to: "/docker", label: "Docker", icon: <IconBrandDocker size={20} /> },
{ to: "/tailscale", label: "Tailscale", icon: <IconAffiliate size={20} /> },
],
},
{
id: "network",
label: "Network",
icon: <IconWorld size={20} />,
items: [
{ to: "/dns", label: "DNS", icon: <IconWorld size={20} /> },
{ to: "/domains", label: "Domains", icon: <IconWorldWww size={20} /> },
{ to: "/ipam", label: "IP Addresses", icon: <IconNetwork size={20} /> },
{ to: "/ports", label: "Ports", icon: <IconPlug size={20} /> },
{ to: "/consistency", label: "Consistency", icon: <IconListCheck size={20} /> },
],
},
{
id: "automation",
label: "Automation",
icon: <IconRefresh size={20} />,
items: [
{ to: "/semaphore", label: "Semaphore", icon: <IconPlayerPlay size={20} /> },
{ to: "/gitea", label: "Gitea", icon: <IconBrandGit size={20} /> },
],
},
{ to: "/secrets", label: "Secrets", icon: <IconKey size={20} /> },
{
id: "operations",
label: "Operations",
icon: <IconTool size={20} />,
items: [
{ to: "/alerts", label: "Alerts", icon: <IconAlertTriangle size={20} /> },
{ to: "/maintenance", label: "Maintenance", icon: <IconTool size={20} /> },
{ to: "/uptime-kuma", label: "Uptime Kuma", icon: <IconActivityHeartbeat size={20} /> },
{ to: "/osticket", label: "osTicket", icon: <IconTicket size={20} /> },
{ to: "/admin-links", label: "Admin Links", icon: <IconExternalLink size={20} /> },
{ to: "/generator", label: "Generator", icon: <IconWand size={20} /> },
],
},
{
id: "administration",
label: "Administration",
icon: <IconSettings size={20} />,
items: [
{ to: "/integrations", label: "Integrations", icon: <IconPlugConnected size={20} /> },
{ to: "/users", label: "Users", icon: <IconUsers size={20} />, minRole: "admin" },
{ to: "/sessions", label: "Sessions", icon: <IconDevices size={20} />, minRole: "admin" },
{ to: "/audit-log", label: "Audit Log", icon: <IconHistory size={20} />, minRole: "operator" },
{ to: "/diag-log", label: "Diagnostic Log", icon: <IconStethoscope size={20} />, minRole: "admin" },
{ to: "/settings", label: "Settings", icon: <IconSettings size={20} />, minRole: "admin" },
],
},
];
const roleRank: Record<CurrentUser["role"], number> = { viewer: 0, operator: 1, admin: 2 };
/** What this role can see: pages it isn't allowed are dropped, an emptied group disappears, and a group down to one page becomes that page's own link. */
function visibleNav(role: CurrentUser["role"]): NavEntry[] {
const allowed = (leaf: NavLeaf) => !leaf.minRole || roleRank[role] >= roleRank[leaf.minRole];
const out: NavEntry[] = [];
for (const entry of NAV) {
if (!isGroup(entry)) {
if (allowed(entry)) out.push(entry);
continue;
}
const items = entry.items.filter(allowed);
if (items.length === 1) out.push(items[0]);
else if (items.length > 1) out.push({ ...entry, items });
}
return out;
}
const OPEN_GROUPS_KEY = "hlm-nav-open-groups";
function loadOpenGroups(): Set<string> {
@@ -173,11 +38,6 @@ function loadOpenGroups(): Set<string> {
}
}
/** Is this the current page (or a page beneath it, like /servers/3 under /servers)? */
function isCurrent(pathname: string, to: string): boolean {
return to === "/" ? pathname === "/" : pathname === to || pathname.startsWith(`${to}/`);
}
export default function AppShell({ user, children }: { user: CurrentUser; children: ReactNode }) {
const [sidebarOpen, setSidebarOpen] = useState(false);
const [theme, setThemeState] = useState<Theme>(() => getTheme());
@@ -185,6 +45,11 @@ export default function AppShell({ user, children }: { user: CurrentUser; childr
const [maintenance, setMaintenance] = useState<MaintenanceWindow[]>([]);
const environment = useEnvironment();
useStackedTables();
useShortcuts(user);
useFormLabels();
const mainRef = useRef<HTMLElement>(null);
const [announcement, setAnnouncement] = useState("");
const firstRoute = useRef(true);
const breadcrumbTail = useBreadcrumbTailValue();
const { report } = useAlertsReport();
const [menuOpen, setMenuOpen] = useState(false);
@@ -228,6 +93,18 @@ export default function AppShell({ user, children }: { user: CurrentUser; childr
const nav = visibleNav(user.role);
const { pathname } = useLocation();
// A page change in a single-page app is silent: tell screen readers where they are, and move the keyboard to the new page's start
// (not on the first load, where the browser has already done its own thing).
useEffect(() => {
const timer = setTimeout(() => {
const title = document.querySelector(".page-title")?.textContent?.trim() || document.title;
setAnnouncement(title);
if (!firstRoute.current) mainRef.current?.focus({ preventScroll: true });
firstRoute.current = false;
}, 200);
return () => clearTimeout(timer);
}, [pathname]);
// Where this page sits in the menu: "Infrastructure › Servers", and on a page about one thing, that thing's name as well.
const crumbs: { label: string; to?: string }[] = [];
for (const entry of nav) {
@@ -285,7 +162,8 @@ export default function AppShell({ user, children }: { user: CurrentUser; childr
const b = badges[to];
return b ? (
<span className={`badge ms-auto ${b.className}`} title={b.title}>
{b.text}
<span aria-hidden="true">{b.text}</span>
<span className="visually-hidden">{b.title}</span>
</span>
) : null;
};
@@ -298,7 +176,21 @@ export default function AppShell({ user, children }: { user: CurrentUser; childr
return (
<div className="page">
<aside className="navbar navbar-vertical navbar-expand-lg" data-bs-theme={environment && isLightColor(environment.color) ? "light" : "dark"}>
<a
className="skip-link"
href="#main"
onClick={(e) => {
e.preventDefault();
mainRef.current?.focus();
}}
>
Skip to content
</a>
<div className="visually-hidden" role="status" aria-live="polite" aria-atomic="true">
{announcement}
</div>
<ShortcutHelp />
<aside aria-label="Homelab Manager" className="navbar navbar-vertical navbar-expand-lg" data-bs-theme={environment && isLightColor(environment.color) ? "light" : "dark"}>
<div className="container-fluid">
<button
type="button"
@@ -318,8 +210,16 @@ export default function AppShell({ user, children }: { user: CurrentUser; childr
</h1>
<div className={`navbar-collapse collapse ${sidebarOpen ? "show" : ""}`}>
<div className="px-3 pt-3 pt-lg-0">
<CommandPalette />
<CommandPalette
user={user}
onToggleTheme={toggleTheme}
onSetDensity={(d) => {
setDensity(d);
setDensityState(d);
}}
/>
</div>
<nav aria-label="Main menu">
<ul className="navbar-nav pt-lg-3">
{nav.map((entry) => {
if (!isGroup(entry)) {
@@ -353,7 +253,8 @@ export default function AppShell({ user, children }: { user: CurrentUser; childr
const worst = inside.find((b) => b.className.includes("bg-red")) ?? inside.find((b) => b.className.includes("bg-yellow")) ?? inside[0];
return (
<span className={`badge ms-auto me-4 ${worst.className}`} title={inside.map((b) => b.title).join(", ")}>
{inside.reduce((n, b) => n + Number(b.text), 0)}
<span aria-hidden="true">{inside.reduce((n, b) => n + Number(b.text), 0)}</span>
<span className="visually-hidden">{inside.map((b) => b.title).join(", ")}</span>
</span>
);
})()}
@@ -375,6 +276,7 @@ export default function AppShell({ user, children }: { user: CurrentUser; childr
);
})}
</ul>
</nav>
<div className="navbar-footer px-3 user-menu" ref={menuRef}>
{menuOpen && (
<div className="user-menu-list" role="menu">
@@ -413,6 +315,18 @@ export default function AppShell({ user, children }: { user: CurrentUser; childr
<IconShieldLock size={16} />
Privacy
</NavLink>
<NavLink
to="/wall"
className="user-menu-item"
role="menuitem"
onClick={() => {
setMenuOpen(false);
setSidebarOpen(false);
}}
>
<IconDeviceDesktop size={16} />
Wall display
</NavLink>
<a className="user-menu-item" role="menuitem" href="/auth/logout">
<IconLogout size={16} />
Sign out
@@ -440,7 +354,7 @@ export default function AppShell({ user, children }: { user: CurrentUser; childr
</aside>
<div className="page-wrapper">
<div className="page-body">
<main className="page-body" id="main" tabIndex={-1} ref={mainRef}>
<div className="container-xl">
{maintenance.length > 0 && (
<div className="alert alert-warning d-flex align-items-center gap-2">
@@ -465,7 +379,7 @@ export default function AppShell({ user, children }: { user: CurrentUser; childr
)}
{children}
</div>
</div>
</main>
</div>
</div>
);
+147
View File
@@ -0,0 +1,147 @@
import type { ReactNode } from "react";
import {
IconLayoutDashboard,
IconServer2,
IconWorld,
IconNetwork,
IconKey,
IconPlugConnected,
IconBrandDocker,
IconAffiliate,
IconPlayerPlay,
IconBrandGit,
IconServerCog,
IconDatabase,
IconUsers,
IconDevices,
IconHistory,
IconStethoscope,
IconSettings,
IconWand,
IconTool,
IconWorldWww,
IconListCheck,
IconRefresh,
IconActivityHeartbeat,
IconShieldCheck,
IconTicket,
IconPlug,
IconExternalLink,
IconAlertTriangle,
IconSitemap,
} from "@tabler/icons-react";
import type { CurrentUser } from "../api/client";
// The menu: what pages there are, how they are grouped, and which role is needed to see each. Used by the sidebar, the command
// palette, the keyboard shortcuts and the breadcrumbs, so they always agree.
type Role = "operator" | "admin";
export interface NavLeaf {
to: string;
label: string;
/** Shown for top-level links, and when a group is left with a single visible page and so is drawn as that page's own link. */
icon: ReactNode;
minRole?: Role;
}
export interface NavGroup {
id: string;
label: string;
icon: ReactNode;
items: NavLeaf[];
}
export type NavEntry = NavLeaf | NavGroup;
export const isGroup = (entry: NavEntry): entry is NavGroup => "items" in entry;
export const NAV: NavEntry[] = [
{ to: "/", label: "Dashboard", icon: <IconLayoutDashboard size={20} /> },
{
id: "infrastructure",
label: "Infrastructure",
icon: <IconServer2 size={20} />,
items: [
{ to: "/servers", label: "Servers", icon: <IconServer2 size={20} /> },
{ to: "/proxmox", label: "Proxmox", icon: <IconServerCog size={20} /> },
{ to: "/synology", label: "Synology", icon: <IconDatabase size={20} /> },
{ to: "/pbs", label: "Proxmox Backup", icon: <IconShieldCheck size={20} /> },
{ to: "/docker", label: "Docker", icon: <IconBrandDocker size={20} /> },
{ to: "/tailscale", label: "Tailscale", icon: <IconAffiliate size={20} /> },
{ to: "/map", label: "Map", icon: <IconSitemap size={20} /> },
],
},
{
id: "network",
label: "Network",
icon: <IconWorld size={20} />,
items: [
{ to: "/dns", label: "DNS", icon: <IconWorld size={20} /> },
{ to: "/domains", label: "Domains", icon: <IconWorldWww size={20} /> },
{ to: "/ipam", label: "IP Addresses", icon: <IconNetwork size={20} /> },
{ to: "/ports", label: "Ports", icon: <IconPlug size={20} /> },
{ to: "/consistency", label: "Consistency", icon: <IconListCheck size={20} /> },
],
},
{
id: "automation",
label: "Automation",
icon: <IconRefresh size={20} />,
items: [
{ to: "/semaphore", label: "Semaphore", icon: <IconPlayerPlay size={20} /> },
{ to: "/gitea", label: "Gitea", icon: <IconBrandGit size={20} /> },
],
},
{ to: "/secrets", label: "Secrets", icon: <IconKey size={20} /> },
{
id: "operations",
label: "Operations",
icon: <IconTool size={20} />,
items: [
{ to: "/alerts", label: "Alerts", icon: <IconAlertTriangle size={20} /> },
{ to: "/maintenance", label: "Maintenance", icon: <IconTool size={20} /> },
{ to: "/uptime-kuma", label: "Uptime Kuma", icon: <IconActivityHeartbeat size={20} /> },
{ to: "/osticket", label: "osTicket", icon: <IconTicket size={20} /> },
{ to: "/admin-links", label: "Admin Links", icon: <IconExternalLink size={20} /> },
{ to: "/generator", label: "Generator", icon: <IconWand size={20} /> },
],
},
{
id: "administration",
label: "Administration",
icon: <IconSettings size={20} />,
items: [
{ to: "/integrations", label: "Integrations", icon: <IconPlugConnected size={20} /> },
{ to: "/users", label: "Users", icon: <IconUsers size={20} />, minRole: "admin" },
{ to: "/sessions", label: "Sessions", icon: <IconDevices size={20} />, minRole: "admin" },
{ to: "/audit-log", label: "Audit Log", icon: <IconHistory size={20} />, minRole: "operator" },
{ to: "/diag-log", label: "Diagnostic Log", icon: <IconStethoscope size={20} />, minRole: "admin" },
{ to: "/settings", label: "Settings", icon: <IconSettings size={20} />, minRole: "admin" },
],
},
];
const roleRank: Record<CurrentUser["role"], number> = { viewer: 0, operator: 1, admin: 2 };
/** What this role can see: pages it isn't allowed are dropped, an emptied group disappears, and a group down to one page becomes that page's own link. */
export function visibleNav(role: CurrentUser["role"]): NavEntry[] {
const allowed = (leaf: NavLeaf) => !leaf.minRole || roleRank[role] >= roleRank[leaf.minRole];
const out: NavEntry[] = [];
for (const entry of NAV) {
if (!isGroup(entry)) {
if (allowed(entry)) out.push(entry);
continue;
}
const items = entry.items.filter(allowed);
if (items.length === 1) out.push(items[0]);
else if (items.length > 1) out.push({ ...entry, items });
}
return out;
}
/** Is this the current page (or a page beneath it, like /servers/3 under /servers)? */
export function isCurrent(pathname: string, to: string): boolean {
return to === "/" ? pathname === "/" : pathname === to || pathname.startsWith(`${to}/`);
}
+35
View File
@@ -0,0 +1,35 @@
// The keyboard shortcuts: "g" then a letter goes to a page (like GitHub's), "/" jumps to the search box, "?" lists them all.
// One list, so the handler, the help dialog and the command palette's hints can't drift apart.
export interface GoShortcut {
/** The letter after "g". */
key: string;
to: string;
label: string;
}
export const GO_SHORTCUTS: GoShortcut[] = [
{ key: "d", to: "/", label: "Dashboard" },
{ key: "a", to: "/alerts", label: "Alerts" },
{ key: "s", to: "/servers", label: "Servers" },
{ key: "m", to: "/maintenance", label: "Maintenance" },
{ key: "i", to: "/integrations", label: "Integrations" },
{ key: "k", to: "/secrets", label: "Secrets" },
{ key: "p", to: "/map", label: "Map" },
{ key: "w", to: "/wall", label: "Wall display" },
];
export const OTHER_SHORTCUTS: { keys: string; label: string }[] = [
{ keys: "Ctrl K", label: "Search, and run actions (silence a server, switch theme…)" },
{ keys: "/", label: "Jump to the search box of the table on this page" },
{ keys: "?", label: "Show this list" },
{ keys: "Esc", label: "Close a dialog, the search or this list" },
];
/** The "g x" hint for a page, if it has one — shown beside it in the command palette. */
export function shortcutHintFor(to: string): string | null {
const found = GO_SHORTCUTS.find((s) => s.to === to);
return found ? `g ${found.key}` : null;
}
export const SHOW_SHORTCUTS_EVENT = "show-shortcuts";
+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>
);
}
+562
View File
@@ -291,6 +291,568 @@ html[data-env] .navbar-vertical {
}
}
/* ── Accessibility ── */
/* A link that appears when the keyboard first reaches the page, to jump past the menu. */
.skip-link {
position: absolute;
top: 0.5rem;
left: 0.5rem;
z-index: 3000;
padding: 0.5rem 0.9rem;
color: #fff;
font-weight: 600;
background: #1d4ed8;
border-radius: 0.3rem;
transform: translateY(-200%);
}
.skip-link:focus {
color: #fff;
transform: none;
}
/* The page's own start takes keyboard focus on navigation; it is not a control, so it needs no ring. */
main:focus {
outline: none;
}
/* A clear ring wherever the keyboard is, and only for the keyboard (a mouse click shows none). */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
outline: 2px solid var(--tblr-primary, #2563eb);
outline-offset: 2px;
}
/* On the coloured sidebar the blue ring would vanish, so use white there. */
.navbar-vertical :where(a, button, input, select):focus-visible {
outline-color: #fff;
}
/* A sortable column heading is a button that looks like the heading it sits in. */
.th-sort {
padding: 0;
font: inherit;
color: inherit;
letter-spacing: inherit;
text-align: inherit;
text-transform: inherit;
white-space: nowrap;
cursor: pointer;
user-select: none;
background: none;
border: 0;
}
@media (prefers-reduced-motion: reduce) {
*,
*::before,
*::after {
scroll-behavior: auto !important;
transition-duration: 0.01ms !important;
}
}
/* The keyboard-shortcut list: a key on the left, what it does on the right. */
.shortcut-list > div {
display: flex;
gap: 1rem;
padding: 0.2rem 0;
}
.shortcut-list dt {
flex: 0 0 8rem;
font-weight: 400;
}
.shortcut-list dd {
margin: 0;
}
/* ── A row that opens a detail panel, and the panel. ── */
.row-clickable {
cursor: pointer;
}
.row-clickable:hover > td {
background-color: color-mix(in srgb, currentColor 5%, transparent);
}
.detail-backdrop {
position: fixed;
inset: 0;
z-index: 1040;
background: rgba(0, 0, 0, 0.45);
}
.detail-drawer {
position: fixed;
top: 0;
right: 0;
bottom: 0;
z-index: 1045;
display: flex;
flex-direction: column;
width: min(30rem, 100vw);
color: var(--tblr-body-color);
background: var(--tblr-bg-surface, #fff);
border-left: 1px solid var(--tblr-border-color);
box-shadow: -8px 0 24px rgba(0, 0, 0, 0.35);
animation: drawer-in 0.18s ease-out;
}
.detail-drawer-header {
display: flex;
align-items: center;
gap: 0.75rem;
padding: 1rem 1.25rem;
border-bottom: 1px solid var(--tblr-border-color);
}
.detail-drawer-body {
flex: 1;
padding: 1rem 1.25rem;
overflow-y: auto;
}
.detail-list > div {
display: grid;
grid-template-columns: 9.5rem 1fr;
gap: 0.75rem;
padding: 0.4rem 0;
border-bottom: 1px solid var(--tblr-border-color);
}
.detail-list dt {
font-weight: 500;
color: var(--tblr-secondary);
}
.detail-list dd {
margin: 0;
overflow-wrap: anywhere;
}
.detail-list-nested > div {
grid-template-columns: 7rem 1fr;
border-bottom: 0;
padding: 0.15rem 0;
}
@keyframes drawer-in {
from {
transform: translateX(2rem);
opacity: 0;
}
}
@media (prefers-reduced-motion: reduce) {
.detail-drawer {
animation: none;
}
}
/* ── A server's activity: an icon, what happened, and when. ── */
.activity-list {
margin: 0;
padding: 0;
list-style: none;
}
.activity-list > li {
display: flex;
gap: 0.75rem;
align-items: flex-start;
padding: 0.5rem 0;
border-bottom: 1px solid var(--tblr-border-color);
}
.activity-list > li:last-child {
border-bottom: 0;
}
/* ── The wall display: a full-screen status board, big enough to read across a room. ── */
.wall {
display: flex;
flex-direction: column;
gap: clamp(1rem, 2.2vw, 2rem);
min-height: 100vh;
padding: clamp(1rem, 3vw, 3rem);
color: #e6edf7;
font-size: clamp(1rem, 1.6vw, 1.6rem);
background: #0b1220;
}
.wall-idle {
cursor: none;
}
.wall-header {
display: flex;
gap: 1rem;
align-items: center;
}
.wall-logo {
width: auto;
height: clamp(3.5rem, 8vw, 7rem);
object-fit: contain;
}
.wall-clock {
margin-left: auto;
text-align: right;
}
.wall-time {
font-size: clamp(2.5rem, 6vw, 6rem);
font-weight: 700;
line-height: 1;
}
.wall-date {
opacity: 0.7;
}
.wall-status {
display: flex;
gap: 1rem;
align-items: center;
padding: clamp(0.8rem, 2vw, 1.8rem) clamp(1rem, 2.5vw, 2.5rem);
font-size: clamp(1.6rem, 4.2vw, 4.2rem);
font-weight: 700;
border-radius: 0.8rem;
}
.wall-status-symbol {
display: inline-grid;
place-items: center;
width: 1.4em;
height: 1.4em;
font-size: 0.8em;
border: 0.12em solid currentColor;
border-radius: 50%;
}
.wall-status-ok {
color: #7ee2a0;
background: #12351f;
}
.wall-status-critical {
color: #ff9aa2;
background: #4a1519;
}
.wall-status-warning {
color: #ffd27a;
background: #4a3510;
}
.wall-status-unsure {
color: #c4d0e4;
background: #1f2a3d;
}
.wall-tiles {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
gap: clamp(0.75rem, 1.6vw, 1.5rem);
}
.wall-tile {
padding: clamp(0.8rem, 1.6vw, 1.6rem);
background: #121c2f;
border-radius: 0.8rem;
box-shadow: inset 0 0 0 2px transparent;
}
.wall-tile-figure {
font-size: clamp(2.5rem, 6vw, 5.5rem);
font-weight: 700;
line-height: 1.05;
}
.wall-tile-label {
opacity: 0.75;
}
.wall-tile-bad {
box-shadow: inset 0 0 0 3px #ff6b6b;
}
.wall-tile-warn {
box-shadow: inset 0 0 0 3px #ffc247;
}
.wall-tile-info {
box-shadow: inset 0 0 0 3px #4dabf7;
}
.wall-columns {
display: grid;
grid-template-columns: 3fr 2fr;
gap: clamp(1rem, 3vw, 3rem);
}
@media (max-width: 900px) {
.wall-columns {
grid-template-columns: 1fr;
}
}
.wall-heading {
margin: 0 0 0.5em;
font-size: 0.8em;
letter-spacing: 0.08em;
text-transform: uppercase;
opacity: 0.7;
}
.wall-list {
margin: 0;
padding: 0;
font-size: 1.25em;
list-style: none;
}
.wall-list li {
padding: 0.3em 0;
}
.wall-list-small {
font-size: 1em;
}
.wall-bad {
color: #ff9aa2;
}
.wall-warn {
color: #ffd27a;
}
.wall-good {
color: #7ee2a0;
}
.wall-dim,
.wall-more,
.wall-empty {
opacity: 0.65;
}
.wall-footer {
display: flex;
gap: 1rem;
justify-content: space-between;
margin-top: auto;
font-size: 0.8em;
opacity: 0.65;
}
.wall-link {
padding: 0 0.5rem;
color: inherit;
text-decoration: underline;
cursor: pointer;
background: none;
border: 0;
}
/* ── The map: boxes in columns with lines between them. ── */
.map-scroll {
overflow: auto;
}
.map-columns {
position: relative;
height: 1.6rem;
}
.map-column-title {
position: absolute;
font-size: 0.72rem;
font-weight: 600;
letter-spacing: 0.06em;
color: var(--tblr-secondary);
text-transform: uppercase;
}
.map-canvas {
position: relative;
}
.map-lines {
position: absolute;
inset: 0;
pointer-events: none;
}
.map-edge {
stroke: var(--tblr-secondary);
stroke-width: 1.6;
stroke-opacity: 0.55;
}
.map-edge.map-dim {
stroke-opacity: 0.1;
}
.map-node {
position: absolute;
display: flex;
gap: 0.55rem;
align-items: center;
padding: 0 0.7rem;
color: var(--tblr-body-color);
text-decoration: none;
background: var(--tblr-bg-surface-secondary, var(--tblr-bg-surface));
border: 1px solid var(--tblr-border-color);
border-left-width: 4px;
border-radius: 0.4rem;
transition: opacity 0.12s;
}
a.map-node:hover,
a.map-node:focus-visible {
color: var(--tblr-body-color);
border-color: var(--tblr-primary, #2563eb);
}
.map-node.map-dim {
opacity: 0.25;
}
.map-node-host {
border-left-color: #a78bfa;
}
.map-node-server {
border-left-color: #4299e1;
}
.map-node-dns {
border-left-color: #38b2ac;
}
.map-node-monitor {
border-left-color: #f6ad55;
}
.map-label {
display: flex;
flex-direction: column;
min-width: 0;
line-height: 1.2;
}
.map-title,
.map-sub {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.map-sub {
font-size: 0.75rem;
color: var(--tblr-secondary);
}
.map-status {
flex: 0 0 auto;
width: 1.3rem;
height: 1.3rem;
font-size: 0.75rem;
font-weight: 700;
line-height: 1.3rem;
text-align: center;
border-radius: 50%;
}
.map-status-ok {
color: #5fe07a;
background: rgba(47, 179, 68, 0.16);
}
.map-status-bad {
color: #ff9a9a;
background: rgba(214, 57, 57, 0.18);
}
.map-status-warn {
color: #ffc85a;
background: rgba(245, 165, 36, 0.18);
}
.map-status-unknown {
color: #b3bcc9;
background: rgba(128, 138, 150, 0.16);
}
/* On a light page the same symbols need darker colours to be read. */
[data-bs-theme="light"] .map-status-ok {
color: #17692b;
}
[data-bs-theme="light"] .map-status-bad {
color: #a82323;
}
[data-bs-theme="light"] .map-status-warn {
color: #7a4f00;
}
[data-bs-theme="light"] .map-status-unknown {
color: #566170;
}
@media (prefers-reduced-motion: reduce) {
.map-node {
transition: none;
}
}
/* ── Dark mode: reds and blues Tabler uses for text are a little dim on the dark background; these are brighter, for the text only
(the solid red and blue of badges and buttons is unchanged, since white text sits on those). ── */
[data-bs-theme="dark"] .text-red,
[data-bs-theme="dark"] .alert-danger,
[data-bs-theme="dark"] .alert-danger .alert-link {
color: #f5a0a0 !important;
}
[data-bs-theme="dark"] .btn-outline-danger {
--tblr-btn-color: #f5a0a0;
--tblr-btn-border-color: #f5a0a0;
--tblr-btn-hover-color: #fff;
--tblr-btn-hover-bg: #d63939;
--tblr-btn-hover-border-color: #d63939;
color: #f5a0a0;
}
[data-bs-theme="dark"] .btn-link {
--tblr-btn-color: #74bbff;
color: #74bbff;
}
[data-bs-theme="dark"] .input-group-text {
color: #a8b0bd;
}
/* ── Light mode: the same, the other way round — Tabler's red, amber and blue text are a little pale on a light background. ── */
[data-bs-theme="light"] .alert-danger,
[data-bs-theme="light"] .alert-danger .alert-link {
color: #a82323;
}
[data-bs-theme="light"] .alert-warning,
[data-bs-theme="light"] .alert-warning .alert-link {
color: #7a4f00;
}
[data-bs-theme="light"] .btn-link {
--tblr-btn-color: #0b5cad;
color: #0b5cad;
}
/* Sidebar submenus: a little tighter than Tabler's dropdown rows, so several open groups still fit on one screen. */
.navbar-vertical .dropdown-menu .dropdown-item {
padding-top: 0.3rem;