feat: Mantine SPA (Cluster/Rooms/Users) + verified end-to-end
SPA (React 19 + Vite 6 + Mantine v9, dark/indigo, @fn_library-style): - AdminShell: AppShell nav (Cluster/Rooms/Users), operator endpoint badge - ClusterPage: per-node up/down + posture badges (enforce/acl/tls/cluster/store), 10s auto-refresh - RoomsPage: room table (E2E/cleartext, persist, signed, epoch, role), create modal, members drawer with kick(+rekey) and invite modal - UsersPage: allowlist table (handle/role/status/sign_pub), add modal, revoke with confirmation, degraded state when no store backend - api.ts: single repository layer hitting /api; gateway decides mock vs live Verified end-to-end against a local membershipd in BOTH postures: - auth-off: create room, list rooms, signed members GET, add/revoke user - enforce + TLS + nkey (production posture): TLS-pinned healthz, nkey NATS connect, signed control-plane requests verified by the server, 403 surfaced for a non-member room pnpm build green (tsc + vite); go build/vet green; dist embedded. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
// Small presentation helpers shared across pages.
|
||||
|
||||
// trunc shortens a long hex key to head…tail for dense tables, keeping enough
|
||||
// to recognize it while staying copy-friendly via the full value in a tooltip.
|
||||
export function trunc(s: string, head = 10, tail = 6): string {
|
||||
if (!s) return "";
|
||||
if (s.length <= head + tail + 1) return s;
|
||||
return `${s.slice(0, head)}…${s.slice(-tail)}`;
|
||||
}
|
||||
|
||||
// fmtTime renders an RFC3339 / ISO timestamp as a compact local datetime, or
|
||||
// returns the raw string when it is not parseable.
|
||||
export function fmtTime(s: string): string {
|
||||
if (!s) return "—";
|
||||
const d = new Date(s);
|
||||
if (Number.isNaN(d.getTime())) return s;
|
||||
return d.toLocaleString();
|
||||
}
|
||||
Reference in New Issue
Block a user