Use database fleet registry and gate RCON polling on container readiness

This commit is contained in:
2026-09-17 17:28:38 -04:00
parent 3b1c9bf3d9
commit 885abbdffe
19 changed files with 208 additions and 41 deletions
+11 -8
View File
@@ -126,7 +126,7 @@
let effectiveRoster = $derived(live?.roster ?? server?.roster ?? null);
let effectiveHealth = $derived<Health>(live?.health ?? server?.health ?? 'offline');
let effectiveSeen = $derived(live?.lastSeenAt ?? server?.last_seen_at ?? null);
let effectiveErr = $derived(live?.lastError ?? server?.last_error ?? null);
let effectiveErr = $derived(live ? live.lastError : server?.last_error ?? null);
let effectiveEndpoint = $derived<RconEndpoint | null>(live?.endpoint ?? server?.endpoint ?? null);
let liveReason = $derived<RconFailure | null>(live?.reason ?? null);
let decoded = $derived(decodeRconError(effectiveErr));
@@ -139,12 +139,12 @@
let effectiveInactiveSince = $derived<string | null>(live?.inactiveSince ?? server?.inactive_since ?? null);
let effectiveGameStartedAt = $derived<string | null>(live?.gameStartedAt ?? server?.game_started_at ?? null);
let effectiveGameEndedAt = $derived<string | null>(live?.gameEndedAt ?? server?.game_ended_at ?? null);
let activeElapsed = $derived(effectiveActiveSince ? elapsedSince(effectiveActiveSince, $uiNow) : null);
let inactiveElapsed = $derived(effectiveInactiveSince ? elapsedSince(effectiveInactiveSince, $uiNow) : null);
let activeElapsed = $derived(effectiveHealth !== 'starting' && effectiveActiveSince ? elapsedSince(effectiveActiveSince, $uiNow) : null);
let inactiveElapsed = $derived(effectiveHealth !== 'starting' && effectiveInactiveSince ? elapsedSince(effectiveInactiveSince, $uiNow) : null);
let gameInProgress = $derived(!!effectiveGameStartedAt && !effectiveGameEndedAt && !!effectiveActiveSince);
let gameElapsed = $derived(gameInProgress ? elapsedSince(effectiveGameStartedAt, $uiNow) : null);
let gameElapsed = $derived(effectiveHealth !== 'starting' && gameInProgress ? elapsedSince(effectiveGameStartedAt, $uiNow) : null);
let hasDiagnosticIssue = $derived(effectiveHealth !== 'online');
let hasDiagnosticIssue = $derived(effectiveHealth !== 'online' && effectiveHealth !== 'starting');
// Auto-open the Diagnostics tab if there's a problem the operator should see.
$effect(() => {
@@ -237,13 +237,14 @@
<StatusPip health={effectiveHealth} size="md" />
<span class="health-label">
{effectiveHealth === 'online' ? 'Online' :
effectiveHealth === 'starting' ? 'Starting' :
effectiveHealth === 'stale' ? 'Stale' : 'Offline'}
</span>
</div>
<div class="metric-cell">
<Stat
label="Players"
value={effectivePlayers ?? 0}
value={effectiveHealth === 'starting' ? '—' : effectivePlayers ?? 0}
size="xl"
tone={(effectivePlayers ?? 0) > 0 ? 'online' : 'primary'}
tween
@@ -276,7 +277,7 @@
{/if}
</div>
<RoundTelemetry {name} />
{#if effectiveHealth !== 'starting'}<RoundTelemetry {name} />{/if}
</Card>
@@ -327,7 +328,9 @@
<Card padding="lg">
<div class="panel-head">
<h2>RCON diagnostic</h2>
{#if hasDiagnosticIssue}
{#if effectiveHealth === 'starting'}
<Badge variant="info" uppercase>Waiting for container</Badge>
{:else if hasDiagnosticIssue}
<Badge variant="warning" uppercase>Issue</Badge>
{:else}
<Badge variant="online" uppercase>Healthy</Badge>