Add sidebar navigation and global command search

This commit is contained in:
2026-10-07 18:59:39 -04:00
parent 9999e80226
commit e4f37f6964
33 changed files with 660 additions and 151 deletions
+14 -2
View File
@@ -8,6 +8,7 @@ export interface ServerHealthPresentation {
state: ServerHealthState;
label: string;
reason: string;
shortReason: string;
actionLabel: string;
actionHref: string;
/** Last relevant evidence, not an inferred time when the state began. */
@@ -22,10 +23,21 @@ function observedAt(value: string | null | undefined, now: number): string | nul
/** Explain the available evidence without treating a missing report as a stopped game. */
export function serverHealth(server: FleetServer, now: number): ServerHealthPresentation {
const evidence = healthEvidence(server, now);
return { ...evidence, label: statusPresentation(evidence.state).label };
const error = decodeRconError(server.last_error);
const connectionReason = error ? {
'no-config': 'Connection not configured.', 'no-port': 'Connection port not configured.',
'send-error': 'Game connection failed.', timeout: 'No reply to the status check.',
'bad-reply': 'Unreadable game response.', 'no-players': 'Player count not reported.'
}[error.reason] : null;
const shortReason = evidence.state === 'host-offline' ? `${server.host?.name ?? 'Host'} unavailable; game may still run.`
: evidence.state === 'stopped' ? 'Container confirmed stopped.'
: evidence.state === 'not-responding' ? connectionReason ?? 'Game report out of date; players unknown.'
: evidence.state === 'unknown' ? connectionReason ?? (freshStatusTimestamp(server.last_seen_at, now) ? 'Game replied; container unverified.' : 'Game and container unverified.')
: evidence.reason;
return { ...evidence, shortReason, label: statusPresentation(evidence.state).label };
}
function healthEvidence(server: FleetServer, now: number): Omit<ServerHealthPresentation, 'label'> {
function healthEvidence(server: FleetServer, now: number): Omit<ServerHealthPresentation, 'label' | 'shortReason'> {
const href = `/servers/${encodeURIComponent(server.name)}`;
const diagnostics = `${href}?tab=diagnostics`;
const host = server.host;