From f4094b7f5db5f9929b41d3b107000fcd525abea4 Mon Sep 17 00:00:00 2001 From: Josh Wright Date: Tue, 6 Oct 2026 17:30:12 -0400 Subject: [PATCH] Simplify capacity summary and host comparison --- src/lib/server/hosts/capacity-overview.ts | 2 +- .../components/capacity/CapacityChart.svelte | 34 +++--- .../components/capacity/CapacityHosts.svelte | 62 ++++++++++ src/routes/capacity/+page.svelte | 106 +++++++++--------- tests/unit/ui-capacity.test.ts | 78 +++++++++++++ 5 files changed, 213 insertions(+), 69 deletions(-) create mode 100644 src/lib/ui/components/capacity/CapacityHosts.svelte create mode 100644 tests/unit/ui-capacity.test.ts diff --git a/src/lib/server/hosts/capacity-overview.ts b/src/lib/server/hosts/capacity-overview.ts index 355cdbf..1c5d7d5 100644 --- a/src/lib/server/hosts/capacity-overview.ts +++ b/src/lib/server/hosts/capacity-overview.ts @@ -46,7 +46,7 @@ export async function readCapacityCurrent(query: CapacityQuery): Promise + import type { Snippet } from 'svelte'; import type { CapacityHistory, CapacityHistoryPoint } from '$lib/capacity.js'; import { timeFormat, timeZone } from '$ui/stores/time-zone.js'; - let { history, scope }: { history: CapacityHistory; scope: string } = $props(); + let { history, scope, controls }: { history: CapacityHistory; scope: string; controls?: Snippet } = $props(); let metric = $state<'cpu' | 'memory'>('cpu'); let selectedAt = $state(null); let tableOpen = $state(false); @@ -67,12 +68,13 @@
-

Capacity over time

Measured resource headroom · {scope}

-
+

Available resources over time

{scope} · All workloads

+
{@render controls?.()}
-
+
+

The game filter applies to current launch estimates only.

{label} available
@@ -97,13 +99,14 @@
{#if selected}
-
Selected period{$timeFormat.period(selected.at)}
+
{$timeFormat.period(selected.at)}
CPU available
{amount(selected.cpuCoresAvailable, 'cores')}
Memory available
{amount(selected.memoryBytesAvailable === null ? null : selected.memoryBytesAvailable / 1024 ** 3, 'GiB')}
Reporting hosts
{selected.reportingHosts} / {selected.expectedHosts}
{/if} -

Host headroom after the operating-system reserve, averaged per period. Gaps mean reporting is incomplete. The game filter changes current launch estimates; this history includes all workloads on the selected hosts.

+
About this chart +

Available host resources after the operating-system reserve, averaged per period. Gaps mean reporting is incomplete. Reporting-host coverage is shown for each selected period. This history includes all workloads on the selected hosts; it does not reconstruct historical launch eligibility, queued jobs, or port availability.

View history data · {$timeZone.replaceAll('_', ' ')} {#if tableOpen} @@ -114,21 +117,24 @@ {/if}
+
diff --git a/src/routes/capacity/+page.svelte b/src/routes/capacity/+page.svelte index 6f35012..1843b49 100644 --- a/src/routes/capacity/+page.svelte +++ b/src/routes/capacity/+page.svelte @@ -1,17 +1,16 @@