Files
pulse/frontend-modern/browser-tests/host-disk-usage.tsx
T
pulse-triage[bot] 8d2288f1be Allow bounded alert observations in the host drawer fixture
Exercise active Docker reading warnings beside Overview charts at narrow widths without creating a live alert or changing monitoring.

Contract-Neutral: Browser fixture input only; alert and drawer runtime contracts are unchanged.
Change-source: pulse-maintainer
2026-10-14 01:42:13 +01:00

70 lines
2.6 KiB
TypeScript

// Canonical Resources HTTP -> real platform tables -> real host drawers/CSS.
// Synthetic source observations only; no disk, guest or recovery operation.
import { Show } from 'solid-js';
import { render } from 'solid-js/web';
import { Route, Router } from '@solidjs/router';
import { useUnifiedResources } from '../src/hooks/useUnifiedResources';
import { ProxmoxNodesTable } from '../src/features/proxmox/ProxmoxNodesTable';
import { DockerHostsTable } from '../src/features/docker/DockerHostsTable';
import { DarkModeContext, WebSocketContext, type WebSocketStore } from '../src/contexts/appRuntime';
import '../src/index.css';
function Fixture() {
const state = useUnifiedResources({
query: 'type=agent,docker-host',
realtimeEnabled: () => false,
});
const kind = new URLSearchParams(window.location.search).get('kind');
(window as any).__hostDiskUsage = { refetch: state.refetch, resources: state.resources };
return (
<main class="min-h-screen space-y-3 bg-surface p-3 text-base-content pulse-wide-data-surface">
<h1 class="text-base font-semibold">Host filesystem readings</h1>
<p class="text-xs text-muted">Synthetic resource snapshots; no host operations.</p>
<Show
when={kind === 'node'}
fallback={
<DockerHostsTable
resources={state.resources().filter((value) => value.type === 'docker-host')}
emptyIcon={<span />}
emptyTitle="No Docker hosts"
emptyDescription="Waiting for synthetic observations"
showToolbar={false}
/>
}
>
<ProxmoxNodesTable
nodes={state.resources().filter((value) => value.type === 'agent')}
guests={[]}
emptyIcon={<span />}
emptyTitle="No nodes"
emptyDescription="Waiting for synthetic observations"
/>
</Show>
</main>
);
}
render(
() => (
<WebSocketContext.Provider
value={
{
// Browser-supplied, synthetic alert observations. This exercises the
// same consuming surface without a live agent or induced alert.
activeAlerts:
(window as Window & { __hostDiskAlerts?: WebSocketStore['activeAlerts'] })
.__hostDiskAlerts ?? {},
state: { pmg: [] },
connected: () => false,
} as unknown as WebSocketStore
}
>
<DarkModeContext.Provider value={() => document.documentElement.classList.contains('dark')}>
<Router>
<Route path="*" component={Fixture} />
</Router>
</DarkModeContext.Provider>
</WebSocketContext.Provider>
),
document.getElementById('root')!,
);