Simplify instance details and clarify diagnostics
This commit is contained in:
@@ -1,19 +1,21 @@
|
||||
<script lang="ts">
|
||||
import { tick } from 'svelte';
|
||||
import { instanceActivity } from '$ui/server-activity.js';
|
||||
import { timeFormat } from '$ui/stores/time-zone.js';
|
||||
import { freshTelemetry } from '$lib/server-observation.js';
|
||||
import { freshStatusTimestamp } from '$lib/server-freshness.js';
|
||||
import { serverSection, serverSectionAnchor } from '$lib/server-sections.js';
|
||||
import { contextHref } from '$lib/navigation-context.js';
|
||||
import BackLink from '$ui/components/BackLink.svelte';
|
||||
let { data }: { data: import('./$types').PageData } = $props();
|
||||
import RuntimeVersion from '$ui/components/RuntimeVersion.svelte';
|
||||
import MatchHistory from '$ui/components/MatchHistory.svelte';
|
||||
import RoundTelemetry from '$ui/components/RoundTelemetry.svelte';
|
||||
import TelemetryDiagnostics from '$ui/components/TelemetryDiagnostics.svelte';
|
||||
import { pollVisible } from '$ui/poll.js';
|
||||
import { fetchCampaigns } from '$ui/campaigns.js';
|
||||
import { createFleetStore } from '$ui/stores/fleet.js';
|
||||
import { freshServer, fleetIdentity } from '$lib/fleet-overview.js';
|
||||
import { serverTitle } from '$ui/server-labels.js';
|
||||
import ServerIdentity from '$ui/components/ServerIdentity.svelte';
|
||||
import CopyValue from '$ui/components/CopyValue.svelte';
|
||||
import ConfigInspector from '$ui/components/ConfigInspector.svelte';
|
||||
import StatusBadge from '$ui/components/primitives/StatusBadge.svelte';
|
||||
@@ -31,17 +33,14 @@
|
||||
import PlayerScoreboard from '$ui/components/PlayerScoreboard.svelte';
|
||||
import LogPanel from '$ui/components/LogPanel.svelte';
|
||||
import ChatPanel from '$ui/components/ChatPanel.svelte';
|
||||
import { gametypeLabel } from '$ui/gametype.js';
|
||||
import { decodeRconError, rconFixHint } from '$ui/rconError.js';
|
||||
|
||||
import Card from '$ui/components/primitives/Card.svelte';
|
||||
import Badge from '$ui/components/primitives/Badge.svelte';
|
||||
import Button from '$ui/components/primitives/Button.svelte';
|
||||
import Stat from '$ui/components/primitives/Stat.svelte';
|
||||
import Tabs from '$ui/components/primitives/Tabs.svelte';
|
||||
import StatusPip from '$ui/components/primitives/StatusPip.svelte';
|
||||
import SectionHeader from '$ui/components/primitives/SectionHeader.svelte';
|
||||
import Breadcrumbs from '$ui/components/primitives/Breadcrumbs.svelte';
|
||||
import EmptyState from '$ui/components/primitives/EmptyState.svelte';
|
||||
|
||||
interface RconProbeResult {
|
||||
@@ -75,6 +74,7 @@
|
||||
}
|
||||
interface InventoryEntry {
|
||||
relPath: string; kind?: string; scriptVersionId: number | null;
|
||||
artifactId?: number | null; version?: number | null; releaseVersion?: string | null;
|
||||
sha256: string; size: number; updatedAt: string; source: string | null;
|
||||
}
|
||||
interface DeploymentRow {
|
||||
@@ -93,6 +93,7 @@
|
||||
const visibleFleet = $derived($fleet.receivedAt ? $fleetServers : data.serverSnapshot.servers);
|
||||
let server = $derived((visibleFleet.find(s => s.name === name) as Server | undefined) ?? null);
|
||||
const native = $derived(!!server?.native_instance_id);
|
||||
let telemetryOpen = $state(false);
|
||||
let history = $state<DeploymentRow[]>([]);
|
||||
let inventory = $state<InventoryEntry[]>([]);
|
||||
let rconProbe = $state<RconProbeResult | null>(null);
|
||||
@@ -123,6 +124,8 @@
|
||||
let inventoryLimit = $state(25);
|
||||
const operations = $derived(snapshot.operations.filter(op => op.server === name));
|
||||
|
||||
const activity = $derived(instanceActivity(name, operations, history));
|
||||
|
||||
let tabSequence = 0;
|
||||
async function loadTab(currentName: string, tab: string, signal?: AbortSignal) {
|
||||
if (tab !== 'history' && tab !== 'configuration') return;
|
||||
@@ -157,8 +160,6 @@
|
||||
const fresh = $derived(server ? freshServer(server, $uiNow) : false);
|
||||
|
||||
let effectivePlayers = $derived(fresh ? server?.last_players ?? null : null);
|
||||
let effectiveMap = $derived(server?.last_map ?? null);
|
||||
let effectiveGametype = $derived(server?.last_gametype ?? null);
|
||||
const scoreboard = $derived(server?.telemetry ?? $telemetryByServer.get(name));
|
||||
let effectiveHealth = $derived<Health>(server?.health === 'online' && !fresh ? 'stale' : server?.health ?? 'offline');
|
||||
let effectiveSeen = $derived(server?.last_seen_at ?? null);
|
||||
@@ -191,20 +192,19 @@
|
||||
if (d < 86_400_000) return `${Math.floor(d / 3_600_000)}h ago`;
|
||||
return `${Math.floor(d / 86_400_000)}d ago`;
|
||||
}
|
||||
function endpointLabel(ep: RconEndpoint | null): string {
|
||||
if (!ep) return 'unresolved';
|
||||
return `${ep.host}:${ep.port}`;
|
||||
}
|
||||
|
||||
async function probeRcon(): Promise<void> {
|
||||
if (probingRcon || !name) return;
|
||||
const currentName = name;
|
||||
probingRcon = true; rconProbe = null;
|
||||
try {
|
||||
const res = await fetch(`/api/servers/${encodeURIComponent(name)}/probe-rcon`, { method: 'POST' });
|
||||
rconProbe = (await res.json()) as RconProbeResult;
|
||||
const res = await fetch(`/api/servers/${encodeURIComponent(currentName)}/probe-rcon`, { method: 'POST' });
|
||||
const body = await res.json().catch(() => null);
|
||||
if (!body || typeof body.ok !== 'boolean') throw new Error(`HTTP ${res.status}: Expected a JSON connection result.`);
|
||||
if (name !== currentName) return;
|
||||
rconProbe = body as RconProbeResult;
|
||||
await refreshFleet();
|
||||
} catch (err) {
|
||||
rconProbe = { ok: false, reason: 'send-error', detail: (err as Error).message };
|
||||
if (name === currentName) rconProbe = { ok: false, reason: 'send-error', detail: (err as Error).message };
|
||||
} finally { probingRcon = false; }
|
||||
}
|
||||
// Tab config — Diagnostics gets a warning badge when there's an issue.
|
||||
@@ -212,7 +212,7 @@
|
||||
{ id: 'live', label: 'Live' },
|
||||
{ id: 'matches', label: 'Matches' },
|
||||
{ id: 'configuration', label: 'Configuration' },
|
||||
{ id: 'diagnostics', label: 'Diagnostics', badge: hasDiagnosticIssue ? '!' : null },
|
||||
{ id: 'diagnostics', label: 'Diagnostics', badge: hasDiagnosticIssue || effectiveErr ? '!' : null },
|
||||
{ id: 'history', label: 'History' }
|
||||
]);
|
||||
</script>
|
||||
@@ -223,73 +223,19 @@
|
||||
|
||||
{#if server}
|
||||
<div class="server-page" style="view-transition-name: server-{name.replace(/[^a-z0-9_-]/gi, '-')};">
|
||||
<!-- Hero: name + status + player count + primary actions -->
|
||||
<Card padding="lg" elevation="flat">
|
||||
<header class="instance-header">
|
||||
<BackLink fallback="/" />
|
||||
<SectionHeader title={serverTitle(server.name)}>
|
||||
{#snippet crumbs()}
|
||||
<Breadcrumbs items={[{ label: 'Fleet', href: '/' }, { label: serverTitle(name) }]} />
|
||||
{/snippet}
|
||||
{#snippet actions()}
|
||||
<details class="server-actions"><summary>Server actions</summary>{#each runtimeActions as action}<Button onclick={() => { lifecycleAction = action; lifecycleOpen = true; }}>{actionLabels[action]}</Button>{/each}<Button variant="danger" onclick={() => destroyOpen = true}>Queue server removal</Button></details>
|
||||
<details class="server-actions"><summary>Instance actions</summary><div class="action-menu">{#each runtimeActions as action}<Button onclick={() => { lifecycleAction = action; lifecycleOpen = true; }}>{actionLabels[action]}</Button>{/each}<Button variant="danger" onclick={() => destroyOpen = true}>Queue instance removal</Button></div></details>
|
||||
{/snippet}
|
||||
</SectionHeader>
|
||||
<BackLink fallback="/" />
|
||||
|
||||
<CopyValue value={name} label="Server ID" />
|
||||
<RuntimeVersion {name} version={server.plutonium} after={server.telemetry_after} ready={effectiveHealth === 'online'} />
|
||||
<div class="metrics">
|
||||
<div class="metric-cell name-cell">
|
||||
<StatusPip health={effectiveHealth} size="md" />
|
||||
<span class="health-label">
|
||||
{effectiveHealth === 'online' ? 'Online' :
|
||||
effectiveHealth === 'starting' ? 'Starting' :
|
||||
effectiveHealth === 'provisioning' ? 'Provisioning' :
|
||||
effectiveHealth === 'stale' ? 'Stale' : 'Offline'}
|
||||
</span>
|
||||
</div>
|
||||
<div class="metric-cell">
|
||||
<Stat
|
||||
label="Players"
|
||||
value={effectiveHealth === 'starting' ? '—' : effectivePlayers ?? '—'}
|
||||
size="md"
|
||||
tone={(effectivePlayers ?? 0) > 0 ? 'online' : 'primary'}
|
||||
tween
|
||||
/>
|
||||
</div>
|
||||
<div class="metric-cell">
|
||||
<Stat label="Map" value={fleetIdentity(server).map} size="md" tween={false} />
|
||||
{#if gametypeLabel(effectiveGametype)}
|
||||
<div class="sub">{gametypeLabel(effectiveGametype)}</div>
|
||||
{/if}
|
||||
</div>
|
||||
{#if resetElapsed}
|
||||
<div class="metric-cell">
|
||||
<Stat label="Resetting" value={resetElapsed} size="md" tween={false} />
|
||||
</div>
|
||||
{:else if activeElapsed}
|
||||
<div class="metric-cell">
|
||||
<Stat label="Active for" value={activeElapsed} size="md" tween={false} />
|
||||
</div>
|
||||
{:else if inactiveElapsed}
|
||||
<div class="metric-cell">
|
||||
<Stat label="Inactive for" value={inactiveElapsed} size="md" tween={false} />
|
||||
</div>
|
||||
{/if}
|
||||
{#if gameElapsed}
|
||||
<div class="metric-cell">
|
||||
<Stat label="Match" value={gameElapsed} size="md" tween={false} tone="accent" />
|
||||
</div>
|
||||
{/if}
|
||||
{#if effectiveHealth !== 'online'}
|
||||
<div class="metric-cell">
|
||||
<Stat label="Last seen" value={ago(effectiveSeen, $uiNow)} size="md" tween={false} />
|
||||
</div>
|
||||
{/if}
|
||||
<div class="instance-meta">
|
||||
<span class="health"><StatusPip health={effectiveHealth} size="md" />{effectiveHealth === 'online' ? 'Online' : effectiveHealth === 'starting' ? 'Starting' : effectiveHealth === 'provisioning' ? 'Provisioning' : effectiveHealth === 'stale' ? 'Stale' : 'Offline'}</span>
|
||||
{#if server.host_id}<a href={contextHref(`/hosts/${server.host_id}`, $page.url)}>{server.host?.name ?? server.host_id}</a>{/if}
|
||||
<details><summary>Details</summary><div class="instance-details"><CopyValue value={name} label="Instance ID" /><RuntimeVersion {name} version={server.plutonium} after={server.telemetry_after} ready={effectiveHealth === 'online'} /></div></details>
|
||||
</div>
|
||||
|
||||
{#if effectiveHealth === 'online'}<RoundTelemetry {name} report={scoreboard} since={server?.telemetry_after ?? null} />{/if}
|
||||
|
||||
</Card>
|
||||
</header>
|
||||
|
||||
{#if $fleetError}<div class="ui-error" role="alert">{$fleetError}<Button size="sm" onclick={() => refreshFleet(true)}>Retry</Button></div>{/if}
|
||||
{#if hasDiagnosticIssue}
|
||||
@@ -305,19 +251,18 @@
|
||||
<div class="tab-panel" class:diagnostics={activeSection === 'diagnostics'} class:history-panel={activeSection === 'history'} role="tabpanel" id="server-panel" aria-labelledby={"server-tabs-" + activeSection}>
|
||||
{#if tabError}<div class="ui-error" role="alert">{tabError}<Button size="sm" onclick={() => loadTab(name, activeSection)}>Retry</Button></div>{/if}
|
||||
{#if activeSection === 'live'}
|
||||
<nav class="section-links" aria-label="Live sections"><a href="#scoreboard">Scoreboard</a><a href="#chat">Chat</a></nav>
|
||||
<section id="scoreboard" aria-label="Scoreboard">
|
||||
{#if !scoreboard || !fresh || !freshTelemetry(scoreboard, $uiNow, server.telemetry_after)}<p class="live-context">Players: {effectivePlayers ?? '—'} · {fleetIdentity(server).map}{#if !fresh} · Current count unavailable{/if}</p>{/if}
|
||||
<Card padding="lg">
|
||||
{#key name}<PlayerScoreboard current={fresh} after={server?.telemetry_after ?? null} report={scoreboard} mapLabel={scoreboard ? fleetIdentity({ ...server, last_map: scoreboard.map }).map : undefined} />{/key}
|
||||
{#key name}<PlayerScoreboard matchElapsed={gameElapsed} activity={resetElapsed ? `Resetting · ${resetElapsed}` : activeElapsed ? `Players present for ${activeElapsed}` : inactiveElapsed ? `Empty for ${inactiveElapsed}` : undefined} current={fresh} after={server?.telemetry_after ?? null} report={scoreboard} mapLabel={scoreboard ? fleetIdentity({ ...server, last_map: scoreboard.map }).map : undefined} />{/key}
|
||||
</Card>
|
||||
</section>
|
||||
<section id="chat" aria-label="Chat">
|
||||
<Card padding="lg">
|
||||
<Card>
|
||||
{#key name}<ChatPanel server={name} />{/key}
|
||||
</Card>
|
||||
</section>
|
||||
{:else if activeSection === 'configuration'}
|
||||
<nav class="section-links" aria-label="Configuration sections"><a href="#config">Config</a><a href="#inventory">Inventory</a></nav>
|
||||
<section id="config" aria-label="Config">
|
||||
{#key name}<ConfigInspector fixedServer={name} />{/key}
|
||||
</section>
|
||||
@@ -327,48 +272,33 @@
|
||||
<h2>Installed files</h2>
|
||||
<span class="panel-count">{inventory.length}</span>
|
||||
</div>
|
||||
{#if tabLoading}<EmptyState title="Loading inventory…" />{:else if inventory.length === 0}
|
||||
{#if tabLoading}<EmptyState title="Loading inventory…" />{:else if inventory.length === 0 && !tabError}
|
||||
<EmptyState
|
||||
title="No files tracked yet"
|
||||
description="Files appear here after scripts, configs, or plugins are deployed to this server."
|
||||
/>
|
||||
{:else}
|
||||
<div class="inv-list">
|
||||
{#each inventory.slice(0,inventoryLimit) as f (f.relPath)}
|
||||
<div class="inv-row">
|
||||
<span class="rel">{f.relPath}<span class="file-kind">{f.kind ?? (f.relPath.endsWith(".dll") ? "Plugin" : f.relPath.endsWith(".cfg") ? "Config" : "Script")}</span></span>
|
||||
<span class="size">{f.size} B</span>
|
||||
<span class="src">{f.source ?? '—'}</span>
|
||||
<span class="sha">{f.sha256.slice(0, 12)}</span>
|
||||
</div>
|
||||
<div class="table-scroll"><table class="detail-table"><thead><tr><th>File</th><th>Type</th><th>Recorded version</th><th>Details</th></tr></thead><tbody>
|
||||
{#each inventory.slice(0, inventoryLimit) as f}
|
||||
<tr><td>{#if f.artifactId}<a href={contextHref(`/${f.kind === 'plugin' ? 'plugins' : f.kind === 'config' || f.kind === 'baseline' ? 'configs' : 'scripts'}/${f.artifactId}`, $page.url)}>{f.relPath}</a>{:else}{f.relPath}{/if}</td><td>{f.kind ?? 'file'}</td><td>{f.releaseVersion ?? (f.version ? `v${f.version}` : '—')}</td><td><details><summary><span class="sr-only">{f.relPath} </span>Details</summary><dl class="file-details"><dt>Size</dt><dd>{new Intl.NumberFormat().format(f.size)} B</dd><dt>SHA-256</dt><dd><code>{f.sha256}</code></dd><dt>Recorded</dt><dd>{$timeFormat.dateTime(f.updatedAt)}</dd><dt>Source</dt><dd>{#if f.source?.startsWith('promote:') || f.source?.startsWith('rollback:')}<a href={contextHref(`/campaigns/${f.source.slice(f.source.indexOf(':') + 1)}`, $page.url)}>View campaign</a>{:else}{f.source === 'native-create' ? 'Instance creation' : f.source ?? 'Unknown'}{/if}</dd></dl></details></td></tr>
|
||||
{/each}
|
||||
</div>
|
||||
</tbody></table></div>
|
||||
{/if}
|
||||
</Card>
|
||||
<ListFooter total={inventory.length} bind:limit={inventoryLimit} label="files" />
|
||||
</section>
|
||||
{:else if activeSection === 'diagnostics'}
|
||||
<nav class="section-links" aria-label="Diagnostic sections"><a href="#connection">Connection health</a><a href="#logs">Logs</a></nav>
|
||||
<section id="connection" aria-label="Connection health">
|
||||
<Card padding="lg">
|
||||
<div class="panel-head">
|
||||
<h2>RCON diagnostic</h2>
|
||||
{#if effectiveHealth === 'provisioning'}
|
||||
<Badge variant="info" uppercase>Provisioning</Badge>
|
||||
{:else 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>
|
||||
{/if}
|
||||
<h2>Connection health</h2>
|
||||
</div>
|
||||
|
||||
<p class="sub">Current player count: {server.status_source === 'telemetry' ? 'game telemetry' : server.status_source === 'rcon' ? 'RCON' : 'unavailable'}. RCON probes below show that connection's separate results.</p>
|
||||
{#if native}
|
||||
<div class="diag-grid"><div class="kv"><span class="k">Game connection</span><span class="v">RCON runs locally through the host agent</span></div><div class="kv"><span class="k">Host agent</span><span class="v {server.host?.connected ? 'ok' : 'bad'}">{server.host?.connectionState ?? 'unknown'}</span></div><div class="kv"><span class="k">Last heartbeat</span><span class="v">{server.host?.lastHeartbeat ? ago(server.host.lastHeartbeat, $uiNow) : 'Not received'}</span></div></div>
|
||||
{/if}
|
||||
|
||||
<div class="connection-status">
|
||||
{#if native}<div><strong>Host agent</strong><span>{server.host?.connected && freshStatusTimestamp(server.host.lastHeartbeat, $uiNow) ? 'Online' : 'Unavailable'}</span><small>{server.host?.lastHeartbeat ? `Last heartbeat ${ago(server.host.lastHeartbeat, $uiNow)}` : 'No heartbeat received'}</small>{#if server.host_id}<a href={contextHref(`/hosts/${server.host_id}`, $page.url)}>Inspect host</a>{/if}</div>{/if}
|
||||
<div><strong>Game connection · RCON</strong><span>{effectiveReason ? 'Issue' : server.rcon_status?.last_seen_at && freshStatusTimestamp(server.rcon_status.last_seen_at, $uiNow) ? 'Responding' : 'No fresh response'}</span><small>{server.rcon_status?.last_seen_at ? `Last response ${ago(server.rcon_status.last_seen_at, $uiNow)}` : 'No response received'}</small>{#if effectiveEndpoint || native}<Button size="sm" variant="ghost" onclick={probeRcon} disabled={probingRcon} loading={probingRcon}>Test connection</Button>{/if}</div>
|
||||
<div><strong>Game telemetry</strong><span>{fresh && freshTelemetry(scoreboard, $uiNow, server.telemetry_after) ? 'Reporting' : scoreboard ? 'Last report outdated' : 'No report'}</span><small>{scoreboard ? `Last report ${ago(scoreboard.receivedAt, $uiNow)}` : 'Waiting for game data'}</small><button class="text-button" onclick={() => telemetryOpen = !telemetryOpen} aria-expanded={telemetryOpen}>Inspect requests</button></div>
|
||||
</div>
|
||||
<p class="sub">Player count source: {fresh ? server.status_source === 'telemetry' ? 'game telemetry' : server.status_source === 'rcon' ? 'RCON' : 'unavailable' : 'unavailable'}.</p>
|
||||
{#if effectiveReason}
|
||||
<div class="alert alert-danger">
|
||||
<Badge variant="danger" uppercase>{effectiveReason}</Badge>
|
||||
@@ -389,15 +319,6 @@
|
||||
</details>
|
||||
{/if}
|
||||
|
||||
<div class="probe-actions">
|
||||
{#if effectiveEndpoint || native}
|
||||
<Button variant="secondary" size="sm" onclick={probeRcon} disabled={probingRcon} loading={probingRcon}>
|
||||
{native ? 'Probe RCON through agent' : 'Probe RCON'}
|
||||
</Button>
|
||||
{/if}
|
||||
{#if server.host_id}<Button variant="secondary" size="sm" href={contextHref(`/hosts/${server.host_id}`, $page.url)}>Inspect host</Button>{/if}
|
||||
</div>
|
||||
|
||||
{#if rconProbe?.ok}
|
||||
<div class="alert alert-ok">
|
||||
<Badge variant="online" uppercase>Connected</Badge>
|
||||
@@ -409,9 +330,8 @@
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<div class="panel-head divider">
|
||||
<h2>Configuration</h2>
|
||||
</div>
|
||||
{#if rconProbe && !rconProbe.ok}<div class="ui-error" role="alert">Connection test failed. <details><summary>Technical details</summary>{rconProbe.detail ?? rconProbe.reason}</details></div>{/if}
|
||||
<details class="connection-details"><summary>Connection details</summary>
|
||||
<div class="diag-grid">
|
||||
{#if native}<div class="kv"><span class="k">Host</span><span class="v"><a href={contextHref(`/hosts/${server.host_id}`, $page.url)}>{server.host?.name ?? server.host_id}</a></span></div><div class="kv"><span class="k">Instance</span><span class="v mono">{server.native_instance_id}</span></div><div class="kv"><span class="k">Generation</span><span class="v mono">{server.instance_generation}</span></div><div class="kv"><span class="k">Game-file version</span><span class="v mono"><a href="/game-files">{server.game_library_id}</a></span></div>{#if server.network}<div class="kv"><span class="k">Local UDP binding</span><span class="v mono">{server.network.bindAddress}:{server.network.localPort}</span></div><div class="kv"><span class="k">Public / NAT endpoint</span><span class="v mono">{server.network.publicAddress || server.host?.publicAddress || server.host?.hostname || 'Not configured'}:{server.network.publicPort ?? server.network.localPort}</span></div>{/if}
|
||||
{/if}
|
||||
@@ -422,8 +342,9 @@
|
||||
<div class="kv"><span class="k">Held by beta</span><span class="v mono">{server.held.map((h) => `${h.target} (beta ${h.betaId})`).join(', ')}</span></div>
|
||||
{/if}
|
||||
</div>
|
||||
</details>
|
||||
</Card>
|
||||
<div id="telemetry">{#key name}<TelemetryDiagnostics server={name} />{/key}</div>
|
||||
<details class="telemetry-inspector" bind:open={telemetryOpen}><summary>Telemetry requests</summary>{#if telemetryOpen}<div id="telemetry">{#key name}<TelemetryDiagnostics server={name} />{/key}</div>{/if}</details>
|
||||
</section>
|
||||
<section id="logs" aria-label="Logs">
|
||||
<Card padding="lg">
|
||||
@@ -439,53 +360,13 @@
|
||||
{:else if activeSection === 'matches'}
|
||||
{#key name}<MatchHistory server={name} />{/key}
|
||||
{:else if activeSection === 'history'}
|
||||
<div class="history-links"><Button href={contextHref(`/provisioning?view=history&server=${encodeURIComponent(name)}`, $page.url)}>Provisioning history</Button><Button href={contextHref(`/hosts/operations?server=${encodeURIComponent(name)}`, $page.url)}>Host operation history</Button></div>
|
||||
{#if operations.length}
|
||||
<Card padding="lg">
|
||||
<div class="panel-head">
|
||||
<h2>Operations</h2>
|
||||
<span class="panel-count">{operations.length}</span>
|
||||
</div>
|
||||
<div class="server-operations">
|
||||
{#each operations as operation (operation.key)}
|
||||
<a href={contextHref(operation.href, $page.url)}>
|
||||
<strong>{operation.label}</strong>
|
||||
<span>{operation.detail}</span>
|
||||
<StatusBadge state={operation.state} />
|
||||
</a>
|
||||
{/each}
|
||||
</div>
|
||||
</Card>
|
||||
{/if}
|
||||
<Card padding="lg">
|
||||
<div class="panel-head">
|
||||
<h2>Campaign history</h2>
|
||||
<span class="panel-count">{history.length}</span>
|
||||
</div>
|
||||
{#if tabLoading}<EmptyState title="Loading history…" />{:else if history.length === 0}
|
||||
<EmptyState
|
||||
title="No campaigns yet"
|
||||
description="Nothing has been pushed to this server. Open a beta or push scripts to see history here."
|
||||
/>
|
||||
{:else}
|
||||
<div class="history">
|
||||
{#each history.slice(0,historyLimit) as d (d.id)}
|
||||
{@const mine = d.servers.find((s) => s.server === name)!}
|
||||
<a class="hist-row s-{mine.restart_state}" href={contextHref(`/campaigns/${d.id}`, $page.url)}>
|
||||
<span class="hist-action">{d.action}</span>
|
||||
<span class="hist-state">
|
||||
<StatusBadge state={mine.restart_state} />
|
||||
{#if mine.players !== null && mine.players > 0}
|
||||
<span class="hist-players">{mine.players}p</span>
|
||||
{/if}
|
||||
</span>
|
||||
<span class="hist-files">{mine.files_changed} file{mine.files_changed === 1 ? '' : 's'}</span>
|
||||
<span class="hist-when">{ago(d.started_at, $uiNow)}</span>
|
||||
{#if mine.error}<span class="hist-err">{mine.error}</span>{/if}
|
||||
</a>
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
<div class="history-links"><a href={contextHref(`/provisioning?view=history&server=${encodeURIComponent(name)}`, $page.url)}>Provisioning history</a><a href={contextHref(`/hosts/operations?server=${encodeURIComponent(name)}`, $page.url)}>Host operation history</a></div>
|
||||
<Card>
|
||||
<div class="panel-head"><h2>Activity</h2></div><p class="sub">Recent operations and campaign history</p>
|
||||
{#if tabLoading}<p class="sub">Loading campaign history…</p>{/if}
|
||||
{#if activity.length}<div class="table-scroll"><table class="detail-table"><thead><tr><th>Time</th><th>Activity</th><th>Result</th><th>Source</th></tr></thead><tbody>
|
||||
{#each activity as item (item.key)}<tr><td><time datetime={item.at} title={$timeFormat.dateTime(item.at)}>{ago(item.at, $uiNow)}</time></td><td>{item.label}{#if item.detail}<div class="ui-error">{item.detail}</div>{/if}</td><td><StatusBadge state={item.state} /></td><td><a href={contextHref(item.href, $page.url)}>{item.source}</a></td></tr>{/each}
|
||||
</tbody></table></div>{:else if !tabLoading && !tabError}<EmptyState title="No activity recorded" />{/if}
|
||||
</Card>
|
||||
<ListFooter total={historyTotal} bind:limit={historyLimit} onchange={() => loadTab(name, 'history')} label="campaigns" />
|
||||
{/if}
|
||||
@@ -500,7 +381,6 @@
|
||||
{/if}
|
||||
|
||||
<style>
|
||||
.section-links { display:flex; gap:20px; flex-wrap:wrap; font-size:var(--text-sm); }
|
||||
.tab-panel > section { display:grid; gap:16px; min-width:0; scroll-margin-top:80px; }
|
||||
.history-links { display:flex; flex-wrap:wrap; gap:12px; }
|
||||
.server-actions { text-align: right; }
|
||||
@@ -520,31 +400,6 @@
|
||||
color: var(--text-tertiary);
|
||||
}
|
||||
|
||||
/* Hero metric grid */
|
||||
.metrics {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
|
||||
gap: var(--space-6);
|
||||
padding-top: var(--space-4);
|
||||
border-top: 1px solid var(--border-subtle);
|
||||
margin-top: var(--space-2);
|
||||
}
|
||||
.metric-cell {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--space-1);
|
||||
min-width: 0;
|
||||
}
|
||||
.name-cell {
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
gap: var(--space-2);
|
||||
}
|
||||
.health-label {
|
||||
font-size: var(--text-sm);
|
||||
color: var(--text-secondary);
|
||||
font-weight: var(--weight-medium);
|
||||
}
|
||||
.sub {
|
||||
font-size: var(--text-xs);
|
||||
color: var(--text-tertiary);
|
||||
@@ -558,7 +413,7 @@
|
||||
}
|
||||
.tabs-row {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
/* Panel headers */
|
||||
@@ -569,11 +424,6 @@
|
||||
gap: var(--space-3);
|
||||
margin-bottom: var(--space-4);
|
||||
}
|
||||
.panel-head.divider {
|
||||
margin-top: var(--space-6);
|
||||
padding-top: var(--space-5);
|
||||
border-top: 1px solid var(--border-subtle);
|
||||
}
|
||||
.panel-head h2 {
|
||||
margin: 0;
|
||||
font-family: var(--font-body);
|
||||
@@ -618,8 +468,6 @@
|
||||
word-break: break-word;
|
||||
}
|
||||
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
|
||||
.ok { color: var(--state-online); }
|
||||
.bad { color: var(--state-danger); }
|
||||
|
||||
/* Inline alerts */
|
||||
.alert {
|
||||
@@ -650,12 +498,6 @@
|
||||
border-radius: var(--radius-md);
|
||||
}
|
||||
|
||||
.probe-actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--space-2);
|
||||
margin-top: var(--space-4);
|
||||
}
|
||||
|
||||
/* Snippet details */
|
||||
.snippet-details {
|
||||
@@ -685,61 +527,28 @@
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
/* Inventory */
|
||||
.inv-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--space-1);
|
||||
}
|
||||
.inv-row {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) 80px 140px 120px;
|
||||
gap: var(--space-3);
|
||||
padding: var(--space-2) var(--space-3);
|
||||
border-radius: var(--radius-md);
|
||||
border: 1px solid var(--border-subtle);
|
||||
font-size: var(--text-xs);
|
||||
font-family: var(--font-mono);
|
||||
align-items: center;
|
||||
}
|
||||
.inv-row:hover { background: var(--surface-raised); }
|
||||
.inv-row .rel { color: var(--text-primary); word-break: break-all; }
|
||||
.inv-row .size,
|
||||
.inv-row .src,
|
||||
.inv-row .sha { color: var(--text-tertiary); font-variant-numeric: tabular-nums; }
|
||||
|
||||
/* History rows */
|
||||
.history { display: flex; flex-direction: column; gap: var(--space-1); }
|
||||
.hist-row {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 220px) auto 110px 100px 1fr;
|
||||
gap: var(--space-3);
|
||||
align-items: center;
|
||||
padding: var(--space-3) var(--space-4);
|
||||
text-decoration: none;
|
||||
color: var(--text-secondary);
|
||||
border-radius: var(--radius-md);
|
||||
border: 1px solid var(--border-subtle);
|
||||
transition: background-color var(--dur-fast) var(--ease-standard);
|
||||
}
|
||||
.hist-row:hover { background: var(--surface-raised); }
|
||||
.hist-row:focus-visible { outline: none; box-shadow: var(--focus-ring); }
|
||||
.hist-action { color: var(--text-primary); font-weight: var(--weight-medium); font-size: var(--text-sm); }
|
||||
.hist-state { display: inline-flex; align-items: center; gap: var(--space-2); }
|
||||
.hist-players { color: var(--state-online); font-family: var(--font-mono); font-size: var(--text-xs); }
|
||||
.hist-files, .hist-when { font-size: var(--text-xs); color: var(--text-tertiary); font-family: var(--font-mono); }
|
||||
.hist-err { color: var(--state-danger); font-size: var(--text-xs); font-family: var(--font-mono); }
|
||||
|
||||
@media (max-width: 640px) {
|
||||
.metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
|
||||
.panel-head, .alert { flex-wrap: wrap; }
|
||||
.hist-row {
|
||||
grid-template-columns: 1fr;
|
||||
gap: var(--space-1);
|
||||
}
|
||||
}
|
||||
.server-operations { display:grid; gap:8px; }
|
||||
.server-operations a { display:flex; gap:12px; flex-wrap:wrap; align-items:center; text-decoration:none; color:var(--text-primary); padding:10px 0; }
|
||||
.server-operations a span { color:var(--text-secondary); font-size:13px; }
|
||||
.file-kind { display:block; color:var(--text-secondary); font:12px var(--font-body); margin-top:5px; }
|
||||
.live-context { margin: 0; font-size: var(--text-sm); color: var(--text-secondary); }
|
||||
.instance-header { display: grid; gap: 12px; }
|
||||
.instance-meta, .health { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; font-size: var(--text-sm); }
|
||||
.health { gap: 8px; }
|
||||
.instance-details { display: grid; gap: 8px; padding: 12px 0; }
|
||||
details > summary { cursor: pointer; color: var(--text-secondary); font-size: var(--text-sm); }
|
||||
.server-actions { position: relative; }
|
||||
.action-menu { position: absolute; z-index: 5; right: 0; min-width: 220px; display: grid; gap: 8px; padding: 12px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-md); }
|
||||
.table-scroll { overflow-x: auto; }
|
||||
.detail-table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
|
||||
.detail-table th, .detail-table td { text-align: left; padding: 12px; border-bottom: 1px solid var(--border-subtle); vertical-align: top; }
|
||||
.detail-table th { color: var(--text-secondary); font-size: var(--text-xs); white-space: nowrap; }
|
||||
.detail-table td { overflow-wrap: anywhere; }
|
||||
.file-details { max-width: 360px; font-size: var(--text-xs); }
|
||||
.file-details dt { color: var(--text-secondary); margin-top: 8px; }
|
||||
.file-details dd { margin: 4px 0; overflow-wrap: anywhere; }
|
||||
.connection-status { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; }
|
||||
.connection-status > div { display: flex; flex-direction: column; align-items: start; gap: 8px; font-size: var(--text-sm); }
|
||||
.connection-status small { color: var(--text-secondary); }
|
||||
.connection-details { margin-top: 20px; }
|
||||
.text-button { padding: 0; border: 0; color: var(--accent-primary); background: none; font: inherit; cursor: pointer; }
|
||||
.telemetry-inspector > summary { margin-bottom: 12px; }
|
||||
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
|
||||
@media (max-width: 640px) { .panel-head, .alert { flex-wrap: wrap; } }
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user