Files
pulse/frontend-modern/browser-tests/docker-composed.tsx
T
rcourtman 39f988b220 Remove AI Discovery
AI Discovery ran a separate model-backed service scanner beside Patrol
and the Assistant: its own store, scheduler, model route, API, tool and
drawer UI. No telemetry counter ever measured its use (the telemetry
discovery_enabled flag OR'd it with network subnet discovery), the
maintainer judged it a flop, and the context it produced is already
available to the models through pulse_query, pulse_read and the
unified-resource context sections.

This deletes internal/servicediscovery, internal/ai/infradiscovery, the
pulse_discovery tool, the /api/discovery routes, the mock Discovery
fixtures, the Discovery tabs in the resource, guest, node and Docker host
drawers, the identified-service cards, readiness badges, provenance
markers, suggested web-interface URLs, the Workloads AI Context column,
the chat "Discovery is off" hint and the AI Service Context settings page.
The old settings route redirects to Assistant settings. The model-bound
sanitizer allow-list existed only to pass Discovery context through, so it
goes too, along with the CopyableCodeRow primitive that only the
Discovery tab used.

Network subnet discovery (/api/discover, the Infrastructure discovery
settings) and the discoveryTarget agent coordinates are separate features
and stay. Stored discovery_enabled, discovery_interval_hours and
discovery_model AI settings are ignored on load; the settings API decoder
is lenient, so older frontends saving those fields still succeed.
2026-10-11 22:20:25 +01:00

86 lines
2.7 KiB
TypeScript

// Presentation only: selected synthetic resources, real table, drawer and CSS.
import { createSignal } from 'solid-js';
import { render } from 'solid-js/web';
import { Router, Route } from '@solidjs/router';
import { DockerContainersTable } from '../src/features/docker/DockerContainersTable';
import { DarkModeContext } from '../src/contexts/appRuntime';
import type { Resource } from '../src/types/resource';
import '../src/index.css';
const container = (name: string, host: string, cpu: number, engine = 'docker'): Resource => ({
id: name,
type: 'app-container',
name,
platformId: name,
platformType: 'docker',
sourceType: 'agent',
status: 'running',
cpu: { current: cpu },
memory: { current: 10 },
docker: { hostname: host, runtime: engine, runtimeVersion: 'fixture', containerState: 'running' },
});
const containers = [
container('small-positive', 'edge-a', 0.26),
container('measured-zero', 'edge-a', 0),
container('tiny-positive', 'edge-b', 0.04, 'podman'),
];
const hosts: Resource[] = [
{
id: 'host-a',
type: 'docker-host',
name: 'edge-a',
platformId: 'host-a',
platformType: 'docker',
sourceType: 'agent',
status: 'offline',
docker: { hostname: 'edge-a', runtime: 'docker', runtimeVersion: 'fixture' },
health: {
verdict: 'stale',
reasons: [{ code: 'telemetry_stale', detail: '9m' }],
},
},
{
id: 'host-b',
type: 'docker-host',
name: 'edge-b',
platformId: 'host-b',
platformType: 'docker',
sourceType: 'agent',
status: 'online',
docker: { hostname: 'edge-b', runtime: 'podman', runtimeVersion: 'fixture' },
},
];
function Fixture() {
const [withHosts, setWithHosts] = createSignal(true);
return (
<DarkModeContext.Provider value={() => document.documentElement.classList.contains('dark')}>
<main class="min-h-screen space-y-4 bg-surface p-3 text-base-content">
<h1 class="text-lg font-semibold">Composed container presentation</h1>
<p class="text-xs text-muted">Synthetic metrics. No container or notification action.</p>
<button
type="button"
class="min-h-11 rounded border border-border px-3 text-xs"
onClick={() => setWithHosts(!withHosts())}
>
{withHosts() ? 'Remove host context' : 'Restore host context'}
</button>
<DockerContainersTable
resources={containers}
hosts={withHosts() ? hosts : undefined}
emptyIcon={<span />}
emptyTitle="No containers"
emptyDescription="No containers"
/>
</main>
</DarkModeContext.Provider>
);
}
render(
() => (
<Router>
<Route path="*" component={Fixture} />
</Router>
),
document.getElementById('root')!,
);