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:
1 parent
f7f5e1cd41
commit
57fd4f8c52
36 files changed
+2790
-210
No files matched your search
@@ -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>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user