ServiceMap: update tests and backend/app (+7 areas)

Public changes compared with the previous published export:
89 files changed.

Affected areas:
- backend/app: 21 files
- dependencies: 5 files
- deployment and CI: 6 files
- documentation: 2 files
- frontend: 3 files
- frontend/src: 20 files
- project files: 1 file
- tests: 30 files
- unraid: 1 file

Changed files:
- Updated: ".env.example"
- Updated: "Dockerfile.unraid"
- Updated: "README.md"
- Updated: "backend/Dockerfile"
- Added: "backend/app/alerts.py"
- Updated: "backend/app/auth.py"
- Added: "backend/app/backups.py"
- Updated: "backend/app/config_io.py"
- Updated: "backend/app/demo.py"
- Updated: "backend/app/discovery.py"
- Updated: "backend/app/discovery_store.py"
- Updated: "backend/app/docker_discovery.py"
- Updated: "backend/app/events.py"
- Updated: "backend/app/evidence.py"
- Updated: "backend/app/health.py"
- Updated: "backend/app/incidents.py"
- Added: "backend/app/loops.py"
- Updated: "backend/app/main.py"
- Updated: "backend/app/models.py"
- Updated: "backend/app/observation.py"
- Updated: "backend/app/probes.py"
- Added: "backend/app/response_cache.py"
- Updated: "backend/app/scheduler.py"
- Updated: "backend/app/semantic.py"
- Updated: "backend/app/store.py"
- Updated: "backend/pyproject.toml"
- Updated: "backend/tests/test_api.py"
- Updated: "backend/tests/test_config_io.py"
- Updated: "backend/tests/test_demo.py"
- Updated: "backend/tests/test_discovery_v120.py"
- Updated: "backend/tests/test_health.py"
- Updated: "backend/tests/test_probes.py"
- Updated: "backend/tests/test_scheduler.py"
- Updated: "backend/tests/test_v130_probe_reachability.py"
- Updated: "backend/tests/test_v160_evidence_changes.py"
- Added: "backend/tests/test_v163_alerts.py"
- Added: "backend/tests/test_v163_backups.py"
- Added: "backend/tests/test_v163_data_integrity.py"
- Added: "backend/tests/test_v163_efficiency.py"
- Added: "backend/tests/test_v163_health_performance.py"
- Added: "backend/tests/test_v163_loops.py"
- Added: "backend/tests/test_v163_management.py"
- Added: "backend/tests/test_v163_realtime.py"
- Added: "backend/tests/test_v163_security.py"
- Added: "backend/tests/test_v163_semantic_etag.py"
- Added: "compose.demo.yaml"
- Updated: "compose.yaml"
- Added: "docker-compose.broker.yml"
- Updated: "docker-compose.yml"
- Updated: "docs/ARCHITECTURE.md"
- Added: "frontend/e2e/a11y.spec.ts"
- Updated: "frontend/e2e/demo.spec.ts"
- Updated: "frontend/index.html"
- Updated: "frontend/nginx.conf"
- Updated: "frontend/package-lock.json"
- Updated: "frontend/package.json"
- Updated: "frontend/playwright.config.ts"
- Updated: "frontend/src/App.tsx"
- Updated: "frontend/src/LivingEdge.tsx"
- Added: "frontend/src/activityView.test.ts"
- Added: "frontend/src/activityView.ts"
- Updated: "frontend/src/api.ts"
- Added: "frontend/src/apiAuth.test.ts"
- Added: "frontend/src/components/ActionsMenu.tsx"
- Added: "frontend/src/components/ConfirmDialog.test.tsx"
- Added: "frontend/src/components/ConfirmDialog.tsx"
- Added: "frontend/src/components/StatusIcon.tsx"
- Updated: "frontend/src/demo/DemoWalkthrough.test.ts"
- Updated: "frontend/src/demo/DemoWalkthrough.tsx"
- Added: "frontend/src/elk-worker-url.d.ts"
- Added: "frontend/src/labels.ts"
- Updated: "frontend/src/main.tsx"
- Added: "frontend/src/realtime/refreshPlan.test.ts"
- Added: "frontend/src/realtime/refreshPlan.ts"
- Updated: "frontend/src/realtime/useRealtimeEvents.ts"
- Added: "frontend/src/routing/urlState.test.ts"
- Added: "frontend/src/routing/urlState.ts"
- Updated: "frontend/src/styles.css"
- Added: "frontend/src/topology/GraphListView.test.tsx"
- Added: "frontend/src/topology/GraphListView.tsx"
- Updated: "frontend/src/topology/ServiceNode.tsx"
- Updated: "frontend/src/topology/TopologyCommandBar.tsx"
- Added: "frontend/src/topology/semanticGraph.test.ts"
- Updated: "frontend/src/topology/semanticGraph.ts"
- Added: "frontend/src/topologyLayout.test.ts"
- Updated: "frontend/src/topologyLayout.ts"
- Updated: "package-lock.json"
- Updated: "package.json"
- Updated: "unraid/my-servicemap.xml"

Export provenance/manifests refreshed; excluded from the change summary.

Publish curated ServiceMap source from af46f684e468dffd3a5190e28d3b572d4c26bfd7
This commit is contained in:
NuklearRabbit committed 2026-11-20 13:51:46 +01:00
1 parent d7319250e8
commit adc2c70c21
91 files changed
+9205 -1691

No files matched your search

+68
View File
@@ -0,0 +1,68 @@
import AxeBuilder from "@axe-core/playwright";
import { expect, test, type APIRequestContext } from "@playwright/test";
async function ensureServices(request: APIRequestContext) {
await request.post("/api/v1/demo/exit");
const existing = (await (await request.get("/api/v1/services")).json()) as { service: { name: string } }[];
const names = new Set(existing.map((item) => item.service.name));
for (const name of ["A11y Database", "A11y API"]) {
if (names.has(name)) continue;
const response = await request.post("/api/v1/services", {
data: { name, kind: "tcp", host: "127.0.0.1", port: 9, environment: "test" },
});
expect(response.ok(), await response.text()).toBeTruthy();
}
}
test.beforeEach(async ({ request }) => {
await ensureServices(request);
});
const PANELS = ["topology", "overview", "incidents", "services", "discovery", "changes", "activity", "config", "settings"];
for (const panel of PANELS) {
test(`${panel} has no serious or critical axe violations`, async ({ page }) => {
await page.goto(`/#/${panel}`);
await expect(page.getByRole("navigation", { name: "ServiceMap-werkruimtes" })).toBeVisible();
await expect(page.locator("main#main-content")).toBeVisible();
await page.waitForLoadState("networkidle");
const results = await new AxeBuilder({ page })
.withTags(["wcag2a", "wcag2aa", "wcag21a", "wcag21aa", "wcag22aa"])
.analyze();
const blocking = results.violations
.filter((violation) => violation.impact === "serious" || violation.impact === "critical")
.map((violation) => `${violation.id}: ${violation.nodes.map((node) => node.target.join(" ")).slice(0, 5).join(" | ")}`);
expect(blocking, blocking.join("\n")).toEqual([]);
});
}
test("navigation marks the current workspace and the skip link reaches content", async ({ page }) => {
await page.goto("/#/services");
await expect(page.getByRole("button", { name: "Services", exact: true })).toHaveAttribute("aria-current", "page");
await page.keyboard.press("Tab");
const skip = page.getByRole("link", { name: "Naar inhoud springen" });
await expect(skip).toBeFocused();
await page.keyboard.press("Enter");
await expect(page.locator("main#main-content")).toBeFocused();
});
test("the topology can be explored with the keyboard alone", async ({ page }) => {
await page.goto("/#/topology");
// Canvas nodes are focusable, labelled, and open the inspector on Enter.
const node = page.locator(".react-flow__node").first();
// The first layout can take a while on a busy machine; wait for it, not for a fixed delay.
await expect(node).toHaveAttribute("aria-label", /, (Gezond|Verminderd|Uitgevallen|Onbekend|Niet bewaakt|Herstellend|Onderhoud)/, {
timeout: 30_000,
});
await node.focus();
await page.keyboard.press("Enter");
await expect(page).toHaveURL(/(service|in_domain|in_app)=/);
// The list alternative offers the same with plain buttons.
await page.getByRole("button", { name: "Als lijst tonen" }).click();
const list = page.getByRole("region", { name: "Topologie als lijst" });
await expect(list).toBeVisible();
await list.getByRole("button").first().focus();
await page.keyboard.press("Enter");
await expect(page.getByRole("button", { name: "Grafiek tonen" })).toHaveAttribute("aria-pressed", "true");
});
+31 -28
View File
@@ -39,17 +39,18 @@ test("Explore demo exposes evidence-backed root cause and reset-safe exit", asyn
const baselineTopology = topologyOf(await baselineResponse.json());
await page.goto("/");
const explore = page.getByRole("button", { name: "Explore demo", exact: true });
// Secondary actions live in the header's overflow menu.
await page.getByRole("button", { name: "Meer acties" }).click();
const explore = page.getByRole("button", { name: "Demo verkennen", exact: true });
await expect(explore).toBeEnabled({ timeout: 30_000 });
const loadResponsePromise = page.waitForResponse(isDemoMutation("/api/v1/demo"));
await explore.click();
if (baselineTopology.length > 0) {
const confirmation = page
.getByRole("alert")
.filter({ hasText: "temporarily replace this topology" });
.getByRole("dialog", { name: /vervangt deze topologie tijdelijk/ });
await expect(confirmation).toBeVisible();
await confirmation.getByRole("button", { name: "Explore demo", exact: true }).click();
await confirmation.getByRole("button", { name: "Snapshot maken en verkennen", exact: true }).click();
}
const loadResponse = await loadResponsePromise;
expect(loadResponse.ok()).toBeTruthy();
@@ -99,37 +100,38 @@ test("Explore demo exposes evidence-backed root cause and reset-safe exit", asyn
uptime_percent: 91.67,
});
const demoBanner = page.getByRole("status", { name: "Explore demo scenario" });
const demoBanner = page.getByRole("status", { name: "Demoscenario verkennen" });
await expect(demoBanner).toBeVisible();
await expect(demoBanner).toHaveAttribute("aria-busy", "false", { timeout: 30_000 });
await expect(page.getByText("Demo scenario", { exact: false })).toBeVisible();
await expect(page.getByText("Demoscenario", { exact: false })).toBeVisible();
await expect(page.getByText("PostgreSQL", { exact: true }).first()).toBeVisible();
await expect(page.getByText("Likely root cause", { exact: true })).toBeVisible();
await expect(page.getByText("Health evidence", { exact: true })).toBeVisible();
await expect(page.getByText("Waarschijnlijke hoofdoorzaak", { exact: true })).toBeVisible();
await expect(page.getByText("Gezondheidsbewijs", { exact: true })).toBeVisible();
const workspaces = page.getByRole("navigation", { name: "ServiceMap workspaces" });
await workspaces.getByRole("button", { name: "Overview" }).click();
await expect(page.getByRole("heading", { name: "9/9 with current health evidence" })).toBeVisible();
await expect(page.getByRole("button", { name: "Review unresolved" })).toBeDisabled();
await page.locator(".overview-lead").getByRole("button", { name: /1 down/i }).click();
const workspaces = page.getByRole("navigation", { name: "ServiceMap-werkruimtes" });
await workspaces.getByRole("button", { name: "Overzicht" }).click();
await expect(page.getByRole("heading", { name: "9/9 met actueel gezondheidsbewijs" })).toBeVisible();
await expect(page.getByRole("button", { name: "Onopgeloste nakijken" })).toBeDisabled();
await page.locator(".overview-lead").getByRole("button", { name: /1 uitgevallen/i }).click();
await expect(page.getByRole("combobox", { name: "Status", exact: true })).toHaveValue("down");
await workspaces.getByRole("button", { name: "Incidents" }).click();
await workspaces.getByRole("button", { name: "Incidenten" }).click();
await expect(
page.getByRole("heading", { name: "Active and historical incidents" }),
page.getByRole("heading", { name: "Actieve en eerdere incidenten" }),
).toBeVisible();
await page.getByLabel("Search incidents").fill("does not exist");
await expect(page.getByText("No incidents match these filters.")).toBeVisible();
await page.getByLabel("Search incidents").fill("");
await workspaces.getByRole("button", { name: "Topology", exact: true }).click();
await expect(page.getByRole("region", { name: "Topology commands" })).toBeVisible();
await page.getByRole("region", { name: "Topology commands" }).locator("summary").filter({ hasText: "Filters" }).click();
await expect(page.getByRole("combobox", { name: "Filter topology by status" })).toBeVisible();
await page.getByLabel("Incidenten zoeken").fill("does not exist");
await expect(page.getByText("Geen incidenten voor deze filters.")).toBeVisible();
await page.getByLabel("Incidenten zoeken").fill("");
await workspaces.getByRole("button", { name: "Topologie", exact: true }).click();
await expect(page.getByRole("region", { name: "Topologieopdrachten" })).toBeVisible();
await page.getByRole("region", { name: "Topologieopdrachten" }).locator("summary").filter({ hasText: "Filters" }).click();
await expect(page.getByRole("combobox", { name: "Topologie filteren op status" })).toBeVisible();
const inspector = page.getByRole("complementary");
await expect(inspector.getByRole("heading", { name: "PostgreSQL" })).toBeVisible();
await expect(inspector.getByText("Likely root cause", { exact: true })).toBeVisible();
await expect(inspector.getByText("Health evidence", { exact: true })).toBeVisible();
await expect(inspector.getByText("Waarschijnlijke hoofdoorzaak", { exact: true })).toBeVisible();
await expect(inspector.getByText("Gezondheidsbewijs", { exact: true })).toBeVisible();
const reset = page.locator("header").getByRole("button", { name: "Reset demo" });
await page.getByRole("button", { name: "Meer acties" }).click();
const reset = page.locator("header").getByRole("button", { name: "Demo opnieuw starten" });
const resetResponsePromise = page.waitForResponse(isDemoMutation("/api/v1/demo/reset"));
await reset.click();
const resetResponse = await resetResponsePromise;
@@ -143,7 +145,7 @@ test("Explore demo exposes evidence-backed root cause and reset-safe exit", asyn
// Wait for the demo region to leave its busy state before attempting Exit.
await expect(demoBanner).toHaveAttribute("aria-busy", "false", { timeout: 30_000 });
await expect(page.getByText("PostgreSQL", { exact: true }).first()).toBeVisible();
const exit = page.getByRole("button", { name: "Exit demo", exact: true });
const exit = page.getByRole("button", { name: "Demo afsluiten", exact: true });
await expect(exit).toBeEnabled();
const exitResponsePromise = page.waitForResponse(isDemoMutation("/api/v1/demo/exit"));
@@ -154,10 +156,11 @@ test("Explore demo exposes evidence-backed root cause and reset-safe exit", asyn
await expect(demoBanner).toBeHidden({ timeout: 30_000 });
await expect(
page.getByText("Demo closed. Your previous topology was restored.", { exact: true }),
page.getByText("Demo afgesloten. Je vorige topologie is hersteld.", { exact: true }),
).toBeVisible();
await page.getByRole("button", { name: "Meer acties" }).click();
await expect(
page.getByRole("button", { name: "Explore demo", exact: true }),
page.getByRole("button", { name: "Demo verkennen", exact: true }),
).toBeEnabled({ timeout: 30_000 });
const restoredDemoResponse = await request.get("/api/v1/demo");
+1 -1
View File
@@ -1,5 +1,5 @@
<!doctype html>
<html lang="en">
<html lang="nl-BE">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
+11 -1
View File
@@ -8,7 +8,9 @@ server {
location /api/ {
proxy_pass http://backend:8000;
proxy_http_version 1.1;
proxy_set_header Host $host;
# $http_host keeps the port so the API's Origin check sees the public address.
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
@@ -17,7 +19,15 @@ server {
proxy_pass http://backend:8000/health;
}
# Fingerprinted bundles never change in place; index.html must be
# revalidated or browsers keep running the previous release.
location /assets/ {
add_header Cache-Control "public, max-age=31536000, immutable";
try_files $uri =404;
}
location / {
add_header Cache-Control "no-cache";
try_files $uri /index.html;
}
}
+709 -2
View File
@@ -1,33 +1,77 @@
{
"name": "servicemap-frontend",
"version": "1.6.2",
"version": "1.6.3",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "servicemap-frontend",
"version": "1.6.2",
"version": "1.6.3",
"dependencies": {
"@fontsource-variable/inter": "^5.3.0",
"@xyflow/react": "^12.8.5",
"elkjs": "^0.12.0",
"lucide-react": "^0.577.0",
"react": "^19.1.1",
"react-dom": "^19.1.1"
},
"devDependencies": {
"@axe-core/playwright": "^4.14.0",
"@eslint/js": "^10.0.1",
"@playwright/test": "^1.57.0",
"@testing-library/dom": "^10.4.2",
"@testing-library/react": "^16.3.3",
"@testing-library/user-event": "^14.6.13",
"@types/react": "^19.1.12",
"@types/react-dom": "^19.1.9",
"@vitejs/plugin-react": "^5.0.2",
"eslint": "^10.11.0",
"eslint-plugin-react-hooks": "^7.1.1",
"globals": "^17.12.0",
"jsdom": "^26.1.0",
"typescript": "^5.9.2",
"typescript-eslint": "^8.70.1",
"vite": "^7.1.5",
"vitest": "^3.2.4"
}
},
"node_modules/@asamuzakjp/css-color": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/@asamuzakjp/css-color/-/css-color-3.2.0.tgz",
"integrity": "sha512-K1A6z8tS3XsmCMM86xoWdn7Fkdn9m6RSVtocUrJYIwZnFVkng/PvkEoWtOWmP+Scc6saYWHWZYbndEEXxl24jw==",
"dev": true,
"license": "MIT",
"dependencies": {
"@csstools/css-calc": "^2.1.3",
"@csstools/css-color-parser": "^3.0.9",
"@csstools/css-parser-algorithms": "^3.0.4",
"@csstools/css-tokenizer": "^3.0.3",
"lru-cache": "^10.4.3"
}
},
"node_modules/@asamuzakjp/css-color/node_modules/lru-cache": {
"version": "10.4.3",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz",
"integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==",
"dev": true,
"license": "ISC"
},
"node_modules/@axe-core/playwright": {
"version": "4.14.0",
"resolved": "https://registry.npmjs.org/@axe-core/playwright/-/playwright-4.14.0.tgz",
"integrity": "sha512-SGUhG5PIHd2eMdpgBF2PyQLOhX+qyDR2PT4cmoS4Qk2ak+jX/rrSvst9l0PGv5WTHolKpUMvVmoHpr4cZgf1RQ==",
"dev": true,
"license": "MPL-2.0",
"dependencies": {
"axe-core": "~4.14.0"
},
"engines": {
"node": ">=22.12.0"
},
"peerDependencies": {
"playwright-core": ">= 1.0.0"
}
},
"node_modules/@babel/code-frame": {
"version": "7.29.7",
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.29.7.tgz",
@@ -262,6 +306,16 @@
"@babel/core": "^7.0.0-0"
}
},
"node_modules/@babel/runtime": {
"version": "7.29.14",
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.29.14.tgz",
"integrity": "sha512-Y5tqevQaUAZhhj82BpYMNC1ssvLQTVAfwKdm8iy8qwmhvC2/CpcAu8OC+QEtjM7pMk7knx83u1Qj8gzkicyelw==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=6.9.0"
}
},
"node_modules/@babel/template": {
"version": "7.29.7",
"resolved": "https://registry.npmjs.org/@babel/template/-/template-7.29.7.tgz",
@@ -334,6 +388,121 @@
"keyv": "^5.6.0"
}
},
"node_modules/@csstools/color-helpers": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/@csstools/color-helpers/-/color-helpers-5.1.0.tgz",
"integrity": "sha512-S11EXWJyy0Mz5SYvRmY8nJYTFFd1LCNV+7cXyAgQtOOuzb4EsgfqDufL+9esx72/eLhsRdGZwaldu/h+E4t4BA==",
"dev": true,
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/csstools"
},
{
"type": "opencollective",
"url": "https://opencollective.com/csstools"
}
],
"license": "MIT-0",
"engines": {
"node": ">=18"
}
},
"node_modules/@csstools/css-calc": {
"version": "2.1.4",
"resolved": "https://registry.npmjs.org/@csstools/css-calc/-/css-calc-2.1.4.tgz",
"integrity": "sha512-3N8oaj+0juUw/1H3YwmDDJXCgTB1gKU6Hc/bB502u9zR0q2vd786XJH9QfrKIEgFlZmhZiq6epXl4rHqhzsIgQ==",
"dev": true,
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/csstools"
},
{
"type": "opencollective",
"url": "https://opencollective.com/csstools"
}
],
"license": "MIT",
"engines": {
"node": ">=18"
},
"peerDependencies": {
"@csstools/css-parser-algorithms": "^3.0.5",
"@csstools/css-tokenizer": "^3.0.4"
}
},
"node_modules/@csstools/css-color-parser": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/@csstools/css-color-parser/-/css-color-parser-3.1.0.tgz",
"integrity": "sha512-nbtKwh3a6xNVIp/VRuXV64yTKnb1IjTAEEh3irzS+HkKjAOYLTGNb9pmVNntZ8iVBHcWDA2Dof0QtPgFI1BaTA==",
"dev": true,
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/csstools"
},
{
"type": "opencollective",
"url": "https://opencollective.com/csstools"
}
],
"license": "MIT",
"dependencies": {
"@csstools/color-helpers": "^5.1.0",
"@csstools/css-calc": "^2.1.4"
},
"engines": {
"node": ">=18"
},
"peerDependencies": {
"@csstools/css-parser-algorithms": "^3.0.5",
"@csstools/css-tokenizer": "^3.0.4"
}
},
"node_modules/@csstools/css-parser-algorithms": {
"version": "3.0.5",
"resolved": "https://registry.npmjs.org/@csstools/css-parser-algorithms/-/css-parser-algorithms-3.0.5.tgz",
"integrity": "sha512-DaDeUkXZKjdGhgYaHNJTV9pV7Y9B3b644jCLs9Upc3VeNGg6LWARAT6O+Q+/COo+2gg/bM5rhpMAtf70WqfBdQ==",
"dev": true,
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/csstools"
},
{
"type": "opencollective",
"url": "https://opencollective.com/csstools"
}
],
"license": "MIT",
"engines": {
"node": ">=18"
},
"peerDependencies": {
"@csstools/css-tokenizer": "^3.0.4"
}
},
"node_modules/@csstools/css-tokenizer": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/@csstools/css-tokenizer/-/css-tokenizer-3.0.4.tgz",
"integrity": "sha512-Vd/9EVDiu6PPJt9yAh6roZP6El1xHrdvIVGjyBsHR0RYwNHgL7FJPyIIW4fANJNG6FtyZfvlRPpFI4ZM/lubvw==",
"dev": true,
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/csstools"
},
{
"type": "opencollective",
"url": "https://opencollective.com/csstools"
}
],
"license": "MIT",
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/aix-ppc64": {
"version": "0.28.2",
"resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.28.2.tgz",
@@ -904,6 +1073,15 @@
"node": "^20.19.0 || ^22.13.0 || >=24"
}
},
"node_modules/@fontsource-variable/inter": {
"version": "5.3.0",
"resolved": "https://registry.npmjs.org/@fontsource-variable/inter/-/inter-5.3.0.tgz",
"integrity": "sha512-OupL48va4JNofb97w6NYeF9S7W/kHNKM0Er8Dem5nqi4jeOLrVJDoE8tZEpnMJmtkvNbB1EIPPwHcdkF6b1oUA==",
"license": "OFL-1.1",
"funding": {
"url": "https://github.com/sponsors/ayuhito"
}
},
"node_modules/@humanfs/core": {
"version": "0.19.2",
"resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.2.tgz",
@@ -1476,6 +1654,75 @@
"win32"
]
},
"node_modules/@testing-library/dom": {
"version": "10.4.2",
"resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-10.4.2.tgz",
"integrity": "sha512-yzr2S9HyAIdhz2/6qHgbs665Q7PKVcDF05vsOlHPxG1mo36gKVesdYVeDLnXgfjJ03CrKRk08knc6+E/9m8v2Q==",
"dev": true,
"license": "MIT",
"dependencies": {
"@babel/code-frame": "^7.10.4",
"@babel/runtime": "^7.12.5",
"@types/aria-query": "^5.0.1",
"aria-query": "5.3.0",
"dom-accessibility-api": "^0.5.9",
"lz-string": "^1.5.0",
"picocolors": "1.1.1",
"pretty-format": "^27.0.2"
},
"engines": {
"node": ">=18"
}
},
"node_modules/@testing-library/react": {
"version": "16.3.3",
"resolved": "https://registry.npmjs.org/@testing-library/react/-/react-16.3.3.tgz",
"integrity": "sha512-Uo193NgQbPMz6lrrhtRQQFcMC6Re/ELLFbbuVL30WDlZxlpZf9/lMHTAVxPRLw1q1iu9OJmR1c2BLiENRstdBg==",
"dev": true,
"license": "MIT",
"dependencies": {
"@babel/runtime": "^7.12.5"
},
"engines": {
"node": ">=18"
},
"peerDependencies": {
"@testing-library/dom": "^10.0.0",
"@types/react": "^18.0.0 || ^19.0.0",
"@types/react-dom": "^18.0.0 || ^19.0.0",
"react": "^18.0.0 || ^19.0.0",
"react-dom": "^18.0.0 || ^19.0.0"
},
"peerDependenciesMeta": {
"@types/react": {
"optional": true
},
"@types/react-dom": {
"optional": true
}
}
},
"node_modules/@testing-library/user-event": {
"version": "14.6.13",
"resolved": "https://registry.npmjs.org/@testing-library/user-event/-/user-event-14.6.13.tgz",
"integrity": "sha512-2LVZGptuB5un1Cu/u31o9adkCwbsUTMp4B4p04xupI7uobvTIpgKidSdShqZiReo/mQmvR9xjgdgTgge4oAbYA==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=12",
"npm": ">=6"
},
"peerDependencies": {
"@testing-library/dom": ">=7.21.4"
}
},
"node_modules/@types/aria-query": {
"version": "5.0.4",
"resolved": "https://registry.npmjs.org/@types/aria-query/-/aria-query-5.0.4.tgz",
"integrity": "sha512-rfT93uj5s0PRL7EzccGMs3brplhcrghnDoV26NqKhCAS1hVo+WdNsPvE/yb6ilfr5hi2MEk6d5EWJTKdxg8jVw==",
"dev": true,
"license": "MIT"
},
"node_modules/@types/babel__core": {
"version": "7.20.5",
"resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz",
@@ -2073,6 +2320,16 @@
"acorn": "^6.0.0 || ^7.0.0 || ^8.0.0"
}
},
"node_modules/agent-base": {
"version": "7.1.4",
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.4.tgz",
"integrity": "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">= 14"
}
},
"node_modules/ajv": {
"version": "6.15.0",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.15.0.tgz",
@@ -2090,6 +2347,39 @@
"url": "https://github.com/sponsors/epoberezkin"
}
},
"node_modules/ansi-regex": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=8"
}
},
"node_modules/ansi-styles": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz",
"integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
}
},
"node_modules/aria-query": {
"version": "5.3.0",
"resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.3.0.tgz",
"integrity": "sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A==",
"dev": true,
"license": "Apache-2.0",
"dependencies": {
"dequal": "^2.0.3"
}
},
"node_modules/assertion-error": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz",
@@ -2100,6 +2390,16 @@
"node": ">=12"
}
},
"node_modules/axe-core": {
"version": "4.14.1",
"resolved": "https://registry.npmjs.org/axe-core/-/axe-core-4.14.1.tgz",
"integrity": "sha512-FHfa+lmNjQZfJz1q8wKqIDwC6DExcHt/pkjNQb09a3NPjCKg2rhu5qb2S4r76ASyFNNtuFooJpZe37OgudVGtQ==",
"dev": true,
"license": "MPL-2.0",
"engines": {
"node": ">=4"
}
},
"node_modules/balanced-match": {
"version": "4.0.4",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz",
@@ -2270,6 +2570,20 @@
"node": ">= 8"
}
},
"node_modules/cssstyle": {
"version": "4.6.0",
"resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-4.6.0.tgz",
"integrity": "sha512-2z+rWdzbbSZv6/rhtvzvqeZQHrBaqgogqt85sqFNbabZOuFbCVFb8kPeEtZjiKkbrm395irpNKiYeFeLiQnFPg==",
"dev": true,
"license": "MIT",
"dependencies": {
"@asamuzakjp/css-color": "^3.2.0",
"rrweb-cssom": "^0.8.0"
},
"engines": {
"node": ">=18"
}
},
"node_modules/csstype": {
"version": "3.2.3",
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz",
@@ -2382,6 +2696,20 @@
"node": ">=12"
}
},
"node_modules/data-urls": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/data-urls/-/data-urls-5.0.0.tgz",
"integrity": "sha512-ZYP5VBHshaDAiVZxjbRVcFJpc+4xGgT0bK3vzy1HLN8jTO975HEbuYzZJcHoQEY5K1a0z8YayJkyVETa08eNTg==",
"dev": true,
"license": "MIT",
"dependencies": {
"whatwg-mimetype": "^4.0.0",
"whatwg-url": "^14.0.0"
},
"engines": {
"node": ">=18"
}
},
"node_modules/debug": {
"version": "4.4.3",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",
@@ -2400,6 +2728,13 @@
}
}
},
"node_modules/decimal.js": {
"version": "10.6.0",
"resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.6.0.tgz",
"integrity": "sha512-YpgQiITW3JXGntzdUmyUR1V812Hn8T1YVXhCu+wO3OpS4eU9l4YdD3qjyiKdV6mvV29zapkMeD390UVEf2lkUg==",
"dev": true,
"license": "MIT"
},
"node_modules/deep-eql": {
"version": "5.0.2",
"resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-5.0.2.tgz",
@@ -2417,6 +2752,23 @@
"dev": true,
"license": "MIT"
},
"node_modules/dequal": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz",
"integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=6"
}
},
"node_modules/dom-accessibility-api": {
"version": "0.5.16",
"resolved": "https://registry.npmjs.org/dom-accessibility-api/-/dom-accessibility-api-0.5.16.tgz",
"integrity": "sha512-X7BJ2yElsnOJ30pZF4uIIDfBEVgF4XEBxL9Bxhy6dnrm5hkzqmsWHGTiHqRiITNhMyFLyAiWndIJP7Z1NTteDg==",
"dev": true,
"license": "MIT"
},
"node_modules/electron-to-chromium": {
"version": "1.5.427",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.427.tgz",
@@ -2430,6 +2782,19 @@
"integrity": "sha512-YZcKynxVxYoKIOEpywEPwCFdg+BTbxQRNf3pbwdDCvc8O3kQD8bmIwSxKU1eOTVc4Xo+VG9Te+575mlfvOrhEQ==",
"license": "EPL-2.0 OR GPL-3.0-or-later"
},
"node_modules/entities": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/entities/-/entities-6.0.1.tgz",
"integrity": "sha512-aN97NXWF6AWBTahfVOIrB/NShkzi5H7F9r1s9mD3cDj4Ko5f2qhhVoYMibXF7GlLveb/D2ioWay8lxI97Ven3g==",
"dev": true,
"license": "BSD-2-Clause",
"engines": {
"node": ">=0.12"
},
"funding": {
"url": "https://github.com/fb55/entities?sponsor=1"
}
},
"node_modules/es-module-lexer": {
"version": "1.7.0",
"resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.7.0.tgz",
@@ -2870,6 +3235,60 @@
"dev": true,
"license": "MIT"
},
"node_modules/html-encoding-sniffer": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-4.0.0.tgz",
"integrity": "sha512-Y22oTqIU4uuPgEemfz7NDJz6OeKf12Lsu+QC+s3BVpda64lTiMYCyGwg5ki4vFxkMwQdeZDl2adZoqUgdFuTgQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"whatwg-encoding": "^3.1.1"
},
"engines": {
"node": ">=18"
}
},
"node_modules/http-proxy-agent": {
"version": "7.0.2",
"resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz",
"integrity": "sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==",
"dev": true,
"license": "MIT",
"dependencies": {
"agent-base": "^7.1.0",
"debug": "^4.3.4"
},
"engines": {
"node": ">= 14"
}
},
"node_modules/https-proxy-agent": {
"version": "7.0.6",
"resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz",
"integrity": "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==",
"dev": true,
"license": "MIT",
"dependencies": {
"agent-base": "^7.1.2",
"debug": "4"
},
"engines": {
"node": ">= 14"
}
},
"node_modules/iconv-lite": {
"version": "0.6.3",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz",
"integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==",
"dev": true,
"license": "MIT",
"dependencies": {
"safer-buffer": ">= 2.1.2 < 3.0.0"
},
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/ignore": {
"version": "5.3.2",
"resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz",
@@ -2913,6 +3332,13 @@
"node": ">=0.10.0"
}
},
"node_modules/is-potential-custom-element-name": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz",
"integrity": "sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==",
"dev": true,
"license": "MIT"
},
"node_modules/isexe": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
@@ -2927,6 +3353,46 @@
"dev": true,
"license": "MIT"
},
"node_modules/jsdom": {
"version": "26.1.0",
"resolved": "https://registry.npmjs.org/jsdom/-/jsdom-26.1.0.tgz",
"integrity": "sha512-Cvc9WUhxSMEo4McES3P7oK3QaXldCfNWp7pl2NNeiIFlCoLr3kfq9kb1fxftiwk1FLV7CvpvDfonxtzUDeSOPg==",
"dev": true,
"license": "MIT",
"dependencies": {
"cssstyle": "^4.2.1",
"data-urls": "^5.0.0",
"decimal.js": "^10.5.0",
"html-encoding-sniffer": "^4.0.0",
"http-proxy-agent": "^7.0.2",
"https-proxy-agent": "^7.0.6",
"is-potential-custom-element-name": "^1.0.1",
"nwsapi": "^2.2.16",
"parse5": "^7.2.1",
"rrweb-cssom": "^0.8.0",
"saxes": "^6.0.0",
"symbol-tree": "^3.2.4",
"tough-cookie": "^5.1.1",
"w3c-xmlserializer": "^5.0.0",
"webidl-conversions": "^7.0.0",
"whatwg-encoding": "^3.1.1",
"whatwg-mimetype": "^4.0.0",
"whatwg-url": "^14.1.1",
"ws": "^8.18.0",
"xml-name-validator": "^5.0.0"
},
"engines": {
"node": ">=18"
},
"peerDependencies": {
"canvas": "^3.0.0"
},
"peerDependenciesMeta": {
"canvas": {
"optional": true
}
}
},
"node_modules/jsesc": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz",
@@ -3024,6 +3490,25 @@
"yallist": "^3.0.2"
}
},
"node_modules/lucide-react": {
"version": "0.577.0",
"resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-0.577.0.tgz",
"integrity": "sha512-4LjoFv2eEPwYDPg/CUdBJQSDfPyzXCRrVW1X7jrx/trgxnxkHFjnVZINbzvzxjN70dxychOfg+FTYwBiS3pQ5A==",
"license": "ISC",
"peerDependencies": {
"react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0"
}
},
"node_modules/lz-string": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/lz-string/-/lz-string-1.5.0.tgz",
"integrity": "sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ==",
"dev": true,
"license": "MIT",
"bin": {
"lz-string": "bin/bin.js"
}
},
"node_modules/magic-string": {
"version": "0.30.21",
"resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.21.tgz",
@@ -3093,6 +3578,13 @@
"node": ">=18"
}
},
"node_modules/nwsapi": {
"version": "2.2.28",
"resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.28.tgz",
"integrity": "sha512-IlVB7OS7qrOsVYlpnFIkETjMwT9jwvmocJmmM+GZU/PAB3uGi9Ezd7vcWhWBUnSc0ya4ppmQITOyP1ez9gg8cg==",
"dev": true,
"license": "MIT"
},
"node_modules/optionator": {
"version": "0.9.4",
"resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz",
@@ -3143,6 +3635,19 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/parse5": {
"version": "7.3.0",
"resolved": "https://registry.npmjs.org/parse5/-/parse5-7.3.0.tgz",
"integrity": "sha512-IInvU7fabl34qmi9gY8XOVxhYyMyuH2xUNpb2q8/Y+7552KlejkRvqvD19nMoUW/uQGGbqNpA6Tufu5FL5BZgw==",
"dev": true,
"license": "MIT",
"dependencies": {
"entities": "^6.0.0"
},
"funding": {
"url": "https://github.com/inikulin/parse5?sponsor=1"
}
},
"node_modules/path-exists": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",
@@ -3268,6 +3773,21 @@
"node": ">= 0.8.0"
}
},
"node_modules/pretty-format": {
"version": "27.5.1",
"resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-27.5.1.tgz",
"integrity": "sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"ansi-regex": "^5.0.1",
"ansi-styles": "^5.0.0",
"react-is": "^17.0.1"
},
"engines": {
"node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0"
}
},
"node_modules/punycode": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
@@ -3319,6 +3839,13 @@
"react": "^19.3.0"
}
},
"node_modules/react-is": {
"version": "17.0.2",
"resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz",
"integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==",
"dev": true,
"license": "MIT"
},
"node_modules/react-refresh": {
"version": "0.18.0",
"resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.18.0.tgz",
@@ -3375,6 +3902,33 @@
"fsevents": "~2.3.2"
}
},
"node_modules/rrweb-cssom": {
"version": "0.8.0",
"resolved": "https://registry.npmjs.org/rrweb-cssom/-/rrweb-cssom-0.8.0.tgz",
"integrity": "sha512-guoltQEx+9aMf2gDZ0s62EcV8lsXR+0w8915TC3ITdn2YueuNjdAYh/levpU9nFaoChh9RUS5ZdQMrKfVEN9tw==",
"dev": true,
"license": "MIT"
},
"node_modules/safer-buffer": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
"dev": true,
"license": "MIT"
},
"node_modules/saxes": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/saxes/-/saxes-6.0.0.tgz",
"integrity": "sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==",
"dev": true,
"license": "ISC",
"dependencies": {
"xmlchars": "^2.2.0"
},
"engines": {
"node": ">=v12.22.7"
}
},
"node_modules/scheduler": {
"version": "0.28.0",
"resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.28.0.tgz",
@@ -3465,6 +4019,13 @@
"dev": true,
"license": "MIT"
},
"node_modules/symbol-tree": {
"version": "3.2.4",
"resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz",
"integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==",
"dev": true,
"license": "MIT"
},
"node_modules/tinybench": {
"version": "2.9.0",
"resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.9.0.tgz",
@@ -3526,6 +4087,52 @@
"node": ">=14.0.0"
}
},
"node_modules/tldts": {
"version": "6.1.86",
"resolved": "https://registry.npmjs.org/tldts/-/tldts-6.1.86.tgz",
"integrity": "sha512-WMi/OQ2axVTf/ykqCQgXiIct+mSQDFdH2fkwhPwgEwvJ1kSzZRiinb0zF2Xb8u4+OqPChmyI6MEu4EezNJz+FQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"tldts-core": "^6.1.86"
},
"bin": {
"tldts": "bin/cli.js"
}
},
"node_modules/tldts-core": {
"version": "6.1.86",
"resolved": "https://registry.npmjs.org/tldts-core/-/tldts-core-6.1.86.tgz",
"integrity": "sha512-Je6p7pkk+KMzMv2XXKmAE3McmolOQFdxkKw0R8EYNr7sELW46JqnNeTX8ybPiQgvg1ymCoF8LXs5fzFaZvJPTA==",
"dev": true,
"license": "MIT"
},
"node_modules/tough-cookie": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-5.1.2.tgz",
"integrity": "sha512-FVDYdxtnj0G6Qm/DhNPSb8Ju59ULcup3tuJxkFb5K8Bv2pUXILbf0xZWU8PX8Ov19OXljbUyveOFwRMwkXzO+A==",
"dev": true,
"license": "BSD-3-Clause",
"dependencies": {
"tldts": "^6.1.32"
},
"engines": {
"node": ">=16"
}
},
"node_modules/tr46": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/tr46/-/tr46-5.1.1.tgz",
"integrity": "sha512-hdF5ZgjTqgAntKkklYw0R03MG2x/bSzTtkxmIRw/sTNV8YXsCJ1tfLAX23lhxhHJlEf3CRCOCGGWw3vI3GaSPw==",
"dev": true,
"license": "MIT",
"dependencies": {
"punycode": "^2.3.1"
},
"engines": {
"node": ">=18"
}
},
"node_modules/ts-api-utils": {
"version": "2.5.0",
"resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.5.0.tgz",
@@ -3811,6 +4418,67 @@
}
}
},
"node_modules/w3c-xmlserializer": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-5.0.0.tgz",
"integrity": "sha512-o8qghlI8NZHU1lLPrpi2+Uq7abh4GGPpYANlalzWxyWteJOCsr/P+oPBA49TOLu5FTZO4d3F9MnWJfiMo4BkmA==",
"dev": true,
"license": "MIT",
"dependencies": {
"xml-name-validator": "^5.0.0"
},
"engines": {
"node": ">=18"
}
},
"node_modules/webidl-conversions": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz",
"integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==",
"dev": true,
"license": "BSD-2-Clause",
"engines": {
"node": ">=12"
}
},
"node_modules/whatwg-encoding": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-3.1.1.tgz",
"integrity": "sha512-6qN4hJdMwfYBtE3YBTTHhoeuUrDBPZmbQaxWAqSALV/MeEnR5z1xd8UKud2RAkFoPkmB+hli1TZSnyi84xz1vQ==",
"deprecated": "Use @exodus/bytes instead for a more spec-conformant and faster implementation",
"dev": true,
"license": "MIT",
"dependencies": {
"iconv-lite": "0.6.3"
},
"engines": {
"node": ">=18"
}
},
"node_modules/whatwg-mimetype": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-4.0.0.tgz",
"integrity": "sha512-QaKxh0eNIi2mE9p2vEdzfagOKHCcj1pJ56EEHGQOVxp8r9/iszLUUV7v89x9O1p/T+NlTM5W7jW6+cz4Fq1YVg==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=18"
}
},
"node_modules/whatwg-url": {
"version": "14.2.0",
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-14.2.0.tgz",
"integrity": "sha512-De72GdQZzNTUBBChsXueQUnPKDkg/5A5zp7pFDuQAj5UFoENpiACU0wlCvzpAGnTkj++ihpKwKyYewn/XNUbKw==",
"dev": true,
"license": "MIT",
"dependencies": {
"tr46": "^5.1.0",
"webidl-conversions": "^7.0.0"
},
"engines": {
"node": ">=18"
}
},
"node_modules/which": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
@@ -3854,6 +4522,45 @@
"node": ">=0.10.0"
}
},
"node_modules/ws": {
"version": "8.23.0",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.23.0.tgz",
"integrity": "sha512-wCkmX8QMOrKjgO8HW2WyDbTSGeqkocxgDzS9iR79rEAexty6/2qzilx3Ag8Tqf9ykop3irLKle0MtVn5qjVnoQ==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=10.0.0"
},
"peerDependencies": {
"bufferutil": "^4.0.1",
"utf-8-validate": ">=5.0.2"
},
"peerDependenciesMeta": {
"bufferutil": {
"optional": true
},
"utf-8-validate": {
"optional": true
}
}
},
"node_modules/xml-name-validator": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-5.0.0.tgz",
"integrity": "sha512-EvGK8EJ3DhaHfbRlETOWAS5pO9MZITeauHKJyb8wyajUfQUenkIg2MvLDTZ4T/TgIcm3HU0TFBgWWboAZ30UHg==",
"dev": true,
"license": "Apache-2.0",
"engines": {
"node": ">=18"
}
},
"node_modules/xmlchars": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz",
"integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==",
"dev": true,
"license": "MIT"
},
"node_modules/yallist": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz",
+9 -1
View File
@@ -1,7 +1,7 @@
{
"name": "servicemap-frontend",
"private": true,
"version": "1.6.2",
"version": "1.6.3",
"type": "module",
"scripts": {
"dev": "vite",
@@ -9,23 +9,31 @@
"build": "tsc --noEmit && vite build",
"typecheck": "tsc --noEmit",
"test": "vitest run",
"pretest:e2e": "vite build",
"test:e2e": "playwright test"
},
"dependencies": {
"@fontsource-variable/inter": "^5.3.0",
"@xyflow/react": "^12.8.5",
"elkjs": "^0.12.0",
"lucide-react": "^0.577.0",
"react": "^19.1.1",
"react-dom": "^19.1.1"
},
"devDependencies": {
"@axe-core/playwright": "^4.14.0",
"@eslint/js": "^10.0.1",
"@playwright/test": "^1.57.0",
"@testing-library/dom": "^10.4.2",
"@testing-library/react": "^16.3.3",
"@testing-library/user-event": "^14.6.13",
"@types/react": "^19.1.12",
"@types/react-dom": "^19.1.9",
"@vitejs/plugin-react": "^5.0.2",
"eslint": "^10.11.0",
"eslint-plugin-react-hooks": "^7.1.1",
"globals": "^17.12.0",
"jsdom": "^26.1.0",
"typescript": "^5.9.2",
"typescript-eslint": "^8.70.1",
"vite": "^7.1.5",
+9 -3
View File
@@ -2,19 +2,24 @@ import { defineConfig, devices } from "@playwright/test";
import { join } from "node:path";
import { tmpdir } from "node:os";
// Override when another dev server already holds the default port.
const port = Number(process.env.E2E_PORT ?? 4173);
export default defineConfig({
testDir: "./e2e",
timeout: 30_000,
fullyParallel: false,
// All specs share one server database; run them one at a time.
workers: 1,
reporter: "list",
use: {
baseURL: "http://127.0.0.1:4173",
baseURL: `http://127.0.0.1:${port}`,
trace: "retain-on-failure",
},
projects: [{ name: "chromium", use: { ...devices["Desktop Chrome"] } }],
webServer: {
command: "python -m uvicorn app.main:app --app-dir ../backend --host 127.0.0.1 --port 4173",
url: "http://127.0.0.1:4173/health",
command: `python -m uvicorn app.main:app --app-dir ../backend --host 127.0.0.1 --port ${port}`,
url: `http://127.0.0.1:${port}/health`,
reuseExistingServer: !process.env.CI,
env: {
...process.env,
@@ -22,6 +27,7 @@ export default defineConfig({
SERVICEMAP_STATIC_DIR: "dist",
SERVICEMAP_AUTH_MODE: "disabled",
SERVICEMAP_PROBE_INTERVAL: "0",
SERVICEMAP_DEMO_ENABLED: "1",
},
},
});
+1915 -666
View File
File diff suppressed because it is too large. Load diff
+3 -1
View File
@@ -6,6 +6,7 @@ export type LivingEdgeData = {
signal?: boolean;
selected?: boolean;
route?: { x: number; y: number }[];
dimmed?: boolean;
};
function LivingEdgeView({
@@ -32,6 +33,7 @@ function LivingEdgeView({
`living-edge-${relation}`,
edgeData.selected ? "is-selected" : "",
edgeData.signal ? "has-signal" : "",
edgeData.dimmed ? "is-dimmed" : "",
]
.filter(Boolean)
.join(" ");
@@ -39,7 +41,7 @@ function LivingEdgeView({
return (
<g className="living-edge" aria-hidden="true">
<BaseEdge path={path} markerEnd={markerEnd} className={classes} />
{edgeData.signal && (
{edgeData.signal && !edgeData.dimmed && (
<path d={path} className="living-edge-signal" markerEnd={markerEnd} />
)}
</g>
+46
View File
@@ -0,0 +1,46 @@
import { describe, expect, it } from "vitest";
import { dayLabel, eventMeta, groupActivity, type ActivityEvent } from "./activityView";
const event = (id: string, at: string, type: string, message: string, service?: string): ActivityEvent => ({
id,
created_at: at,
event_type: type,
message,
service_id: service ?? null,
});
describe("activity journal view", () => {
it("collapses a burst of identical events into one row with every service", () => {
const days = groupActivity(
[
event("1", "2026-11-19T21:19:00.100Z", "incident.resolved", "Root cause recovered", "a"),
event("2", "2026-11-19T21:19:00.200Z", "incident.resolved", "Root cause recovered", "b"),
event("3", "2026-11-19T21:19:00.300Z", "incident.resolved", "Root cause recovered", "a"),
event("4", "2026-11-19T21:18:10.000Z", "incident.opened", "Incident opened", "c"),
],
new Date("2026-11-19T22:00:00Z"),
);
expect(days).toHaveLength(1);
expect(days[0].rows).toHaveLength(2);
expect(days[0].rows[0]).toMatchObject({ count: 3, serviceIds: ["a", "b"] });
expect(days[0].rows[1]).toMatchObject({ type: "incident.opened", count: 1 });
});
it("starts a new day group and does not merge across days or minutes", () => {
const days = groupActivity([
event("1", "2026-11-19T10:00:00Z", "topology.changed", "Changed"),
event("2", "2026-11-19T09:58:00Z", "topology.changed", "Changed"),
event("3", "2026-11-17T10:00:00Z", "topology.changed", "Changed"),
]);
expect(days.map((day) => day.rows.length)).toEqual([2, 1]);
});
it("labels days relative to now and humanises unknown event types", () => {
const now = new Date(2026, 10, 19, 12);
expect(dayLabel(new Date(2026, 10, 19, 8), now)).toBe("Vandaag");
expect(dayLabel(new Date(2026, 10, 18, 23), now)).toBe("Gisteren");
expect(eventMeta("incident.opened")).toEqual({ label: "Incident geopend", tone: "bad" });
expect(eventMeta("backup.created_ok").label).toBe("Backup created ok");
});
});
+95
View File
@@ -0,0 +1,95 @@
import { dayKey, formatDay, formatTime } from "./labels";
export type ActivityEvent = {
id: string;
created_at: string;
event_type: string;
message: string;
service_id?: string | null;
};
export type ActivityTone = "ok" | "warn" | "bad" | "maint" | "accent" | "neutral";
export type ActivityRow = {
id: string;
type: string;
message: string;
createdAt: string;
serviceIds: string[];
count: number;
};
export type ActivityDay = { key: string; label: string; rows: ActivityRow[] };
const EVENT_LABELS: Record<string, { label: string; tone: ActivityTone }> = {
"incident.opened": { label: "Incident geopend", tone: "bad" },
"incident.resolved": { label: "Incident opgelost", tone: "ok" },
"incident.duplicate_resolved": { label: "Dubbel incident gesloten", tone: "neutral" },
"incident.acknowledged": { label: "Incident bevestigd", tone: "warn" },
"incident.updated": { label: "Impact herberekend", tone: "neutral" },
"incident.note": { label: "Incidentnotitie", tone: "neutral" },
"service.state_changed": { label: "Gezondheid gewijzigd", tone: "neutral" },
"service.runtime_observed": { label: "Runtime waargenomen", tone: "neutral" },
"service.maintenance_changed": { label: "Onderhoud", tone: "maint" },
"topology.changed": { label: "Topologie gewijzigd", tone: "accent" },
"flapping.detected": { label: "Wisselvalligheid vastgesteld", tone: "warn" },
};
/** A readable label and tone for an event type; unknown types are humanised. */
export function eventMeta(type: string): { label: string; tone: ActivityTone } {
const known = EVENT_LABELS[type];
if (known) return known;
const words = type.replace(/[._]+/g, " ").trim();
return { label: words ? words[0].toUpperCase() + words.slice(1) : "Gebeurtenis", tone: "neutral" };
}
export function dayLabel(date: Date, now: Date = new Date()): string {
const today = dayKey(now);
const yesterday = new Date(now);
yesterday.setDate(now.getDate() - 1);
if (dayKey(date) === today) return "Vandaag";
if (dayKey(date) === dayKey(yesterday)) return "Gisteren";
return formatDay(date);
}
export function timeOf(value: string): string {
return formatTime(value);
}
/**
* Groups the journal per calendar day and collapses bursts: consecutive
* events with the same type and message within the same minute become one
* row that lists every affected service.
*/
export function groupActivity(events: ActivityEvent[], now: Date = new Date()): ActivityDay[] {
const days: ActivityDay[] = [];
for (const event of events) {
const date = new Date(event.created_at);
const key = dayKey(date);
let day = days[days.length - 1];
if (!day || day.key !== key) {
day = { key, label: dayLabel(date, now), rows: [] };
days.push(day);
}
const last = day.rows[day.rows.length - 1];
const sameBurst =
last &&
last.type === event.event_type &&
last.message === event.message &&
Math.abs(new Date(last.createdAt).getTime() - date.getTime()) < 60_000;
if (sameBurst) {
last.count += 1;
if (event.service_id && !last.serviceIds.includes(event.service_id)) last.serviceIds.push(event.service_id);
} else {
day.rows.push({
id: event.id,
type: event.event_type,
message: event.message,
createdAt: event.created_at,
serviceIds: event.service_id ? [event.service_id] : [],
count: 1,
});
}
}
return days;
}
+148 -30
View File
@@ -1,3 +1,5 @@
import { SSE_EVENT_TYPES } from "./realtime/refreshPlan";
export type HealthStatus =
| "healthy"
| "degraded"
@@ -198,6 +200,7 @@ export type ServiceSnapshot = {
evidence: RelationEvidence[];
health_evidence: HealthEvidence[];
health_resolution: HealthResolution;
maintenance_until?: string | null;
};
export type ServiceSource = {
@@ -485,6 +488,7 @@ export type OverviewSummary = {
export type DemoState = {
active: boolean;
enabled: boolean;
synthetic: boolean;
scenario_name: string | null;
service_count: number;
@@ -682,37 +686,145 @@ export type ReconcileResult = {
service_ids: string[];
};
let accessToken: string | null = null;
// The admin token is kept per browser tab (sessionStorage): it survives a
// reload but not closing the tab, and never reaches topology config.
const TOKEN_KEY = "servicemap.adminToken";
export const AUTH_REQUIRED_EVENT = "servicemap:auth-required";
function readStoredToken(): string | null {
try {
return window.sessionStorage.getItem(TOKEN_KEY);
} catch {
return null;
}
}
let accessToken: string | null = typeof window === "undefined" ? null : readStoredToken();
/** An optional in-memory OIDC bearer token; never persisted in topology config. */
export function setApiAccessToken(token: string | null): void {
accessToken = token?.trim() || null;
try {
if (accessToken) window.sessionStorage.setItem(TOKEN_KEY, accessToken);
else window.sessionStorage.removeItem(TOKEN_KEY);
} catch {
// Storage may be unavailable (private mode); the token stays in memory.
}
}
function requestHeaders(init?: RequestInit): HeadersInit {
return {
"Content-Type": "application/json",
...(accessToken ? { Authorization: `Bearer ${accessToken}` } : {}),
...init?.headers,
};
export function hasApiAccessToken(): boolean {
return accessToken !== null;
}
async function request<T>(url: string, init?: RequestInit): Promise<T> {
const response = await fetch(url, {
headers: requestHeaders(init),
...init,
});
/** An API failure that keeps the HTTP status, e.g. 401 for a locked editor. */
export class ApiError extends Error {
readonly status: number;
constructor(message: string, status: number) {
super(message);
this.name = "ApiError";
this.status = status;
}
}
function errorMessage(detail: unknown, status: number): string {
if (typeof detail === "string" && detail) return detail;
if (Array.isArray(detail)) {
// FastAPI validation errors: [{loc: [...], msg: "..."}]
const parts = detail
.map((item) => {
const entry = item as { loc?: unknown[]; msg?: string };
const field = Array.isArray(entry.loc) ? entry.loc.filter((part) => part !== "body").join(".") : "";
return entry.msg ? (field ? `${field}: ${entry.msg}` : entry.msg) : "";
})
.filter(Boolean);
if (parts.length) return parts.join("; ");
}
return `Verzoek mislukt (${status})`;
}
function requestHeaders(init?: RequestInit, token: string | null = accessToken): Headers {
const headers = new Headers(init?.headers);
if (init?.body !== undefined && !headers.has("Content-Type")) {
headers.set("Content-Type", "application/json");
}
if (token && !headers.has("Authorization")) headers.set("Authorization", `Bearer ${token}`);
return headers;
}
async function request<T>(url: string, init?: RequestInit, token: string | null = accessToken): Promise<T> {
// Spread init first: a caller's headers are merged above, never dropped.
const response = await fetch(url, { ...init, headers: requestHeaders(init, token) });
if (!response.ok) {
const payload = await response.json().catch(() => null);
throw new Error(payload?.detail || `Request failed (${response.status})`);
if (response.status === 401 && token === accessToken && typeof window !== "undefined") {
// The tab's token is missing or no longer valid: forget it and let the
// UI ask for it. Explicit candidate tokens (verifyWriteAccess) don't.
if (accessToken) setApiAccessToken(null);
window.dispatchEvent(new Event(AUTH_REQUIRED_EVENT));
}
throw new ApiError(errorMessage(payload?.detail, response.status), response.status);
}
if (response.status === 204) return undefined as T;
return response.json() as Promise<T>;
}
export type AlertSettings = {
enabled: boolean;
ntfy_server: string;
ntfy_topic: string;
min_severity: Criticality;
delay_seconds: number;
notify_resolved: boolean;
reminder_minutes: number;
public_url: string;
ntfy_token_set?: boolean;
};
export type BackupInfo = {
name: string;
kind: "backup" | "pre-restore";
created_at: string;
size_bytes: number;
};
/** Download a backup with the tab's token (a plain link carries none). */
export async function downloadBackupFile(name: string): Promise<Blob> {
const response = await fetch(`/api/v1/backups/${encodeURIComponent(name)}`, {
headers: requestHeaders(),
});
if (!response.ok) {
const payload = await response.json().catch(() => null);
throw new ApiError(errorMessage(payload?.detail, response.status), response.status);
}
return response.blob();
}
export type ServiceMapMeta = {
version: string;
auth_mode: string;
write_auth?: "none" | "admin_token" | "oidc";
};
export const api = {
alertSettings: () => request<AlertSettings>("/api/v1/settings/alerts"),
/** ``ntfyToken``: undefined keeps the stored token, "" removes it. */
saveAlertSettings: (settings: AlertSettings, ntfyToken?: string) =>
request<AlertSettings>("/api/v1/settings/alerts", {
method: "PUT",
body: JSON.stringify({ ...settings, ntfy_token_set: undefined, ntfy_token: ntfyToken }),
}),
backups: () => request<BackupInfo[]>("/api/v1/backups"),
createBackup: () => request<BackupInfo>("/api/v1/backups", { method: "POST" }),
restoreBackup: (name: string) =>
request<BackupInfo>(`/api/v1/backups/${encodeURIComponent(name)}/restore`, { method: "POST" }),
testAlert: () =>
request<{ ok: boolean; detail: string }>("/api/v1/settings/alerts/test", { method: "POST" }),
meta: () => request<ServiceMapMeta>("/api/v1/meta"),
/** Resolves only when ``token`` may change ServiceMap. */
verifyWriteAccess: (token: string) =>
request<{ ok: boolean }>("/api/v1/auth/verify", { method: "POST" }, token.trim()),
listServices: (includeHidden = false) =>
request<ServiceSnapshot[]>(
`/api/v1/services?include_hidden=${includeHidden}`,
@@ -756,13 +868,27 @@ export const api = {
request<IncidentDetail>(`/api/v1/incidents/${incidentId}/acknowledge`, {
method: "POST",
}),
events: (limit = 50) =>
request<EventRecord[]>(`/api/v1/events?limit=${limit}`),
events: (limit = 50, options: { eventType?: string; before?: string } = {}) => {
const params = new URLSearchParams({ limit: String(limit) });
if (options.eventType) params.set("event_type", options.eventType);
if (options.before) params.set("before", options.before);
return request<EventRecord[]>(`/api/v1/events?${params.toString()}`);
},
resolveIncident: (incidentId: string, note?: string) =>
request<IncidentDetail>(`/api/v1/incidents/${encodeURIComponent(incidentId)}/resolve`, {
method: "POST",
body: JSON.stringify({ note: note || null }),
}),
addIncidentNote: (incidentId: string, text: string) =>
request<IncidentDetail>(`/api/v1/incidents/${encodeURIComponent(incidentId)}/notes`, {
method: "POST",
body: JSON.stringify({ text }),
}),
overview: () => request<OverviewSummary>("/api/v1/overview"),
maintenance: (serviceId: string, enabled: boolean, reason?: string) =>
maintenance: (serviceId: string, enabled: boolean, reason?: string, until?: string | null) =>
request<Service>(`/api/v1/services/${serviceId}/maintenance`, {
method: "POST",
body: JSON.stringify({ enabled, reason }),
body: JSON.stringify({ enabled, reason, until: until ?? null }),
}),
demoState: () => request<DemoState>("/api/v1/demo"),
loadDemo: () =>
@@ -782,7 +908,7 @@ export const api = {
),
exportConfig: async (format: "yaml" | "json") => {
const response = await fetch(`/api/v1/config?format=${format}`, { headers: requestHeaders() });
if (!response.ok) throw new Error(`Export failed (${response.status})`);
if (!response.ok) throw new Error(`Exporteren mislukt (${response.status})`);
return response.text();
},
discoverDocker: (dockerHost: string) =>
@@ -921,17 +1047,9 @@ export function subscribeToEvents(
}
};
source.onmessage = emit;
for (const eventType of [
"probe.completed",
"service.state_changed",
"service.maintenance_changed",
"flapping.detected",
"incident.opened",
"incident.updated",
"incident.acknowledged",
"incident.resolved",
"topology.changed",
]) {
// Named SSE events are only delivered to explicit listeners; a type missing
// here is silently dropped by EventSource.
for (const eventType of SSE_EVENT_TYPES) {
source.addEventListener(eventType, emit);
}
source.onerror = () => onError?.();
+101
View File
@@ -0,0 +1,101 @@
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import {
api,
ApiError,
AUTH_REQUIRED_EVENT,
hasApiAccessToken,
setApiAccessToken,
} from "./api";
function fakeWindow() {
const target = new EventTarget();
const storage = new Map<string, string>();
return Object.assign(target, {
sessionStorage: {
getItem: (key: string) => storage.get(key) ?? null,
setItem: (key: string, value: string) => void storage.set(key, value),
removeItem: (key: string) => void storage.delete(key),
},
storage,
});
}
function json(body: unknown, status = 200): Response {
return new Response(JSON.stringify(body), {
status,
headers: { "Content-Type": "application/json" },
});
}
describe("admin token handling", () => {
let win: ReturnType<typeof fakeWindow>;
beforeEach(() => {
win = fakeWindow();
vi.stubGlobal("window", win);
});
afterEach(() => {
setApiAccessToken(null);
vi.unstubAllGlobals();
});
it("keeps the token per tab and sends it with every request", async () => {
const fetchMock = vi.fn().mockResolvedValue(json([]));
vi.stubGlobal("fetch", fetchMock);
setApiAccessToken(" token-value ");
expect(hasApiAccessToken()).toBe(true);
expect(win.storage.get("servicemap.adminToken")).toBe("token-value");
await api.listServices();
const headers = fetchMock.mock.calls[0][1].headers as Headers;
expect(headers.get("Authorization")).toBe("Bearer token-value");
// A GET without a body sends no JSON Content-Type (no CORS preflight).
expect(headers.has("Content-Type")).toBe(false);
});
it("forgets a rejected token and asks the UI to unlock again", async () => {
vi.stubGlobal(
"fetch",
vi.fn().mockResolvedValue(json({ detail: "Editing requires the ServiceMap admin token" }, 401)),
);
const asked = vi.fn();
win.addEventListener(AUTH_REQUIRED_EVENT, asked);
setApiAccessToken("expired-token");
const failure = await api.deleteService("svc-1").catch((error: unknown) => error);
expect(failure).toBeInstanceOf(ApiError);
expect((failure as ApiError).status).toBe(401);
expect(asked).toHaveBeenCalledTimes(1);
expect(hasApiAccessToken()).toBe(false);
expect(win.storage.has("servicemap.adminToken")).toBe(false);
});
it("verifies a candidate token without touching the stored one", async () => {
const fetchMock = vi.fn().mockResolvedValue(json({ detail: "nope" }, 401));
vi.stubGlobal("fetch", fetchMock);
const asked = vi.fn();
win.addEventListener(AUTH_REQUIRED_EVENT, asked);
setApiAccessToken("current-token");
await expect(api.verifyWriteAccess("candidate")).rejects.toBeInstanceOf(ApiError);
const headers = fetchMock.mock.calls[0][1].headers as Headers;
expect(headers.get("Authorization")).toBe("Bearer candidate");
expect(asked).not.toHaveBeenCalled();
expect(hasApiAccessToken()).toBe(true);
});
it("turns FastAPI validation errors into a readable message", async () => {
vi.stubGlobal(
"fetch",
vi.fn().mockResolvedValue(
json({ detail: [{ loc: ["body", "port"], msg: "Input should be less than or equal to 65535" }] }, 422),
),
);
const failure = (await api.deleteService("svc-1").catch((error: unknown) => error)) as ApiError;
expect(failure.message).toBe("port: Input should be less than or equal to 65535");
expect(failure.status).toBe(422);
});
});
+62
View File
@@ -0,0 +1,62 @@
import { Ellipsis } from "lucide-react";
import { useEffect, useId, useRef, useState, type ReactNode } from "react";
type Props = {
label: string;
children: (close: () => void) => ReactNode;
footer?: ReactNode;
};
/**
* Overflow menu for secondary actions. Items stay ordinary buttons so they
* keep their accessible names; the menu closes on Escape, outside click and
* after an item is used.
*/
export function ActionsMenu({ label, children, footer }: Props) {
const [open, setOpen] = useState(false);
const rootRef = useRef<HTMLDivElement>(null);
const triggerRef = useRef<HTMLButtonElement>(null);
const panelId = useId();
useEffect(() => {
if (!open) return;
const onPointer = (event: PointerEvent) => {
if (!rootRef.current?.contains(event.target as Node)) setOpen(false);
};
const onKey = (event: KeyboardEvent) => {
if (event.key === "Escape") {
setOpen(false);
triggerRef.current?.focus();
}
};
document.addEventListener("pointerdown", onPointer);
document.addEventListener("keydown", onKey);
return () => {
document.removeEventListener("pointerdown", onPointer);
document.removeEventListener("keydown", onKey);
};
}, [open]);
const close = () => setOpen(false);
return (
<div className="actions-menu" ref={rootRef}>
<button
ref={triggerRef}
className="ghost icon-button"
aria-label={label}
aria-expanded={open}
aria-controls={panelId}
onClick={() => setOpen(!open)}
>
<Ellipsis size={18} aria-hidden="true" />
</button>
{open && (
<div className="actions-menu-panel" id={panelId} role="group" aria-label={label}>
{children(close)}
{footer && <div className="actions-menu-footer">{footer}</div>}
</div>
)}
</div>
);
}
@@ -0,0 +1,42 @@
// @vitest-environment jsdom
import { cleanup, fireEvent, render, screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { afterEach, describe, expect, it, vi } from "vitest";
import { ConfirmDialog } from "./ConfirmDialog";
afterEach(cleanup);
function renderDialog(open: boolean, handlers = { onConfirm: vi.fn(), onCancel: vi.fn() }) {
render(
<ConfirmDialog open={open} title="Replace topology?" confirmLabel="Replace" {...handlers}>
<p>This cannot be undone.</p>
</ConfirmDialog>,
);
return handlers;
}
describe("ConfirmDialog", () => {
it("is labelled by its title and description and focuses Cancel", () => {
renderDialog(true);
const dialog = screen.getByRole("dialog", { name: "Replace topology?" });
expect(dialog.getAttribute("aria-describedby")).toBeTruthy();
expect(screen.getByText("This cannot be undone.")).toBeTruthy();
expect(document.activeElement?.textContent).toBe("Annuleren");
});
it("confirms, cancels and treats Escape as cancel", async () => {
const handlers = renderDialog(true);
const user = userEvent.setup();
await user.click(screen.getByRole("button", { name: "Replace" }));
expect(handlers.onConfirm).toHaveBeenCalledTimes(1);
await user.click(screen.getByRole("button", { name: "Annuleren" }));
fireEvent(screen.getByRole("dialog"), new Event("cancel", { cancelable: true }));
expect(handlers.onCancel).toHaveBeenCalledTimes(2);
});
it("renders nothing interactive while closed", () => {
renderDialog(false);
expect(screen.queryByRole("button", { name: "Replace" })).toBeNull();
});
});
+64
View File
@@ -0,0 +1,64 @@
import { useEffect, useId, useRef, type ReactNode } from "react";
type Props = {
open: boolean;
title: string;
children: ReactNode;
confirmLabel: string;
onConfirm: () => void;
onCancel: () => void;
busy?: boolean;
danger?: boolean;
};
/**
* A real modal: the native <dialog> traps focus, makes the page behind it
* inert, closes on Escape and returns focus to the opener when it closes.
*/
export function ConfirmDialog({ open, title, children, confirmLabel, onConfirm, onCancel, busy, danger }: Props) {
const ref = useRef<HTMLDialogElement>(null);
const titleId = useId();
const bodyId = useId();
useEffect(() => {
const dialog = ref.current;
if (!dialog) return;
if (open && !dialog.open) {
if (typeof dialog.showModal === "function") dialog.showModal();
else dialog.setAttribute("open", "");
} else if (!open && dialog.open) {
if (typeof dialog.close === "function") dialog.close();
else dialog.removeAttribute("open");
}
}, [open]);
return (
<dialog
ref={ref}
className="confirm-dialog"
aria-labelledby={titleId}
aria-describedby={bodyId}
onCancel={(event) => {
event.preventDefault();
onCancel();
}}
>
{open && (
<>
<h2 id={titleId}>{title}</h2>
<div id={bodyId} className="confirm-dialog-body">
{children}
</div>
<div className="button-row wrap">
<button className="ghost" onClick={onCancel} autoFocus>
Annuleren
</button>
<button className={danger ? "danger" : "primary"} onClick={onConfirm} disabled={busy}>
{confirmLabel}
</button>
</div>
</>
)}
</dialog>
);
}
+28
View File
@@ -0,0 +1,28 @@
import {
CircleCheck,
CircleDashed,
CircleHelp,
CircleX,
RefreshCw,
TriangleAlert,
Wrench,
type LucideIcon,
} from "lucide-react";
import type { HealthStatus } from "../api";
const ICONS: Record<HealthStatus, LucideIcon> = {
healthy: CircleCheck,
degraded: TriangleAlert,
down: CircleX,
recovering: RefreshCw,
maintenance: Wrench,
unknown: CircleHelp,
unmonitored: CircleDashed,
};
/** Status is never colour alone: this icon always sits next to a text label. */
export function StatusIcon({ status, size = 14 }: { status: HealthStatus; size?: number }) {
const Icon = ICONS[status] ?? CircleHelp;
return <Icon className="status-icon" size={size} strokeWidth={2.25} aria-hidden="true" focusable="false" />;
}
+4 -4
View File
@@ -6,10 +6,10 @@ describe("demo walkthrough", () => {
it("keeps the semantic incident story ordered and compact", () => {
expect(demoWalkthroughSteps).toHaveLength(4);
expect(demoWalkthroughSteps.map((step) => step.title)).toEqual([
"See the infrastructure",
"Follow the data layer",
"Trace the impact",
"Inspect the root cause",
"Bekijk de infrastructuur",
"Volg de datalaag",
"Volg de impact",
"Bekijk de hoofdoorzaak",
]);
});
});
+15 -15
View File
@@ -1,23 +1,23 @@
export const demoWalkthroughSteps = [
{
title: "See the infrastructure",
title: "Bekijk de infrastructuur",
description:
"Start with the semantic domain landscape: Edge, Application and Data.",
"Begin bij het landschap van domeinen: Edge, Application en Data.",
},
{
title: "Follow the data layer",
title: "Volg de datalaag",
description:
"Open Data Platform to compare PostgreSQL with its healthy Redis sibling.",
"Open Data Platform om PostgreSQL te vergelijken met zijn gezonde Redis-buur.",
},
{
title: "Trace the impact",
title: "Volg de impact",
description:
"Follow the dependency path from the unavailable database to affected applications.",
"Volg het afhankelijkheidspad van de onbeschikbare database naar de geraakte applicaties.",
},
{
title: "Inspect the root cause",
title: "Bekijk de hoofdoorzaak",
description:
"Review PostgreSQL direct health, effective health, probe history and downstream impact.",
"Bekijk de directe en effectieve gezondheid van PostgreSQL, de controlegeschiedenis en de impact.",
},
] as const;
@@ -38,15 +38,15 @@ export function DemoWalkthrough({
}: DemoWalkthroughProps) {
const current = demoWalkthroughSteps[step] ?? demoWalkthroughSteps[0];
return (
<section className="demo-walkthrough" aria-label="Demo walkthrough">
<section className="demo-walkthrough" aria-label="Demorondleiding">
<div className="demo-walkthrough-copy">
<span className="eyebrow">
Demo walkthrough · {step + 1} / {demoWalkthroughSteps.length}
Demorondleiding · {step + 1} / {demoWalkthroughSteps.length}
</span>
<strong>{current.title}</strong>
<p>
{current.description} PostgreSQL is the likely root cause affecting{" "}
{affectedCount} downstream services.
{current.description} PostgreSQL is de waarschijnlijke hoofdoorzaak; het raakt{" "}
{affectedCount} afhankelijke services.
</p>
</div>
<div className="demo-walkthrough-actions">
@@ -55,7 +55,7 @@ export function DemoWalkthrough({
onClick={() => onStepChange(Math.max(0, step - 1))}
disabled={step === 0 || busy}
>
Back
Terug
</button>
<button
className="ghost"
@@ -66,10 +66,10 @@ export function DemoWalkthrough({
}
disabled={busy}
>
{step === demoWalkthroughSteps.length - 1 ? "Restart" : "Next"}
{step === demoWalkthroughSteps.length - 1 ? "Opnieuw" : "Volgende"}
</button>
<button onClick={onExit} disabled={busy}>
Exit demo
Demo afsluiten
</button>
</div>
</section>
+4
View File
@@ -0,0 +1,4 @@
declare module "elkjs/lib/elk-worker.min.js?url" {
const url: string;
export default url;
}
+119
View File
@@ -0,0 +1,119 @@
import type { Criticality, HealthStatus } from "./api";
import type { Panel } from "./routing/urlState";
/** The UI speaks Belgian Dutch and shows times in Brussels, whatever the browser says. */
export const LOCALE = "nl-BE";
export const TIME_ZONE = "Europe/Brussels";
export const STATUS_LABELS: Record<HealthStatus, string> = {
healthy: "Gezond",
degraded: "Verminderd",
down: "Uitgevallen",
recovering: "Herstellend",
maintenance: "Onderhoud",
unknown: "Onbekend",
unmonitored: "Niet bewaakt",
};
export const statusText = (status: HealthStatus): string => STATUS_LABELS[status] ?? status;
const CRITICALITY_LABELS: Record<Criticality, string> = {
low: "laag",
medium: "gemiddeld",
high: "hoog",
critical: "kritiek",
};
export const criticalityText = (value: string): string =>
CRITICALITY_LABELS[value as Criticality] ?? value;
const LIFECYCLE_LABELS: Record<string, string> = {
active: "actief",
missing: "ontbrekend",
stale: "verouderd",
retired: "uitgefaseerd",
ignored: "genegeerd",
};
export const lifecycleText = (value: string): string => LIFECYCLE_LABELS[value] ?? value;
export const MONITORING_LABELS: Record<string, string> = {
active_probe: "Actieve controle",
docker_health: "Docker-gezondheid",
appops_observation: "Waargenomen via AppOps",
observed: "Runtime waargenomen",
unmonitored: "Niet bewaakt",
disabled: "Bewaking uitgeschakeld",
};
const PROVIDER_LABELS: Record<string, string> = {
active_probe: "Actieve controle",
docker: "Docker",
appops: "AppOps",
runtime: "Runtime",
manual: "Handmatig",
};
export const providerText = (value: string): string => PROVIDER_LABELS[value] ?? value.replace("_", " ");
const PROVIDER_HEALTH_LABELS: Record<string, string> = {
healthy: "gezond",
degraded: "verminderd",
unavailable: "niet beschikbaar",
unknown: "onbekend",
};
export const providerHealthText = (value: string): string => PROVIDER_HEALTH_LABELS[value] ?? value;
export const PANEL_LABELS: Record<Panel, string> = {
overview: "Overzicht",
topology: "Topologie",
incidents: "Incidenten",
services: "Services",
discovery: "Detectie",
changes: "Wijzigingen",
activity: "Activiteit",
config: "Configuratie",
settings: "Instellingen",
};
const MODE_LABELS: Record<string, string> = {
landscape: "Landschap",
dependencies: "Afhankelijkheden",
impact: "Impact",
};
export const modeText = (mode: string): string => MODE_LABELS[mode] ?? mode;
/** 19-11-2026 21:19:00 in Brussels time. */
export function formatDateTime(value: string | Date): string {
return new Date(value).toLocaleString(LOCALE, { timeZone: TIME_ZONE, dateStyle: "short", timeStyle: "medium" });
}
/** 21:19 in Brussels time. */
export function formatTime(value: string | Date): string {
return new Date(value).toLocaleTimeString(LOCALE, { timeZone: TIME_ZONE, hour: "2-digit", minute: "2-digit" });
}
/** "donderdag 19 november 2026" in Brussels time. */
export function formatDay(value: string | Date): string {
return new Date(value).toLocaleDateString(LOCALE, {
timeZone: TIME_ZONE,
weekday: "long",
day: "numeric",
month: "long",
year: "numeric",
});
}
/** Calendar day in Brussels, as a sortable key. */
export function dayKey(value: string | Date): string {
return new Intl.DateTimeFormat("en-CA", { timeZone: TIME_ZONE, year: "numeric", month: "2-digit", day: "2-digit" }).format(
new Date(value),
);
}
/** 99,5 with a decimal comma. */
export function formatNumber(value: number, digits = 0): string {
return value.toLocaleString(LOCALE, { minimumFractionDigits: digits, maximumFractionDigits: digits });
}
+1
View File
@@ -1,6 +1,7 @@
import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'
import App from './App'
import '@fontsource-variable/inter'
import './styles.css'
createRoot(document.getElementById('root')!).render(
+133
View File
@@ -0,0 +1,133 @@
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import {
createRefreshScheduler,
reconnectDelay,
scopesForEvent,
SSE_EVENT_TYPES,
type RefreshRequest,
} from "./refreshPlan";
describe("scopesForEvent", () => {
it("never reloads discovery for probe or health events", () => {
for (const type of [
"probe.completed",
"service.state_changed",
"health.evidence_changed",
"incident.opened",
"service.maintenance_changed",
]) {
expect(scopesForEvent({ event_type: type })).not.toContain("discovery");
expect(scopesForEvent({ event_type: type })).toContain("core");
}
});
it("reloads discovery only when the topology changes", () => {
expect(scopesForEvent({ event_type: "topology.changed" })).toEqual(["core", "discovery"]);
expect(scopesForEvent({ event_type: "provider.status_changed" })).toEqual(["providers", "core"]);
});
it("falls back to a core refresh for unknown events", () => {
expect(scopesForEvent({ event_type: "something.new" })).toEqual(["core"]);
expect(scopesForEvent({})).toEqual(["core"]);
});
it("listens to every type the backend publishes", () => {
expect(SSE_EVENT_TYPES).toContain("health.evidence_changed");
expect(SSE_EVENT_TYPES).toContain("provider.status_changed");
expect(SSE_EVENT_TYPES).toContain("incident.duplicate_resolved");
});
});
describe("createRefreshScheduler", () => {
beforeEach(() => vi.useFakeTimers());
afterEach(() => vi.useRealTimers());
it("collapses a burst of events into one merged run", async () => {
const runs: RefreshRequest[] = [];
const scheduler = createRefreshScheduler(async (request) => {
runs.push(request);
});
for (let index = 0; index < 40; index += 1) {
scheduler.requestForEvent({ event_type: "probe.completed", service_id: `svc-${index % 3}` });
}
scheduler.requestForEvent({ event_type: "topology.changed" });
await vi.advanceTimersByTimeAsync(300);
expect(runs).toHaveLength(1);
expect([...runs[0].scopes].sort()).toEqual(["core", "discovery", "history"]);
expect([...runs[0].serviceIds].sort()).toEqual(["svc-0", "svc-1", "svc-2"]);
});
it("never overlaps runs and replays requests made during a run once", async () => {
let active = 0;
let maxActive = 0;
const runs: RefreshRequest[] = [];
let release: () => void = () => undefined;
const scheduler = createRefreshScheduler(async (request) => {
active += 1;
maxActive = Math.max(maxActive, active);
runs.push(request);
await new Promise<void>((resolve) => {
release = resolve;
});
active -= 1;
});
scheduler.request(["core"]);
await vi.advanceTimersByTimeAsync(300);
expect(runs).toHaveLength(1);
// Requests while the first run is still in flight.
scheduler.request(["core"]);
scheduler.request(["discovery"]);
await vi.advanceTimersByTimeAsync(5_000);
expect(runs).toHaveLength(1);
release();
await vi.advanceTimersByTimeAsync(300);
expect(runs).toHaveLength(2);
expect([...runs[1].scopes].sort()).toEqual(["core", "discovery"]);
release();
await vi.advanceTimersByTimeAsync(0);
expect(maxActive).toBe(1);
});
it("still runs during a continuous stream thanks to maxWait", async () => {
const run = vi.fn(async () => undefined);
const scheduler = createRefreshScheduler(run, { delayMs: 250, maxWaitMs: 1_000 });
for (let elapsed = 0; elapsed < 1_100; elapsed += 100) {
scheduler.request(["core"]);
await vi.advanceTimersByTimeAsync(100);
}
expect(run).toHaveBeenCalledTimes(1);
});
it("keeps working after a failed run and stops after dispose", async () => {
const run = vi
.fn<(request: RefreshRequest) => Promise<void>>()
.mockRejectedValueOnce(new Error("network"))
.mockResolvedValue(undefined);
const scheduler = createRefreshScheduler(run);
scheduler.request(["core"]);
await vi.advanceTimersByTimeAsync(300);
scheduler.request(["core"]);
await vi.advanceTimersByTimeAsync(300);
expect(run).toHaveBeenCalledTimes(2);
scheduler.dispose();
scheduler.request(["core"]);
await vi.advanceTimersByTimeAsync(300);
expect(run).toHaveBeenCalledTimes(2);
});
});
describe("reconnectDelay", () => {
it("backs off exponentially, caps at 30 s and jitters ±20%", () => {
expect(reconnectDelay(0, () => 0.5)).toBe(1_000);
expect(reconnectDelay(3, () => 0.5)).toBe(8_000);
expect(reconnectDelay(20, () => 0.5)).toBe(30_000);
expect(reconnectDelay(0, () => 0)).toBe(800);
expect(reconnectDelay(0, () => 1)).toBe(1_200);
});
});
+159
View File
@@ -0,0 +1,159 @@
/**
* Event-driven refresh planning.
*
* Every SSE event used to trigger a full reload (services, incidents,
* overview, events, demo, six discovery reads, the semantic topology and the
* selected service's history): about sixteen requests per probe. The server
* event already says what changed, so each event type maps to the smallest
* set of data slices that can be affected, and a single-flight scheduler
* coalesces bursts into one run per slice set.
*/
export type RefreshScope = "core" | "discovery" | "providers" | "history";
export type RealtimeEvent = {
event_type?: unknown;
service_id?: unknown;
};
/** Every event type the backend publishes on the SSE stream. */
export const SSE_EVENT_TYPES = [
"probe.completed",
"service.state_changed",
"service.maintenance_changed",
"flapping.detected",
"health.evidence_changed",
"provider.status_changed",
"incident.opened",
"incident.updated",
"incident.acknowledged",
"incident.resolved",
"incident.duplicate_resolved",
"topology.changed",
] as const;
const CORE: RefreshScope[] = ["core"];
/**
* Data slices an event can affect. ``core`` is the topology/health/incident
* read set; ``history`` only matters for the selected service and is
* resolved by the caller against ``service_id``.
*/
export function scopesForEvent(event: RealtimeEvent): RefreshScope[] {
const type = typeof event.event_type === "string" ? event.event_type : "";
switch (type) {
case "probe.completed":
case "service.state_changed":
case "flapping.detected":
return ["core", "history"];
case "service.maintenance_changed":
case "health.evidence_changed":
return CORE;
case "provider.status_changed":
return ["providers", "core"];
case "topology.changed":
return ["core", "discovery"];
default:
if (type.startsWith("incident.")) return CORE;
// Unknown or future event types: stay correct with a core refresh.
return CORE;
}
}
type Timers = {
setTimeout: (callback: () => void, ms: number) => unknown;
clearTimeout: (handle: unknown) => void;
};
export type RefreshRequest = {
scopes: Set<RefreshScope>;
serviceIds: Set<string>;
};
export type RefreshScheduler = {
/** Queue a refresh; bursts within ``delayMs`` collapse into one run. */
request: (scopes: Iterable<RefreshScope>, serviceId?: string | null) => void;
/** Queue the refresh an SSE event implies. */
requestForEvent: (event: RealtimeEvent) => void;
dispose: () => void;
};
/**
* Single-flight, trailing-debounced scheduler with a maximum wait.
*
* - Requests arriving within ``delayMs`` merge into one run.
* - A continuous stream still runs at least every ``maxWaitMs``.
* - Only one run is in flight; requests made meanwhile are merged and run
* once afterwards, so slow responses can never overlap or arrive out of
* order and overwrite newer state.
*/
export function createRefreshScheduler(
run: (request: RefreshRequest) => Promise<void>,
{
delayMs = 250,
maxWaitMs = 2_000,
timers = globalThis as unknown as Timers,
}: { delayMs?: number; maxWaitMs?: number; timers?: Timers } = {},
): RefreshScheduler {
let pendingScopes = new Set<RefreshScope>();
let pendingServices = new Set<string>();
let timer: unknown;
let firstQueuedAt: number | null = null;
let inFlight = false;
let disposed = false;
const hasPending = () => pendingScopes.size > 0;
const flush = async () => {
timer = undefined;
firstQueuedAt = null;
if (disposed || inFlight || !hasPending()) return;
const request: RefreshRequest = { scopes: pendingScopes, serviceIds: pendingServices };
pendingScopes = new Set();
pendingServices = new Set();
inFlight = true;
try {
await run(request);
} catch {
// ``run`` reports its own errors; the scheduler must keep working.
} finally {
inFlight = false;
if (!disposed && hasPending()) arm();
}
};
const arm = () => {
const now = Date.now();
if (firstQueuedAt === null) firstQueuedAt = now;
if (timer !== undefined) timers.clearTimeout(timer);
const remainingMaxWait = Math.max(0, firstQueuedAt + maxWaitMs - now);
timer = timers.setTimeout(() => void flush(), Math.min(delayMs, remainingMaxWait));
};
const request = (scopes: Iterable<RefreshScope>, serviceId?: string | null) => {
if (disposed) return;
for (const scope of scopes) pendingScopes.add(scope);
if (serviceId) pendingServices.add(serviceId);
// While a run is in flight the merged request is armed when it ends.
if (!inFlight) arm();
};
return {
request,
requestForEvent(event) {
const serviceId = typeof event.service_id === "string" ? event.service_id : null;
request(scopesForEvent(event), serviceId);
},
dispose() {
disposed = true;
if (timer !== undefined) timers.clearTimeout(timer);
timer = undefined;
},
};
}
/** Exponential reconnect delay with ±20% jitter so tabs do not reconnect in lockstep. */
export function reconnectDelay(attempt: number, random: () => number = Math.random): number {
const base = Math.min(1_000 * 2 ** Math.max(0, attempt), 30_000);
return Math.round(base * (0.8 + random() * 0.4));
}
+103 -55
View File
@@ -1,47 +1,74 @@
import { useEffect, useRef } from "react";
import { useEffect, useRef, useState } from "react";
import { subscribeToEvents } from "../api";
import { reconnectDelay, type RealtimeEvent } from "./refreshPlan";
type Options = {
onEvent: () => void;
/** A server event arrived; the payload says what changed. */
onEvent: (event: RealtimeEvent) => void;
/** The stream (re)opened after a gap; anything may have been missed. */
onResync: () => void;
/** Periodic recovery while the stream is unavailable. */
onFallback: () => void;
fallbackIntervalMs?: number;
/** A connection must stay up this long before backoff resets. */
stableAfterMs?: number;
/** A hidden tab keeps its stream this long before disconnecting. */
hiddenGraceMs?: number;
};
export type RealtimeStatus = "connecting" | "live" | "offline";
/**
* Event-driven refresh with bounded recovery when SSE is unavailable.
*
* The fallback is intentionally active only while disconnected. That avoids
* continuously reloading a healthy dashboard every few seconds just because
* it happens to be open in a browser tab.
* - The fallback poll runs only while disconnected and the tab is visible.
* - Reconnects use exponential backoff with jitter; the backoff resets only
* after a connection has been stable, so a proxy that accepts and then
* immediately drops the stream cannot cause a reconnect storm.
* - After any gap (reconnect, or a tab that was hidden long enough to
* disconnect) one resync refresh recovers missed events.
* - Briefly switching tabs keeps the stream: it closes only after
* ``hiddenGraceMs`` hidden, which avoids a reconnect plus a full refresh
* on every tab switch.
*/
export function useRealtimeEvents({
onEvent,
onResync,
onFallback,
fallbackIntervalMs = 60_000,
}: Options): void {
stableAfterMs = 30_000,
hiddenGraceMs = 60_000,
}: Options): RealtimeStatus {
const eventRef = useRef(onEvent);
const resyncRef = useRef(onResync);
const fallbackRef = useRef(onFallback);
const [status, setStatus] = useState<RealtimeStatus>("connecting");
useEffect(() => {
eventRef.current = onEvent;
resyncRef.current = onResync;
fallbackRef.current = onFallback;
}, [onEvent, onFallback]);
}, [onEvent, onResync, onFallback]);
useEffect(() => {
let disposed = false;
let connected = false;
let retryMs = 1_000;
let everOpened = false;
let attempt = 0;
let close: (() => void) | null = null;
let reconnectTimer: number | undefined;
let fallbackTimer: number | undefined;
let stableTimer: number | undefined;
let hiddenTimer: number | undefined;
const stop = () => {
close?.();
close = null;
if (reconnectTimer !== undefined) window.clearTimeout(reconnectTimer);
if (fallbackTimer !== undefined) window.clearInterval(fallbackTimer);
reconnectTimer = undefined;
const clear = (handle: number | undefined, interval = false) => {
if (handle === undefined) return;
if (interval) window.clearInterval(handle);
else window.clearTimeout(handle);
};
const disableFallback = () => {
clear(fallbackTimer, true);
fallbackTimer = undefined;
};
const enableFallback = () => {
@@ -50,60 +77,76 @@ export function useRealtimeEvents({
if (!connected && !document.hidden) fallbackRef.current();
}, fallbackIntervalMs);
};
const disconnect = () => {
close?.();
close = null;
connected = false;
clear(stableTimer);
stableTimer = undefined;
};
const scheduleReconnect = () => {
if (disposed || reconnectTimer !== undefined) return;
const delay = reconnectDelay(attempt);
attempt += 1;
reconnectTimer = window.setTimeout(() => {
reconnectTimer = undefined;
connect();
}, delay);
};
const opened = () => {
if (disposed || connected) return;
connected = true;
setStatus("live");
disableFallback();
clear(stableTimer);
stableTimer = window.setTimeout(() => {
attempt = 0;
}, stableAfterMs);
// The initial page load already fetched everything; any later open
// follows a gap in which events may have been missed.
if (everOpened) resyncRef.current();
everOpened = true;
};
const connect = () => {
if (disposed || document.hidden || typeof EventSource === "undefined") {
connected = false;
if (disposed || document.hidden) return;
disconnect();
if (typeof EventSource === "undefined") {
setStatus("offline");
enableFallback();
return;
}
close?.();
close = subscribeToEvents(
() => {
connected = true;
retryMs = 1_000;
if (fallbackTimer !== undefined) {
window.clearInterval(fallbackTimer);
fallbackTimer = undefined;
}
eventRef.current();
(event) => {
opened();
eventRef.current(event as RealtimeEvent);
},
() => {
if (disposed) return;
connected = false;
close?.();
close = null;
disconnect();
setStatus("offline");
enableFallback();
if (reconnectTimer === undefined) {
reconnectTimer = window.setTimeout(() => {
reconnectTimer = undefined;
retryMs = Math.min(retryMs * 2, 30_000);
connect();
}, retryMs);
}
},
() => {
connected = true;
retryMs = 1_000;
if (fallbackTimer !== undefined) {
window.clearInterval(fallbackTimer);
fallbackTimer = undefined;
}
scheduleReconnect();
},
opened,
);
};
const onVisibility = () => {
if (document.hidden) {
connected = false;
close?.();
close = null;
enableFallback();
} else {
if (fallbackTimer !== undefined) {
window.clearInterval(fallbackTimer);
fallbackTimer = undefined;
}
clear(hiddenTimer);
hiddenTimer = window.setTimeout(() => {
hiddenTimer = undefined;
clear(reconnectTimer);
reconnectTimer = undefined;
disconnect();
setStatus("offline");
}, hiddenGraceMs);
return;
}
clear(hiddenTimer);
hiddenTimer = undefined;
if (!connected && reconnectTimer === undefined) {
attempt = 0;
connect();
eventRef.current();
}
};
@@ -112,7 +155,12 @@ export function useRealtimeEvents({
return () => {
disposed = true;
document.removeEventListener("visibilitychange", onVisibility);
stop();
disconnect();
disableFallback();
clear(reconnectTimer);
clear(hiddenTimer);
};
}, [fallbackIntervalMs]);
}, [fallbackIntervalMs, stableAfterMs, hiddenGraceMs]);
return status;
}
+53
View File
@@ -0,0 +1,53 @@
import { describe, expect, it } from "vitest";
import {
defaultUrlState,
navigationKey,
parseUrlState,
serializeUrlState,
type UrlState,
} from "./urlState";
describe("URL state", () => {
it("round-trips every field and omits defaults", () => {
const state: UrlState = {
...defaultUrlState(),
panel: "services",
serviceId: "svc-1",
incidentId: "inc-9",
snapshotId: "snap-2",
topology: { level: "components", domainId: "commerce", applicationId: "billing" },
filters: { ...defaultUrlState().filters, search: "api gateway", status: "down", environment: "prod" },
};
const hash = serializeUrlState(state);
expect(hash).toBe(
"#/services?service=svc-1&incident=inc-9&snapshot=snap-2&in_domain=commerce&in_app=billing&q=api+gateway&status=down&env=prod",
);
expect(parseUrlState(hash)).toEqual(state);
expect(serializeUrlState(defaultUrlState())).toBe("#/topology");
});
it("falls back to defaults for unknown or hostile input", () => {
expect(parseUrlState("")).toEqual(defaultUrlState());
expect(parseUrlState("#/not-a-panel?service=")).toEqual(defaultUrlState());
const long = parseUrlState(`#/topology?service=${"x".repeat(500)}`);
expect(long.serviceId).toBeNull();
});
it("derives the topology level from the scope parameters", () => {
expect(parseUrlState("#/topology?in_domain=commerce").topology).toEqual({
level: "applications",
domainId: "commerce",
applicationId: null,
});
expect(parseUrlState("#/topology?in_app=billing").topology.level).toBe("components");
});
it("separates navigation from filter changes", () => {
const base = parseUrlState("#/services?service=svc-1");
const filtered = { ...base, filters: { ...base.filters, search: "db" } };
const navigated = { ...base, serviceId: "svc-2" };
expect(navigationKey(filtered)).toBe(navigationKey(base));
expect(navigationKey(navigated)).not.toBe(navigationKey(base));
});
});
+154
View File
@@ -0,0 +1,154 @@
/**
* Shareable URL state for the single-page app.
*
* Hash routing (``#/services?service=…``) works in both deployments without
* a server-side SPA fallback: the Unraid image serves the bundle from
* FastAPI StaticFiles, where a path route would 404 on refresh.
*
* Navigation (workspace, selection, incident, topology level, snapshot)
* creates a history entry so Back/Forward move through it. Filters and the
* search text replace the current entry so Back does not replay keystrokes.
*/
import type { TopologyLocation } from "../topologyNavigation";
export const PANELS = [
"overview",
"topology",
"incidents",
"services",
"discovery",
"changes",
"activity",
"config",
"settings",
] as const;
export type Panel = (typeof PANELS)[number];
export type UrlFilters = {
search: string;
status: string;
monitoring: string;
group: string;
environment: string;
criticality: string;
domain: string;
application: string;
lifecycle: string;
mode: string;
};
export type UrlState = {
panel: Panel;
serviceId: string | null;
edgeId: string | null;
incidentId: string | null;
snapshotId: string | null;
topology: TopologyLocation;
filters: UrlFilters;
};
export const DEFAULT_FILTERS: UrlFilters = {
search: "",
status: "all",
monitoring: "all",
group: "all",
environment: "all",
criticality: "all",
domain: "all",
application: "all",
lifecycle: "all",
mode: "landscape",
};
const FILTER_PARAMS: Record<keyof UrlFilters, string> = {
search: "q",
status: "status",
monitoring: "monitoring",
group: "group",
environment: "env",
criticality: "criticality",
domain: "domain",
application: "application",
lifecycle: "lifecycle",
mode: "mode",
};
export const defaultUrlState = (): UrlState => ({
panel: "topology",
serviceId: null,
edgeId: null,
incidentId: null,
snapshotId: null,
topology: { level: "domains", domainId: null, applicationId: null },
filters: { ...DEFAULT_FILTERS },
});
const isPanel = (value: string): value is Panel => (PANELS as readonly string[]).includes(value);
function bounded(value: string | null, max = 200): string | null {
if (!value) return null;
const trimmed = value.trim();
return trimmed && trimmed.length <= max ? trimmed : null;
}
/** Parse ``#/panel?key=value``; anything unknown falls back to defaults. */
export function parseUrlState(hash: string): UrlState {
const state = defaultUrlState();
const raw = hash.replace(/^#/, "");
const [path, query = ""] = raw.split("?", 2);
const panel = path.replace(/^\/+/, "").split("/")[0];
if (isPanel(panel)) state.panel = panel;
const params = new URLSearchParams(query);
state.serviceId = bounded(params.get("service"));
state.edgeId = bounded(params.get("edge"));
state.incidentId = bounded(params.get("incident"));
state.snapshotId = bounded(params.get("snapshot"));
const domainId = bounded(params.get("in_domain"));
const applicationId = bounded(params.get("in_app"));
if (applicationId) state.topology = { level: "components", domainId, applicationId };
else if (domainId) state.topology = { level: "applications", domainId, applicationId: null };
for (const [key, param] of Object.entries(FILTER_PARAMS) as [keyof UrlFilters, string][]) {
const value = params.get(param);
if (value !== null) state.filters[key] = value.slice(0, 200);
}
return state;
}
/** Serialize to ``#/panel?…``, omitting defaults so links stay short. */
export function serializeUrlState(state: UrlState): string {
const params = new URLSearchParams();
if (state.serviceId) params.set("service", state.serviceId);
if (state.edgeId) params.set("edge", state.edgeId);
if (state.incidentId) params.set("incident", state.incidentId);
if (state.snapshotId) params.set("snapshot", state.snapshotId);
if (state.topology.level !== "domains" && state.topology.domainId)
params.set("in_domain", state.topology.domainId);
if (state.topology.level === "components" && state.topology.applicationId)
params.set("in_app", state.topology.applicationId);
for (const [key, param] of Object.entries(FILTER_PARAMS) as [keyof UrlFilters, string][]) {
if (state.filters[key] !== DEFAULT_FILTERS[key]) params.set(param, state.filters[key]);
}
const query = params.toString();
return `#/${state.panel}${query ? `?${query}` : ""}`;
}
/**
* The part of the state that deserves its own history entry. Two states
* with the same key differ only in filters and replace each other.
*/
export function navigationKey(state: UrlState): string {
return JSON.stringify([
state.panel,
state.serviceId,
state.edgeId,
state.incidentId,
state.snapshotId,
state.topology.level,
state.topology.domainId,
state.topology.applicationId,
]);
}
+518 -197
View File
@@ -1,30 +1,74 @@
:root {
--surface: #091725;
--surface-raised: #0d2033;
--line: #203d59;
--ink-muted: #91a6bf;
--accent: #78a8d5;
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
color: #eef4ff;
background: #07111d;
/* Layered dark theme: each surface one step lighter than the one below. */
--bg: #0f1216;
--surface-1: #151a21;
--surface-2: #1b212a;
--surface-3: #232b36;
--line: #2a333f;
--line-strong: #3b4654;
--text: #e8edf3;
--text-2: #b9c4d0;
--text-3: #8f9cab;
/* One accent for interaction and selection. */
--accent: #5fb0ec;
--accent-strong: #8ccaf7;
--accent-soft: rgba(95, 176, 236, .14);
--accent-line: #2f6390;
--accent-fill: #2a6ea3;
--accent-fill-hover: #3582bd;
/* Status: same meaning everywhere, always paired with an icon or label. */
--ok: #5ad68f;
--ok-line: #2f6b4b;
--ok-bg: #14261d;
--warn: #f2bf4f;
--warn-line: #7a5d22;
--warn-bg: #2a2214;
--bad: #f57f8d;
--bad-line: #7c3a44;
--bad-bg: #2c161b;
--maint: #b3a6e0;
--maint-line: #4d4675;
--maint-bg: #1f1c33;
--unknown: #9aa6b4;
/* Shape and rhythm. */
--radius-sm: 6px;
--radius-md: 10px;
--radius-lg: 14px;
--radius-pill: 999px;
--fs-xs: 11px;
--fs-sm: 12px;
--fs-md: 13px;
--fs-base: 14px;
--fs-lg: 16px;
--fs-xl: 20px;
--fs-2xl: 26px;
font-family: "Inter Variable", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
font-size: var(--fs-base);
color: var(--text);
background: var(--bg);
font-synthesis: none;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
color-scheme: dark;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: radial-gradient(circle at top, #162843 0, #08111f 42%, #050a12 100%); }
body { margin: 0; min-width: 320px; min-height: 100vh; background: radial-gradient(1200px 500px at 50% -10%, var(--surface-1) 0, var(--bg) 70%); }
button, input, select, textarea { font: inherit; }
button { border: 1px solid #355779; border-radius: 11px; padding: 10px 14px; background: #17324f; color: #f4f8ff; cursor: pointer; transition: border-color .15s ease, background .15s ease, transform .15s ease; }
button:hover:not(:disabled) { border-color: #5d84ad; background: #1b3a5c; }
button { border: 1px solid var(--line-strong); border-radius: var(--radius-md); padding: 10px 14px; background: var(--surface-3); color: var(--text); cursor: pointer; transition: border-color .15s ease, background .15s ease, transform .15s ease; }
button:hover:not(:disabled) { border-color: var(--text-3); background: #2a3340; }
button.primary { border-color: var(--accent-fill); background: var(--accent-fill); color: #fff; font-weight: 600; }
button.primary:hover:not(:disabled) { border-color: var(--accent-fill-hover); background: var(--accent-fill-hover); }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { cursor: wait; opacity: .6; }
button.ghost { background: #0b1a2b; }
button.danger { color: #ffb1ba; border-color: #6d3944; background: #29151c; }
button.text-button { padding: 0; border: 0; background: transparent; color: #8da9c9; font-size: 12px; }
input, select, textarea { width: 100%; margin-top: 6px; border: 1px solid #29435f; border-radius: 10px; padding: 10px 11px; color: #eef4ff; background: #0a1625; outline: none; }
textarea { min-height: 270px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: #638ab4; box-shadow: 0 0 0 3px rgba(99, 138, 180, .12); }
label { color: #98abc3; font-size: 13px; }
button:disabled { cursor: not-allowed; opacity: .6; }
button.ghost { background: var(--surface-1); }
button.ghost:hover:not(:disabled) { background: var(--surface-2); }
button.danger { color: var(--bad); border-color: var(--bad-line); background: var(--bad-bg); }
button.text-button { padding: 0; border: 0; background: transparent; color: var(--text-3); font-size: var(--fs-sm); }
input, select, textarea { width: 100%; margin-top: 6px; border: 1px solid var(--line); border-radius: var(--radius-md); padding: 10px 11px; color: var(--text); background: var(--surface-1); }
textarea { min-height: 270px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: var(--fs-sm); line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px rgba(95, 176, 236, .55); }
label { color: var(--text-3); font-size: var(--fs-md); }
fieldset { min-width: 0; }
.shell { width: min(1540px, calc(100% - 40px)); margin: 0 auto; padding: 26px 0 42px; }
@@ -34,153 +78,193 @@ fieldset { min-width: 0; }
.brand-lockup img { width: 38px; height: 38px; }
.toolbar, .button-row { display: flex; align-items: center; gap: 9px; }
.button-row.wrap { flex-wrap: wrap; }
.eyebrow, .kicker { text-transform: uppercase; letter-spacing: .14em; font-size: 11px; color: #87a1c2; }
.eyebrow, .kicker { text-transform: uppercase; letter-spacing: .08em; font-weight: 600; font-size: var(--fs-xs); color: var(--text-3); }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 27px; letter-spacing: -.02em; }
h1 small { color: #7e97b7; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
h1 { margin-bottom: 0; font-size: var(--fs-2xl); letter-spacing: -.02em; }
h1 small { color: var(--text-3); font-size: var(--fs-sm); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
h2 { max-width: 760px; margin-bottom: 9px; font-size: clamp(29px, 3.6vw, 46px); line-height: 1.04; letter-spacing: -.035em; }
h3 { margin: 6px 0 12px; font-size: 22px; letter-spacing: -.02em; }
.hero { margin-bottom: 12px; padding: 14px 18px; border: 1px solid #1f3550; border-radius: 14px; background: linear-gradient(135deg, rgba(14, 30, 51, .92), rgba(9, 21, 36, .86)); }
.operations-strip { display: flex; align-items: center; justify-content: space-between; gap: 22px; margin-bottom: 12px; padding: 12px 16px; border: 1px solid #1f3550; border-radius: 14px; background: #0b1b2e; }
h3 { margin: 6px 0 12px; font-size: var(--fs-xl); letter-spacing: -.02em; }
.hero { margin-bottom: 12px; padding: 14px 18px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: linear-gradient(135deg, rgba(21, 26, 33, .92), rgba(21, 26, 33, .86)); }
.operations-strip { display: flex; align-items: center; justify-content: space-between; gap: 22px; margin-bottom: 12px; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface-1); }
.operations-strip > div:first-child { display: grid; gap: 3px; }
.operations-strip strong { font-size: 16px; }
.operations-strip small { color: #8fa6c2; font-size: 12px; }
.operations-strip strong { font-size: var(--fs-lg); }
.operations-strip small { color: var(--text-3); font-size: var(--fs-sm); }
.canvas-card { position: relative; }
.canvas-toolbar { position: absolute; z-index: 5; top: 10px; right: 10px; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; max-width: calc(100% - 20px); pointer-events: none; }
.canvas-toolbar > * { pointer-events: auto; }
.canvas-note { padding: 4px 10px; border-radius: var(--radius-pill); background: rgba(21, 26, 33, .9); border: 1px solid var(--line); color: var(--text-2); font-size: var(--fs-sm); }
.service-row-wrap { display: flex; align-items: center; gap: 8px; }
.service-row-wrap > input[type="checkbox"] { flex: 0 0 auto; width: 16px; height: 16px; }
.service-row-wrap > .service-table-row, .service-row-wrap > .service-table-head { flex: 1 1 auto; }
.bulk-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-2); }
.checkbox-field { display: inline-flex; align-items: center; gap: 6px; }
.inline-form { display: grid; gap: 8px; margin-top: 10px; }
.inline-form label { display: grid; gap: 4px; }
.activity-list { list-style: none; margin: 12px 0; padding: 0; display: grid; gap: 6px; }
.activity-list li { display: grid; grid-template-columns: 150px minmax(140px, 220px) 1fr auto; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-1); font-size: var(--fs-md); }
.activity-type { color: var(--text-3); font-family: ui-monospace, monospace; font-size: var(--fs-sm); }
@media (max-width: 760px) { .activity-list li { grid-template-columns: 1fr; } }
.backup-list { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 6px; max-width: 640px; }
.backup-list li { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-1); }
.backup-list li > span { flex: 1; display: grid; }
.backup-list small { color: var(--text-3); font-size: var(--fs-sm); }
.settings-form { display: grid; gap: 12px; max-width: 560px; }
.settings-form label { display: grid; gap: 4px; }
.settings-form small { color: var(--text-3); font-size: var(--fs-sm); }
.unlock-panel { display: grid; gap: 8px; max-width: 560px; margin: 0 0 12px auto; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface-1); }
.unlock-panel label { display: grid; gap: 4px; font-weight: 600; }
.unlock-panel small { color: var(--text-3); font-size: var(--fs-sm); }
.unlock-panel code { font-size: var(--fs-xs); }
.unlock-error { color: var(--bad); font-size: var(--fs-md); }
.unlock-actions { display: flex; gap: 8px; }
.live-status { margin-left: 8px; padding: 1px 8px; border-radius: var(--radius-pill); font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0; text-transform: none; }
.live-status-live { color: var(--ok); background: rgba(34, 197, 94, .12); }
.live-status-connecting { color: var(--text-2); background: rgba(95, 176, 236, .14); }
.live-status-offline { color: var(--warn); background: rgba(251, 191, 36, .14); }
.compact-hero { align-items: center; }
.compact-hero h2 { margin: 3px 0; font-size: clamp(20px, 2vw, 28px); }
.compact-hero .kicker { margin-bottom: 3px; }
.compact-hero .muted { font-size: 12px; line-height: 1.4; }
.compact-hero .muted { font-size: var(--fs-sm); line-height: 1.4; }
.demo-mode .hero { margin-bottom: 10px; padding: 18px 22px; }
.demo-mode .hero h2 { max-width: 650px; font-size: clamp(28px, 3vw, 39px); }
.muted { max-width: 760px; margin-bottom: 0; color: #91a4bd; line-height: 1.55; }
.muted.compact { margin-top: 10px; font-size: 13px; }
.error-banner, .notice-banner { margin-bottom: 14px; padding: 11px 13px; border-radius: 11px; }
.error-banner { border: 1px solid #7b3842; background: #35151c; color: #ffd7dc; }
.notice-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid #315d56; background: #102b28; color: #c8eee5; }
.demo-banner, .demo-confirm { align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 14px; padding: 14px 16px; border-radius: 14px; }
.demo-banner { display: grid; grid-template-columns: minmax(0, 1fr) auto; border: 1px solid #755d2b; background: linear-gradient(110deg, #2a2515, #16251f); }
.muted { max-width: 760px; margin-bottom: 0; color: var(--text-3); line-height: 1.55; }
.muted.compact { margin-top: 10px; font-size: var(--fs-md); }
.error-banner, .notice-banner { margin-bottom: 14px; padding: 11px 13px; border-radius: var(--radius-md); }
.error-banner { border: 1px solid var(--bad-line); background: var(--bad-bg); color: var(--bad); }
.notice-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid var(--ok-line); background: var(--ok-bg); color: var(--ok); }
.demo-banner, .demo-confirm { align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 14px; padding: 14px 16px; border-radius: var(--radius-lg); }
.demo-banner { display: grid; grid-template-columns: minmax(0, 1fr) auto; border: 1px solid var(--warn-line); background: linear-gradient(110deg, var(--warn-bg), var(--ok-bg)); }
.demo-confirm { display: flex; }
.demo-confirm { border: 1px solid #496d91; background: #0e2338; }
.demo-banner strong, .demo-confirm strong { display: block; margin-top: 4px; color: #fff2c9; font-size: 16px; }
.demo-confirm strong { color: #dcecff; }
.demo-banner p, .demo-confirm p { margin: 4px 0 0; color: #b6c4ba; font-size: 13px; line-height: 1.45; }
.demo-confirm p { color: #a9bdd2; }
.demo-confirm { border: 1px solid var(--line-strong); background: var(--surface-2); }
.demo-banner strong, .demo-confirm strong { display: block; margin-top: 4px; color: var(--warn); font-size: var(--fs-lg); }
.demo-confirm strong { color: var(--text); }
.demo-banner p, .demo-confirm p { margin: 4px 0 0; color: var(--text-2); font-size: var(--fs-md); line-height: 1.45; }
.demo-confirm p { color: var(--text-2); }
.demo-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 8px; flex-wrap: wrap; }
.demo-walkthrough { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 12px; border-top: 1px solid #66562d; }
.demo-walkthrough { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 12px; border-top: 1px solid var(--warn-line); }
.demo-walkthrough-copy { min-width: 0; }
.demo-walkthrough-copy strong { font-size: 14px; }
.demo-walkthrough-copy strong { font-size: var(--fs-base); }
.demo-walkthrough-copy p { max-width: 700px; }
.demo-walkthrough-actions { display: flex; flex: 0 0 auto; gap: 8px; flex-wrap: wrap; }
.health-summary { display: grid; grid-template-columns: repeat(4, minmax(64px, 1fr)); gap: 6px; min-width: 300px; }
.health-summary div, .incident-metrics div { padding: 9px; border: 1px solid #233d5a; border-radius: 10px; background: #0a1828; }
.health-summary strong, .incident-metrics strong { display: block; font-size: 20px; }
.health-summary span, .incident-metrics span { color: #8198b3; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.health-summary div, .incident-metrics div { padding: 9px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-1); }
.health-summary strong, .incident-metrics strong { display: block; font-size: var(--fs-xl); }
.health-summary span, .incident-metrics span { color: var(--text-3); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .08em; }
.panel-tabs { display: flex; gap: 7px; margin-bottom: 12px; overflow-x: auto; }
.panel-tabs button { flex: 0 0 auto; padding: 8px 12px; border-color: #203a56; background: #091726; color: #90a5bf; }
.panel-tabs button.active { border-color: #557da8; background: #142a43; color: #eef6ff; }
.panel-tabs button { flex: 0 0 auto; padding: 8px 12px; border-color: var(--line); background: var(--surface-1); color: var(--text-3); }
.panel-tabs button:hover:not(:disabled) { color: var(--text); }
.panel-tabs button.active { border-color: var(--accent-line); background: var(--accent-soft); color: var(--text); font-weight: 600; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-items: start; }
.topology-workspace:has(.topology-drawer) { grid-template-columns: minmax(0, 1fr) minmax(330px, 380px); }
.demo-mode .canvas-card { min-height: 480px; height: min(620px, calc(100vh - 360px)); }
.canvas-card { min-height: 500px; height: min(700px, calc(100vh - 370px)); overflow: hidden; border: 1px solid #203754; border-radius: 16px; background: #08131f; box-shadow: 0 26px 90px rgba(0,0,0,.28); }
.empty-state { height: 100%; min-height: 620px; display: grid; place-content: center; gap: 8px; padding: 30px; text-align: center; color: #8fa4be; }
.empty-state strong { color: #eaf3ff; font-size: 22px; }
.canvas-card { min-height: 500px; height: min(700px, calc(100vh - 370px)); overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--bg); box-shadow: 0 26px 90px rgba(0,0,0,.28); }
.empty-state { height: 100%; min-height: 620px; display: grid; place-content: center; gap: 8px; padding: 30px; text-align: center; color: var(--text-3); }
.empty-state strong { color: var(--text); font-size: var(--fs-xl); }
.side-panel { display: grid; min-width: 0; align-content: start; gap: 12px; height: min(700px, calc(100vh - 370px)); min-height: 500px; overflow-x: hidden; overflow-y: auto; padding-right: 2px; }
.topology-drawer { position: sticky; top: 14px; border-left: 1px solid #203754; padding-left: 14px; }
.panel-section { min-width: 0; padding: 19px; border: 1px solid #203754; border-radius: 18px; background: rgba(8, 20, 34, .95); box-shadow: 0 18px 50px rgba(0,0,0,.18); }
.topology-drawer { position: sticky; top: 14px; border-left: 1px solid var(--line); padding-left: 14px; }
.panel-section { min-width: 0; padding: 19px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: rgba(21, 26, 33, .95); box-shadow: 0 18px 50px rgba(0,0,0,.18); }
.form-section { padding: 0; }
.form-section summary { padding: 16px 19px; cursor: pointer; list-style: none; }
.form-section summary::-webkit-details-marker { display: none; }
.form-section summary::after { content: '+'; color: #7f99b7; font-size: 18px; }
.form-section summary::after { content: '+'; color: var(--text-3); font-size: var(--fs-lg); }
.form-section[open] summary::after { content: '−'; }
.form-section .service-form { padding: 0 19px 19px; }
.tall-panel { min-height: 520px; }
.service-form { display: grid; gap: 13px; margin-top: 13px; }
.field-row { display: grid; grid-template-columns: 1fr 105px; gap: 10px; }
.semantic-fields { display: grid; gap: 9px; margin: 4px 0; padding: 10px; border: 1px solid #284563; border-radius: 10px; }
.semantic-fields legend { padding: 0 5px; color: #89a8c9; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.semantic-fields { display: grid; gap: 9px; margin: 4px 0; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius-md); }
.semantic-fields legend { padding: 0 5px; color: var(--text-3); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .08em; }
.semantic-fields .field-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.semantic-fields .muted { align-self: end; font-size: 11px; }
.dependency-fieldset { display: grid; gap: 7px; margin: 0; padding: 11px; border: 1px solid #263d57; border-radius: 11px; max-height: 150px; overflow-y: auto; }
.dependency-fieldset legend { padding: 0 5px; color: #8197b2; font-size: 12px; }
.semantic-fields .muted { align-self: end; font-size: var(--fs-xs); }
.dependency-fieldset { display: grid; gap: 7px; margin: 0; padding: 11px; border: 1px solid var(--line); border-radius: var(--radius-md); max-height: 150px; overflow-y: auto; }
.dependency-fieldset legend { padding: 0 5px; color: var(--text-3); font-size: var(--fs-sm); }
.check-row { display: flex; align-items: center; gap: 8px; }
.check-row input { width: auto; margin: 0; }
.inspector-section { min-height: 280px; }
.observation-callout { border: 1px solid #31576c; background: #102433; color: #b7d9e8; }
.root-cause-label { display: inline-block; margin-top: 2px; color: #ffd27c; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.inspector-callout { display: grid; gap: 5px; margin: 13px 0; padding: 11px 12px; border-radius: 10px; font-size: 12px; line-height: 1.4; }
.inspector-callout strong { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.inspector-callout span, .inspector-callout small { color: #b7c8d9; }
.root-cause-callout { border: 1px solid #80622f; background: #2a2517; color: #ffe7a2; }
.impacted-callout { border: 1px solid #6a4f2a; background: #241f16; color: #f2c977; }
.observation-callout { border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text-2); }
.root-cause-label { display: inline-block; margin-top: 2px; color: var(--warn); font-size: var(--fs-xs); letter-spacing: .08em; text-transform: uppercase; }
.inspector-callout { display: grid; gap: 5px; margin: 13px 0; padding: 11px 12px; border-radius: var(--radius-md); font-size: var(--fs-sm); line-height: 1.4; }
.inspector-callout strong { font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: .06em; }
.inspector-callout span, .inspector-callout small { color: var(--text-2); }
.root-cause-callout { border: 1px solid var(--warn-line); background: var(--warn-bg); color: var(--warn); }
.impacted-callout { border: 1px solid var(--warn-line); background: var(--warn-bg); color: var(--warn); }
.inspector dl { display: grid; gap: 8px; margin: 15px 0; }
.inspector dl div { display: grid; grid-template-columns: 125px minmax(0, 1fr); gap: 9px; }
dt { color: #7f94ae; font-size: 12px; }
dd { margin: 0; overflow-wrap: anywhere; color: #dce8f7; font-size: 12px; }
.probe-detail { padding: 10px; border-radius: 9px; background: #0a1625; color: #9db0c8; font-size: 12px; line-height: 1.45; }
.health-pill { display: inline-flex; padding: 5px 9px; border-radius: 999px; border: 1px solid currentColor; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; white-space: nowrap; }
.status-healthy { color: #7ee2ac !important; }
.status-degraded { color: #ffd27c !important; }
.status-down { color: #ff929e !important; }
.status-unknown { color: #9aabc0 !important; }
.status-unmonitored { color: #87a9c4 !important; }
.history-strip { display: flex; align-items: flex-end; gap: 4px; min-height: 24px; margin: 13px 0; padding: 7px 8px; border-radius: 9px; background: #08131f; overflow-x: auto; }
.history-dot { flex: 0 0 8px; width: 8px; height: 18px; border-radius: 4px; background: currentColor; opacity: .85; }
dt { color: var(--text-3); font-size: var(--fs-sm); }
dd { margin: 0; overflow-wrap: anywhere; color: var(--text); font-size: var(--fs-sm); }
.probe-detail { padding: 10px; border-radius: var(--radius-md); background: var(--surface-1); color: var(--text-2); font-size: var(--fs-sm); line-height: 1.45; }
.health-pill { display: inline-flex; padding: 5px 9px; border-radius: var(--radius-pill); border: 1px solid currentColor; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .08em; white-space: nowrap; }
.status-healthy { color: var(--ok) !important; }
.status-degraded { color: var(--warn) !important; }
.status-down { color: var(--bad) !important; }
.status-unknown { color: var(--text-3) !important; }
.status-unmonitored { color: var(--text-3) !important; }
.history-strip { display: flex; align-items: flex-end; gap: 4px; min-height: 24px; margin: 13px 0; padding: 7px 8px; border-radius: var(--radius-md); background: var(--bg); overflow-x: auto; }
.history-dot { flex: 0 0 8px; width: 8px; height: 18px; border-radius: var(--radius-sm); background: currentColor; opacity: .85; }
.incident-metrics { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; margin: 15px 0; }
.candidate-list, .docker-list { display: grid; gap: 9px; margin-top: 14px; }
.candidate { width: 100%; display: grid; gap: 5px; text-align: left; background: #0a1727; }
.candidate strong { font-size: 15px; }
.candidate small, .docker-card small { color: #8196af; line-height: 1.4; overflow-wrap: anywhere; }
.candidate { width: 100%; display: grid; gap: 5px; text-align: left; background: var(--surface-1); }
.candidate strong { font-size: var(--fs-base); }
.candidate small, .docker-card small { color: var(--text-3); line-height: 1.4; overflow-wrap: anywhere; }
.config-label { display: grid; gap: 4px; margin: 14px 0; }
.full-button { width: 100%; margin-top: 11px; }
.docker-card { display: grid; gap: 7px; padding: 12px; border: 1px solid #243c57; border-radius: 12px; background: #0a1727; }
.docker-card { display: grid; gap: 7px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-1); }
.docker-card > div { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.docker-card > div span { color: #85a0be; font-size: 11px; }
.empty-inline { padding: 18px 0 8px; color: #8094ad; font-size: 13px; }
.docker-card > div span { color: var(--text-3); font-size: var(--fs-xs); }
.empty-inline { padding: 18px 0 8px; color: var(--text-3); font-size: var(--fs-md); }
.react-flow__node { min-width: 165px; border: 1px solid #36587e !important; background: #10233a !important; color: #edf6ff !important; border-radius: 13px !important; padding: 0 !important; box-shadow: 0 10px 30px rgba(0,0,0,.25); font-size: 12px; }
.react-flow__node { min-width: 165px; border: 1px solid var(--line-strong) !important; background: var(--surface-2) !important; color: var(--text) !important; border-radius: var(--radius-lg) !important; padding: 0 !important; box-shadow: 0 10px 30px rgba(0,0,0,.25); font-size: var(--fs-sm); }
.react-flow__node.service-node { min-width: 198px; overflow: visible; }
.react-flow__node.application-node { min-width: 226px; border-radius: 15px !important; }
.application-node .service-node-body { min-height: 122px; background: linear-gradient(145deg, rgba(21, 51, 76, .88), rgba(12, 29, 47, .96)); }
.scope-label { display: block; margin: 8px 0 4px; color: #91a8c2; font-size: 11px; }
.node-kicker { color: #7fb6dd; font-size: 9px; letter-spacing: .1em; text-transform: uppercase; }
.react-flow__node.service-node .react-flow__handle { width: 8px; height: 8px; border: 2px solid #9bb5d1; background: #173552; }
.service-node-body { display: grid; gap: 4px; min-height: 108px; padding: 12px 14px; border-radius: 12px; }
.service-node-body strong { overflow-wrap: anywhere; font-size: 14px; line-height: 1.15; }
.service-node-body small { color: #91a8c2; font-size: 10px; }
.react-flow__node.application-node { min-width: 226px; border-radius: var(--radius-lg) !important; }
.application-node .service-node-body { min-height: 122px; background: linear-gradient(145deg, rgba(21, 26, 33, .88), rgba(21, 26, 33, .96)); }
.scope-label { display: block; margin: 8px 0 4px; color: var(--text-3); font-size: var(--fs-xs); }
.node-kicker { color: var(--accent); font-size: var(--fs-xs); letter-spacing: .1em; text-transform: uppercase; }
.react-flow__node.service-node .react-flow__handle { width: 8px; height: 8px; border: 2px solid var(--line-strong); background: var(--surface-3); }
.service-node-body { display: grid; gap: 4px; min-height: 108px; padding: 12px 14px; border-radius: var(--radius-md); }
.service-node-body strong { overflow-wrap: anywhere; font-size: var(--fs-base); line-height: 1.15; }
.service-node-body small { color: var(--text-3); font-size: var(--fs-xs); }
.node-badges { min-height: 15px; }
.node-badge { display: inline-flex; padding: 2px 5px; border-radius: 4px; font-size: 9px; font-weight: 700; letter-spacing: .08em; }
.node-badge { display: inline-flex; padding: 2px 5px; border-radius: var(--radius-sm); font-size: var(--fs-xs); font-weight: 700; letter-spacing: .08em; }
.app-micro-topology { display: flex; gap: 4px; margin: 6px 0 2px; }
.app-micro-topology i { display: grid; width: 16px; height: 16px; place-items: center; border: 1px solid #416181; border-radius: 50%; color: #b7d9f4; background: #102842; font-size: 8px; font-style: normal; font-weight: 800; }
.app-micro-topology i.role-database, .app-micro-topology i.role-cache, .app-micro-topology i.role-storage { border-radius: 4px; background: #19353c; }
.app-micro-topology i.role-proxy, .app-micro-topology i.role-api { border-radius: 3px; background: #29395c; }
.root-cause-badge { background: #825f25; color: #ffe8a3; }
.impacted-badge { background: #68452a; color: #ffd69b; }
.node-status { width: fit-content; font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.react-flow__node.service-node:has(.root-cause-badge) { border-color: #d39b38 !important; box-shadow: 0 0 0 2px rgba(211,155,56,.28), 0 12px 36px rgba(211,155,56,.2); }
.react-flow__node.selected { outline: 2px solid #dcecff; outline-offset: 3px; }
.react-flow__node.status-healthy { border-color: #3b8c67 !important; box-shadow: 0 10px 34px rgba(47,128,90,.12); }
.react-flow__node.status-degraded { border-color: #9a7330 !important; box-shadow: 0 10px 34px rgba(154,115,48,.12); }
.react-flow__node.status-down { border-color: #9b414d !important; box-shadow: 0 10px 34px rgba(155,65,77,.14); }
.react-flow__node.status-unmonitored { border-color: #466a86 !important; box-shadow: none; }
.react-flow__edge-path { stroke: #668ab3; stroke-width: 2; }
.living-edge-path { fill: none; stroke: #668ab3; stroke-width: 2; transition: stroke .18s ease, stroke-width .18s ease, opacity .18s ease; }
.living-edge-routes_to { stroke: #82a9cf; stroke-dasharray: 8 4; }
.living-edge-review { stroke: #58718c; stroke-dasharray: 3 6; opacity: .68; }
.living-edge-path.is-selected { stroke: #d5ebff; stroke-width: 3.2; }
.living-edge-signal { fill: none; stroke: #bde6ff; stroke-width: 3.2; stroke-linecap: round; stroke-dasharray: 2 20; animation: servicemap-edge-signal 1.7s linear infinite; filter: drop-shadow(0 0 3px rgba(143, 211, 255, .8)); }
.edge-down .living-edge-path { stroke: #b55967; }
.edge-degraded .living-edge-path { stroke: #b08a45; }
.edge-down .living-edge-signal, .edge-degraded .living-edge-signal { stroke: #ffd17b; }
.app-micro-topology i { display: grid; width: 16px; height: 16px; place-items: center; border: 1px solid var(--line-strong); border-radius: 50%; color: var(--text-2); background: var(--surface-3); font-size: var(--fs-xs); font-style: normal; font-weight: 800; }
.app-micro-topology i.role-database, .app-micro-topology i.role-cache, .app-micro-topology i.role-storage { border-radius: var(--radius-sm); background: var(--ok-bg); }
.app-micro-topology i.role-proxy, .app-micro-topology i.role-api { border-radius: var(--radius-sm); background: var(--line-strong); }
.root-cause-badge { background: var(--warn-line); color: var(--warn); }
.impacted-badge { background: var(--warn-line); color: var(--warn); }
.node-status { width: fit-content; font-size: var(--fs-xs); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.react-flow__node.service-node:has(.root-cause-badge) { border-color: var(--warn-line) !important; box-shadow: 0 0 0 2px rgba(211,155,56,.28), 0 12px 36px rgba(211,155,56,.2); }
.react-flow__node.selected { outline: 2px solid var(--accent); outline-offset: 3px; }
/* Root-cause nodes are pre-selected by the graph; mark them as root cause, not as the operator's selection. */
.react-flow__node.selected:has(.root-cause-badge) { outline-color: var(--warn); }
.react-flow__node.status-healthy { border-color: var(--ok-line) !important; box-shadow: 0 10px 34px rgba(47,128,90,.12); }
.react-flow__node.status-degraded { border-color: var(--warn-line) !important; box-shadow: 0 10px 34px rgba(154,115,48,.12); }
.react-flow__node.status-down { border-color: var(--bad-line) !important; box-shadow: 0 10px 34px rgba(155,65,77,.14); }
.react-flow__node.status-unmonitored { border-color: var(--line-strong) !important; box-shadow: none; }
.react-flow__edge-path { stroke: var(--line-strong); stroke-width: 2; }
.living-edge-path { fill: none; stroke: var(--line-strong); stroke-width: 2; transition: stroke .18s ease, stroke-width .18s ease, opacity .18s ease; }
.living-edge-routes_to { stroke: var(--line-strong); stroke-dasharray: 8 4; }
.living-edge-review { stroke: var(--line-strong); stroke-dasharray: 3 6; opacity: .68; }
.living-edge-path.is-selected { stroke: var(--accent); stroke-width: 3.2; }
.living-edge-signal { fill: none; stroke: var(--accent); stroke-width: 3.2; stroke-linecap: round; stroke-dasharray: 2 20; animation: servicemap-edge-signal 1.7s linear infinite; filter: drop-shadow(0 0 3px rgba(95, 176, 236, .8)); }
.edge-down .living-edge-path { stroke: var(--bad-line); }
.edge-degraded .living-edge-path { stroke: var(--warn-line); }
.edge-down .living-edge-signal, .edge-degraded .living-edge-signal { stroke: var(--warn); }
@keyframes servicemap-edge-signal { to { stroke-dashoffset: -44; } }
@media (prefers-reduced-motion: reduce) { .living-edge-signal { animation: none; stroke-dasharray: none; opacity: .85; } }
.react-flow__edge-marker { fill: #668ab3; }
.react-flow__edge.edge-down .react-flow__edge-path { stroke: #b55967; }
.react-flow__edge.edge-degraded .react-flow__edge-path { stroke: #b08a45; }
.react-flow__edge.edge-down .react-flow__edge-marker { fill: #b55967; }
.react-flow__edge.edge-degraded .react-flow__edge-marker { fill: #b08a45; }
.react-flow__controls { border: 1px solid #274563; overflow: hidden; border-radius: 12px; }
.react-flow__controls button { background: #10233a; color: #fff; border-bottom-color: #274563; }
.react-flow__minimap { border: 1px solid #274563; border-radius: 12px; overflow: hidden; background: #08131f !important; }
.react-flow__edge-marker { fill: var(--line-strong); }
.react-flow__edge.edge-down .react-flow__edge-path { stroke: var(--bad-line); }
.react-flow__edge.edge-degraded .react-flow__edge-path { stroke: var(--warn-line); }
.react-flow__edge.edge-down .react-flow__edge-marker { fill: var(--bad-line); }
.react-flow__edge.edge-degraded .react-flow__edge-marker { fill: var(--warn-line); }
.react-flow__controls { border: 1px solid var(--line); overflow: hidden; border-radius: var(--radius-md); }
.react-flow__controls { box-shadow: 0 8px 24px rgba(0, 0, 0, .35); }
.react-flow__controls button { width: 30px; height: 30px; padding: 0; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: var(--surface-2); color: var(--text-2); }
.react-flow__controls button:hover:not(:disabled) { border-color: var(--line); background: var(--surface-3); color: var(--text); }
.react-flow__controls button svg { fill: currentColor; max-width: 13px; max-height: 13px; }
.react-flow__attribution { background: transparent !important; opacity: .45; }
.react-flow__attribution a { color: var(--text-3) !important; }
.react-flow__minimap { border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; background: var(--bg) !important; }
/* v1.1 information architecture */
.overview-grid, .incident-workspace, .services-workspace { display: grid; gap: 16px; }
@@ -189,74 +273,74 @@ dd { margin: 0; overflow-wrap: anywhere; color: #dce8f7; font-size: 12px; }
.overview-lead h2 { margin: 9px 0; font-size: clamp(28px, 3vw, 42px); }
.overview-incident { min-height: 270px; }
.summary-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; margin-top: 28px; }
.summary-cards button { display: block; min-width: 0; padding: 14px; border: 1px solid #233d5a; border-radius: 14px; background: #0a1828; text-align: left; }
.summary-cards strong { display: block; font-size: 26px; }
.summary-cards span { color: #a9bdd4; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.summary-cards button { display: block; min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface-1); text-align: left; }
.summary-cards strong { display: block; font-size: var(--fs-2xl); }
.summary-cards span { color: var(--text-2); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .08em; }
.overview-root-list { max-height: 220px; overflow-y: auto; padding-right: 4px; }
.coverage-overview { grid-column: span 2; }
.coverage-overview h3 { margin-bottom: 0; }
.coverage-breakdown { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin: 14px 0; }
.coverage-breakdown div { padding: 10px; border: 1px solid #233d5a; border-radius: 11px; background: #0a1828; }
.coverage-breakdown div { padding: 10px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-1); }
.coverage-breakdown strong, .coverage-breakdown span { display: block; }
.coverage-breakdown strong { font-size: 20px; }
.coverage-breakdown span { margin-top: 3px; color: #91a6bf; font-size: 10px; line-height: 1.25; text-transform: uppercase; letter-spacing: .06em; }
.coverage-breakdown strong { font-size: var(--fs-xl); }
.coverage-breakdown span { margin-top: 3px; color: var(--text-3); font-size: var(--fs-xs); line-height: 1.25; text-transform: uppercase; letter-spacing: .06em; }
.event-panel { grid-column: 1 / -1; }
.event-list { display: grid; gap: 2px; margin-top: 12px; }
.event-row { display: flex; align-items: flex-start; gap: 11px; padding: 10px 0; border-bottom: 1px solid #172c43; }
.event-dot { flex: 0 0 8px; width: 8px; height: 8px; margin-top: 5px; border-radius: 50%; background: #78a8d5; box-shadow: 0 0 0 4px rgba(120,168,213,.12); }
.event-row { display: flex; align-items: flex-start; gap: 11px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.event-dot { flex: 0 0 8px; width: 8px; height: 8px; margin-top: 5px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(95, 176, 236, .12); }
.event-row strong, .event-row small { display: block; }
.event-row strong { font-size: 13px; }
.event-row small { margin-top: 3px; color: #8095ae; font-size: 11px; }
.event-row strong { font-size: var(--fs-md); }
.event-row small { margin-top: 3px; color: var(--text-3); font-size: var(--fs-xs); }
.incident-workspace { grid-template-columns: minmax(0, 1.05fr) minmax(320px, .85fr); }
.incident-list-panel, .incident-detail-panel { min-height: 560px; }
.incident-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: #8398b3; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.incident-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--text-3); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .08em; }
.incident-card.resolved { opacity: .72; }
.review-filters { display: grid; grid-template-columns: minmax(170px, 1fr) repeat(2, minmax(130px, auto)); gap: 10px; margin-top: 16px; }
.review-filters label { display: grid; gap: 5px; color: #afc3d9; font-size: 12px; }
.review-filters label { display: grid; gap: 5px; color: var(--text-2); font-size: var(--fs-sm); }
.review-filters input, .review-filters select { min-width: 0; width: 100%; margin: 0; }
.incident-list-panel .review-filters { grid-template-columns: minmax(170px, 1fr) minmax(130px, 170px); }
.timeline { display: grid; gap: 0; margin-top: 20px; }
.timeline-row { display: grid; grid-template-columns: 17px minmax(0, 1fr); gap: 10px; min-height: 58px; }
.timeline-line { position: relative; width: 9px; height: 9px; margin-top: 4px; border: 2px solid #78a8d5; border-radius: 50%; background: #0b1b2c; }
.timeline-line::after { content: ''; position: absolute; top: 7px; left: 2px; width: 1px; height: 50px; background: #315271; }
.timeline-line { position: relative; width: 9px; height: 9px; margin-top: 4px; border: 2px solid var(--accent); border-radius: 50%; background: var(--surface-1); }
.timeline-line::after { content: ''; position: absolute; top: 7px; left: 2px; width: 1px; height: 50px; background: var(--line-strong); }
.timeline-row:last-child .timeline-line::after { display: none; }
.timeline-row strong, .timeline-row small { display: block; }
.timeline-row strong { font-size: 13px; line-height: 1.35; }
.timeline-row small { margin-top: 3px; color: #8298b2; font-size: 11px; }
.timeline-row strong { font-size: var(--fs-md); line-height: 1.35; }
.timeline-row small { margin-top: 3px; color: var(--text-3); font-size: var(--fs-xs); }
.services-workspace { grid-template-columns: minmax(0, 1fr); align-items: start; }
.services-workspace:has(.service-drawer) { grid-template-columns: minmax(0, 1fr) minmax(340px, 400px); }
.service-drawer { position: sticky; top: 14px; display: grid; align-content: start; gap: 12px; max-height: calc(100vh - 42px); overflow-y: auto; padding: 0 2px 2px 14px; border-left: 1px solid #203754; }
.service-drawer { position: sticky; top: 14px; display: grid; align-content: start; gap: 12px; max-height: calc(100vh - 42px); overflow-y: auto; padding: 0 2px 2px 14px; border-left: 1px solid var(--line); }
.drawer-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 2px 0; }
.table-panel { min-height: 630px; }
.table-toolbar { display: grid; grid-template-columns: minmax(180px, 1.5fr) auto repeat(5, minmax(105px, 1fr)); gap: 9px; margin-bottom: 15px; }
.search-field { min-width: 0; }
.service-table { display: grid; gap: 1px; overflow-x: auto; }
.service-table-head, .service-table-row { display: grid; grid-template-columns: minmax(180px, 1.25fr) minmax(115px, .8fr) minmax(110px, .65fr) minmax(130px, .9fr) minmax(100px, .7fr) minmax(75px, .45fr) minmax(75px, .45fr); gap: 12px; align-items: center; min-width: 920px; }
.service-table-head { padding: 8px 12px; color: #7f96b2; font-size: 10px; text-transform: uppercase; letter-spacing: .1em; }
.service-table-row { width: 100%; padding: 12px; border: 1px solid #1d3853; border-radius: 10px; background: #0a1727; color: #dbe9f8; text-align: left; }
.service-table-row:hover { background: #10243a; }
.service-table-row[aria-pressed="true"] { border-color: #78a8d5; background: #102943; box-shadow: inset 3px 0 #8dc5ee; }
.service-table-head { padding: 8px 12px; color: var(--text-3); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .1em; }
.service-table-row { width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-1); color: var(--text); text-align: left; }
.service-table-row:hover { background: var(--surface-2); }
.service-table-row[aria-pressed="true"] { border-color: var(--accent); background: var(--surface-3); box-shadow: inset 3px 0 var(--accent); }
.monitoring-cell { display: grid; gap: 2px; }
.service-table-row span { min-width: 0; overflow-wrap: anywhere; font-size: 12px; }
.service-table-row span { min-width: 0; overflow-wrap: anywhere; font-size: var(--fs-sm); }
.service-table-row strong, .service-table-row small { display: block; }
.service-table-row strong { font-size: 13px; }
.service-table-row small { margin-top: 3px; color: #8197b1; font-size: 11px; }
.service-table-row strong { font-size: var(--fs-md); }
.service-table-row small { margin-top: 3px; color: var(--text-3); font-size: var(--fs-xs); }
.graph-tools { display: none; }
.topology-command-bar { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; margin-bottom: 12px; padding: 9px 11px; border: 1px solid #203754; border-radius: 14px; background: rgba(8, 20, 34, .94); box-shadow: 0 16px 40px rgba(0,0,0,.14); }
.topology-command-bar { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; margin-bottom: 12px; padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: rgba(21, 26, 33, .94); box-shadow: 0 16px 40px rgba(0,0,0,.14); }
.topology-command-actions { display: flex; align-items: center; justify-content: flex-end; gap: 7px; flex-wrap: wrap; }
.filter-chip { justify-self: start; padding: 4px 8px; border-color: #456b8d; border-radius: 999px; background: #102c43; color: #c5e2f7; font-size: 10px; }
.topology-command-actions input { width: 175px; margin: 0; padding: 7px 9px; font-size: 12px; }
.compact-button { padding: 7px 9px; border-radius: 9px; font-size: 11px; }
.filter-chip { justify-self: start; padding: 4px 8px; border-color: var(--line-strong); border-radius: var(--radius-pill); background: var(--surface-3); color: var(--text); font-size: var(--fs-xs); }
.topology-command-actions input { width: 175px; margin: 0; padding: 7px 9px; font-size: var(--fs-sm); }
.compact-button { padding: 7px 9px; border-radius: var(--radius-md); font-size: var(--fs-xs); }
.filter-popover { position: relative; }
.filter-popover summary { cursor: pointer; list-style: none; padding: 7px 9px; border: 1px solid #355779; border-radius: 9px; background: #0b1a2b; color: #eef4ff; font-size: 11px; }
.filter-popover summary { cursor: pointer; list-style: none; padding: 7px 9px; border: 1px solid var(--line-strong); border-radius: var(--radius-md); background: var(--surface-1); color: var(--text); font-size: var(--fs-xs); }
.filter-popover summary::-webkit-details-marker { display: none; }
.filter-popover > div { position: absolute; z-index: 12; right: 0; top: calc(100% + 7px); display: grid; grid-template-columns: repeat(2, minmax(145px, 1fr)); gap: 9px; width: 330px; padding: 12px; border: 1px solid #355779; border-radius: 12px; background: #0b1b2e; box-shadow: 0 20px 50px rgba(0,0,0,.42); }
.filter-popover label { font-size: 11px; }
.filter-popover select { padding: 7px 8px; font-size: 12px; }
.filter-popover > div { position: absolute; z-index: 12; right: 0; top: calc(100% + 7px); display: grid; grid-template-columns: repeat(2, minmax(145px, 1fr)); gap: 9px; width: 330px; padding: 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-md); background: var(--surface-1); box-shadow: 0 20px 50px rgba(0,0,0,.42); }
.filter-popover label { font-size: var(--fs-xs); }
.filter-popover select { padding: 7px 8px; font-size: var(--fs-sm); }
.mode-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.mode-tabs button { padding: 7px 9px; font-size: 11px; }
.mode-tabs button.active { border-color: #79a6d1; background: #193956; }
.topology-breadcrumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; color: #9fb4ca; font-size: 12px; }
.mode-tabs button { padding: 7px 9px; font-size: var(--fs-xs); }
.mode-tabs button.active { border-color: var(--accent); background: var(--surface-3); }
.topology-breadcrumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; color: var(--text-2); font-size: var(--fs-sm); }
.domain-node .service-node-body { min-width: 205px; }
.application-node .service-node-body { min-width: 225px; }
.component-node .service-node-body { min-width: 198px; }
@@ -265,70 +349,70 @@ dd { margin: 0; overflow-wrap: anywhere; color: #dce8f7; font-size: 12px; }
.detail-grid { display: grid; gap: 8px; margin: 15px 0; }
.detail-grid div { display: grid; grid-template-columns: 125px minmax(0, 1fr); gap: 9px; }
.discovery-panel, .config-panel { max-width: 980px; min-height: 620px; }
.suggestion { display: grid; gap: 4px; margin-top: 9px; padding: 10px; border: 1px solid #294563; border-radius: 9px; background: #0c1d30; }
.suggestion small { color: #92a8c1; }
.suggestion { display: grid; gap: 4px; margin-top: 9px; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-2); }
.suggestion small { color: var(--text-3); }
.suggestion button { margin-top: 4px; }
.discovery-workspace { display: grid; gap: 16px; grid-template-columns: minmax(0, 1.05fr) minmax(340px, .95fr); align-items: start; }
.discovery-workspace > .discovery-observations { grid-column: 1 / -1; }
.discovery-panel, .suggestion-panel, .discovery-observations { min-height: 0; }
.discovery-summary { display: grid; grid-template-columns: repeat(5, minmax(72px, 1fr)); gap: 8px; margin: 18px 0 12px; }
.discovery-summary div { display: grid; gap: 4px; padding: 12px; border: 1px solid #233d5a; border-radius: 12px; background: #0a1828; }
.discovery-summary strong { font-size: 21px; }
.discovery-summary span { color: #8198b3; font-size: 10px; text-transform: uppercase; letter-spacing: .07em; }
.discovery-callout, .notice-inline { display: grid; gap: 4px; margin: 13px 0; padding: 11px 12px; border: 1px solid #315c5e; border-radius: 10px; background: #0c2528; color: #bce8dd; font-size: 12px; line-height: 1.45; }
.probe-safety-callout { display: grid; gap: 7px; margin: 13px 0; padding: 12px; border: 1px solid #496d91; border-radius: 10px; background: #0d2237; color: #d0e5fa; font-size: 12px; line-height: 1.45; }
.probe-safety-callout span, .probe-safety-callout small { color: #9fb8d2; }
.discovery-summary div { display: grid; gap: 4px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-1); }
.discovery-summary strong { font-size: var(--fs-xl); }
.discovery-summary span { color: var(--text-3); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .07em; }
.discovery-callout, .notice-inline { display: grid; gap: 4px; margin: 13px 0; padding: 11px 12px; border: 1px solid var(--ok-line); border-radius: var(--radius-md); background: var(--ok-bg); color: var(--ok); font-size: var(--fs-sm); line-height: 1.45; }
.probe-safety-callout { display: grid; gap: 7px; margin: 13px 0; padding: 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-md); background: var(--surface-2); color: var(--text); font-size: var(--fs-sm); line-height: 1.45; }
.probe-safety-callout span, .probe-safety-callout small { color: var(--text-2); }
.coverage-change-list { display: grid; gap: 6px; max-height: 260px; overflow-y: auto; }
.coverage-change-list > div { display: grid; gap: 2px; padding: 8px 9px; border: 1px solid #294863; border-radius: 8px; background: #0a1b2b; }
.coverage-change-list strong { font-size: 12px; }
.coverage-change-list small { font-size: 11px; line-height: 1.35; }
.discovery-callout span { color: #91bdb8; }
.notice-inline { display: block; color: #b8d8f5; border-color: #315271; background: #0d2237; }
.coverage-change-list > div { display: grid; gap: 2px; padding: 8px 9px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-1); }
.coverage-change-list strong { font-size: var(--fs-sm); }
.coverage-change-list small { font-size: var(--fs-xs); line-height: 1.35; }
.discovery-callout span { color: var(--ok); }
.notice-inline { display: block; color: var(--text); border-color: var(--line-strong); background: var(--surface-2); }
.suggestion-list { display: grid; gap: 10px; margin-top: 14px; max-height: 720px; overflow-y: auto; padding-right: 2px; }
.discovery-panel .field-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.review-confirm { margin-top: 14px; padding: 14px; border: 1px solid #b28a46; border-radius: 12px; background: #322714; }
.review-confirm p { color: #e0d2b6; line-height: 1.5; }
.review-confirm { margin-top: 14px; padding: 14px; border: 1px solid var(--warn-line); border-radius: var(--radius-md); background: var(--warn-bg); }
.review-confirm p { color: var(--warn); line-height: 1.5; }
.show-more { margin-top: 12px; }
.suggestion-card { display: grid; gap: 7px; padding: 13px; border: 1px solid #2a4663; border-radius: 13px; background: #0a1727; }
.suggestion-card { display: grid; gap: 7px; padding: 13px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface-1); }
.suggestion-card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.suggestion-card-heading strong { display: block; margin-top: 4px; font-size: 14px; line-height: 1.3; }
.suggestion-card > small { color: #8fa5be; }
.suggestion-card-heading strong { display: block; margin-top: 4px; font-size: var(--fs-base); line-height: 1.3; }
.suggestion-card > small { color: var(--text-3); }
.evidence-list { display: grid; gap: 4px; margin-top: 6px; }
.evidence-list strong { color: #9db4cf; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; }
.evidence-list small { display: block; color: #849bb6; line-height: 1.4; overflow-wrap: anywhere; }
.evidence-list strong { color: var(--text-2); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .07em; }
.evidence-list small { display: block; color: var(--text-3); line-height: 1.4; overflow-wrap: anywhere; }
.provider-statuses { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.provider-statuses small { border: 1px solid #294968; border-radius: 999px; padding: 3px 7px; text-transform: capitalize; }
.provider-statuses small { border: 1px solid var(--line); border-radius: var(--radius-pill); padding: 3px 7px; }
.change-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); gap: 9px; margin-top: 14px; align-items: start; }
.snapshot-picker { display: grid; gap: 5px; max-width: 440px; margin: 14px 0; color: #afc3d9; font-size: 12px; }
.change-card { padding: 12px; border: 1px solid #294563; border-radius: 10px; background: #0a1727; }
.snapshot-picker { display: grid; gap: 5px; max-width: 440px; margin: 14px 0; color: var(--text-2); font-size: var(--fs-sm); }
.change-card { padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-1); }
.change-card summary { display: grid; gap: 4px; cursor: pointer; }
.change-card summary strong { color: #e3efff; }
.change-card summary small { color: #9cb2cb; }
.change-card summary strong { color: var(--text); }
.change-card summary small { color: var(--text-2); }
.change-fields { display: grid; gap: 6px; margin: 10px 0; }
.change-fields div { display: grid; gap: 2px; padding: 7px; border: 1px solid #203b57; border-radius: 6px; }
.change-fields strong { font-size: 11px; text-transform: capitalize; }
.change-fields small { overflow-wrap: anywhere; color: #a8bed6; }
.current-evidence-callout { border-color: #3b6d7b; background: #102b37; }
.change-fields div { display: grid; gap: 2px; padding: 7px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.change-fields strong { font-size: var(--fs-xs); text-transform: capitalize; }
.change-fields small { overflow-wrap: anywhere; color: var(--text-2); }
.current-evidence-callout { border-color: var(--ok-line); background: var(--surface-2); }
.observation-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 6px; margin: 14px 0; }
.observation-row { display: grid; grid-template-columns: minmax(0, 1.2fr) auto; gap: 3px 9px; padding: 9px 10px; border: 1px solid #203b57; border-radius: 9px; background: #0a1727; }
.observation-row strong { overflow-wrap: anywhere; font-size: 12px; }
.observation-row span, .observation-row small { color: #8ca3bd; font-size: 11px; }
.observation-row { display: grid; grid-template-columns: minmax(0, 1.2fr) auto; gap: 3px 9px; padding: 9px 10px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-1); }
.observation-row strong { overflow-wrap: anywhere; font-size: var(--fs-sm); }
.observation-row span, .observation-row small { color: var(--text-3); font-size: var(--fs-xs); }
.observation-row small { grid-column: 1 / -1; }
.candidate-details { margin-top: 14px; }
.candidate-details summary { cursor: pointer; color: #a9bdd4; font-size: 12px; }
.candidate-details summary { cursor: pointer; color: var(--text-2); font-size: var(--fs-sm); }
.compact-list { max-height: 430px; overflow-y: auto; }
.group-chips { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.group-chips button { padding: 6px 8px; font-size: 11px; }
.group-chips button.active { border-color: #79a6d1; background: #193956; }
.edge-inspector { border-color: #46698b; }
.group-chips button { padding: 6px 8px; font-size: var(--fs-xs); }
.group-chips button.active { border-color: var(--accent); background: var(--surface-3); }
.edge-inspector { border-color: var(--line-strong); }
.edge-inspector .detail-grid { max-height: 280px; overflow-y: auto; }
.flap-badge { margin-left: 4px; background: #3d3f74; color: #d9d8ff; }
.status-recovering { color: #a9c5ff !important; }
.status-maintenance { color: #b6a9dc !important; }
.flap-badge { margin-left: 4px; background: var(--maint-line); color: var(--maint); }
.status-recovering { color: var(--text-2) !important; }
.status-maintenance { color: var(--maint) !important; }
.react-flow__edge.edge-dimmed { opacity: .28; }
.react-flow__edge.edge-down .react-flow__edge-path, .react-flow__edge.edge-degraded .react-flow__edge-path { stroke-dasharray: 7 5; }
.react-flow__node.status-recovering { border-color: #687ab1 !important; }
.react-flow__node.status-maintenance { border-color: #705d99 !important; }
.react-flow__node.status-recovering { border-color: var(--line-strong) !important; }
.react-flow__node.status-maintenance { border-color: var(--maint-line) !important; }
.react-flow__node.service-node:has(.flap-badge) { border-style: dashed !important; }
@media (prefers-reduced-motion: reduce) {
@@ -369,8 +453,245 @@ dd { margin: 0; overflow-wrap: anywhere; color: #dce8f7; font-size: 12px; }
.filter-popover > div { position: fixed; right: 12px; left: 12px; top: auto; width: auto; }
.discovery-summary { grid-template-columns: repeat(2, 1fr); }
.inspector-title { align-items: flex-start; }
.panel-heading { flex-wrap: wrap; gap: 12px; }
.panel-heading > label { flex: 1 1 100%; }
.demo-banner { display: flex; align-items: flex-start; flex-direction: column; }
.demo-confirm, .demo-walkthrough { align-items: flex-start; flex-direction: column; }
.demo-actions { width: 100%; }
.demo-actions button, .demo-walkthrough-actions button { flex: 1 1 auto; }
}
/* Accessibility: a visible focus ring for keyboard users (WCAG 2.4.7, 1.4.11). */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.react-flow__node:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; border-radius: var(--radius-lg); }
main:focus { outline: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 50; padding: 10px 14px; border-radius: var(--radius-md); background: var(--surface-3); color: var(--text); }
.skip-link:focus { top: 12px; }
.flow-host { width: 100%; height: 100%; }
.graph-list { height: 100%; overflow: auto; padding: 56px 16px 16px; }
.graph-list ul { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.graph-list li { display: grid; gap: 4px; }
.graph-list button { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; width: 100%; text-align: left; }
.graph-list small { padding-left: 14px; color: var(--text-2); font-size: var(--fs-sm); }
.graph-list-status { min-width: 128px; font-size: var(--fs-sm); font-weight: 700; }
.graph-list .status-healthy .graph-list-status { color: var(--ok); }
.graph-list .status-degraded .graph-list-status, .graph-list .status-recovering .graph-list-status { color: var(--warn); }
.graph-list .status-down .graph-list-status { color: var(--bad); }
.graph-list .status-unknown .graph-list-status, .graph-list .status-unmonitored .graph-list-status, .graph-list .status-maintenance .graph-list-status { color: var(--text-2); }
.graph-list-flag { padding: 2px 8px; border: 1px solid currentColor; border-radius: var(--radius-pill); color: var(--warn); font-size: var(--fs-xs); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; } }
.confirm-dialog { width: min(520px, calc(100% - 32px)); padding: 20px 22px; border: 1px solid var(--line-strong); border-radius: var(--radius-lg); background: var(--surface-2); color: var(--text); box-shadow: 0 30px 90px rgba(0,0,0,.55); }
.confirm-dialog::backdrop { background: rgba(21, 26, 33, .72); }
.confirm-dialog h2 { margin: 0 0 8px; font-size: var(--fs-lg); }
.confirm-dialog-body p { margin: 0 0 16px; color: var(--text-2); font-size: var(--fs-base); line-height: 1.5; }
.confirm-dialog .button-row { justify-content: flex-end; }
/* Numbers line up in KPIs, tables and metrics. */
.health-summary strong, .summary-cards strong, .metric strong, .service-table, .detail-grid dd, .history-strip, time { font-variant-numeric: tabular-nums; }
/* Lucide icons sit on the text baseline; icon + label buttons get a fixed gap. */
.status-icon { flex: none; vertical-align: -2px; }
.health-pill .status-icon, .node-status .status-icon { margin-right: 3px; }
button:has(> svg) { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
button > svg { flex: none; opacity: .9; }
.panel-tabs button > svg { opacity: .75; }
.panel-tabs button.active > svg { opacity: 1; color: var(--accent); }
/* ── App shell ─────────────────────────────────────────────────────────
One sticky header: brand, live status, KPI chips and actions on the
first row, workspaces on the second. On phones the workspaces move to a
bottom bar. */
:root { --topbar-h: 98px; --page-w: min(1760px, calc(100% - 32px)); }
.shell { width: 100%; margin: 0; padding: 0 0 32px; }
.shell > :not(.topbar):not(.skip-link):not(dialog) { width: var(--page-w); margin-left: auto; margin-right: auto; }
.topbar { position: sticky; top: 0; z-index: 40; display: block; min-height: 0; margin-bottom: 14px; padding: 0; border-bottom: 1px solid var(--line); background: rgba(21, 26, 33, .94); backdrop-filter: blur(10px); }
.topbar-inner { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "brand status actions" "nav nav nav"; align-items: center; column-gap: 16px; width: var(--page-w); margin: 0 auto; }
.topbar .brand-lockup { grid-area: brand; gap: 10px; height: 54px; }
.topbar .brand-lockup img { width: 28px; height: 28px; }
.topbar .brand-lockup h1 { margin: 0; font-size: var(--fs-lg); font-weight: 700; letter-spacing: -.01em; }
.topbar-status { grid-area: status; display: flex; align-items: center; justify-content: flex-end; gap: 10px; min-width: 0; }
.topbar-status .live-status { margin: 0; }
.kpi-chips { display: flex; gap: 6px; }
.kpi-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--line); border-radius: var(--radius-pill); background: var(--surface-2); font-size: var(--fs-md); }
.kpi-chip strong { color: var(--text); font-variant-numeric: tabular-nums; }
.topbar .toolbar { grid-area: actions; gap: 6px; }
.topbar .toolbar .primary { padding: 8px 14px; }
.icon-button { width: 36px; height: 36px; padding: 0; }
.topbar .panel-tabs { grid-area: nav; display: flex; gap: 2px; margin: 0 0 -1px; overflow-x: auto; scrollbar-width: none; }
.topbar .panel-tabs::-webkit-scrollbar { display: none; }
.topbar .panel-tabs button { padding: 9px 12px 10px; border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; color: var(--text-3); font-size: var(--fs-md); }
.topbar .panel-tabs button:hover:not(:disabled) { border-color: var(--line-strong); background: transparent; color: var(--text); }
.topbar .panel-tabs button.active { border-color: var(--accent); background: transparent; color: var(--text); }
.nav-more { display: none; }
.actions-menu { position: relative; }
.actions-menu-panel { position: absolute; top: calc(100% + 6px); right: 0; z-index: 60; display: grid; gap: 2px; min-width: 210px; padding: 6px; border: 1px solid var(--line-strong); border-radius: var(--radius-md); background: var(--surface-2); box-shadow: 0 16px 40px rgba(0, 0, 0, .45); }
.actions-menu-panel button { justify-content: flex-start; width: 100%; padding: 9px 10px; border-color: transparent; background: transparent; }
.actions-menu-panel button:hover:not(:disabled) { border-color: transparent; background: var(--surface-3); }
.actions-menu-footer { margin-top: 4px; padding: 6px 10px 2px; border-top: 1px solid var(--line); color: var(--text-3); font-size: var(--fs-xs); }
.unlock-popover { position: absolute; top: calc(100% + 6px); right: max(16px, calc((100% - 1760px) / 2)); z-index: 60; width: min(440px, calc(100vw - 32px)); margin: 0; background: var(--surface-2); border-color: var(--line-strong); box-shadow: 0 16px 40px rgba(0, 0, 0, .45); }
.status-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin-bottom: 12px; padding: 8px 14px; border: 1px solid var(--bad-line); border-radius: var(--radius-md); background: var(--bad-bg); font-size: var(--fs-md); }
.status-line strong { color: var(--bad); }
.status-line span { color: var(--text-2); }
.status-line .text-button { margin-left: auto; color: var(--text); font-size: var(--fs-md); text-decoration: underline; }
.status-line-offline { border-color: var(--warn-line); background: var(--warn-bg); }
.status-line-offline strong { color: var(--warn); }
/* ── Topology fills the viewport; the inspector is a drawer over it ── */
.topology-workspace, .topology-workspace:has(.topology-drawer) { position: relative; display: block; }
.canvas-card, .demo-mode .canvas-card { height: calc(100dvh - var(--topbar-h) - 100px); min-height: 460px; }
.shell:has(.status-line) .canvas-card { height: calc(100dvh - var(--topbar-h) - 150px); }
.topology-drawer { position: absolute; top: 10px; right: 10px; bottom: 10px; z-index: 6; display: block; width: min(400px, calc(100% - 20px)); height: auto; min-height: 0; max-height: none; padding: 16px; overflow-y: auto; border: 1px solid var(--line-strong); border-radius: var(--radius-lg); background: rgba(21, 26, 33, .97); box-shadow: -16px 0 48px rgba(0, 0, 0, .45); }
.topology-drawer > .panel-section { padding: 0; border: 0; background: transparent; box-shadow: none; }
.topology-drawer .inspector-section { min-height: 0; }
.drawer-close { position: absolute; top: 10px; right: 10px; z-index: 1; }
.topology-drawer .inspector-title { padding-right: 44px; }
.topology-workspace:has(.topology-drawer) .canvas-toolbar { right: 420px; }
@media (max-width: 1120px) {
.topology-workspace, .topology-workspace:has(.topology-drawer) { display: block; }
.topology-drawer { position: absolute; display: block; height: auto; max-height: none; padding: 16px; border: 1px solid var(--line-strong); overflow-y: auto; }
.topology-workspace:has(.topology-drawer) .canvas-toolbar { right: 10px; }
}
@media (max-width: 760px) {
:root { --topbar-h: 54px; --page-w: calc(100% - 24px); }
.shell { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
/* backdrop-filter would make the header the containing block of the fixed bottom bar. */
.topbar { margin-bottom: 12px; background: var(--surface-1); backdrop-filter: none; }
.topbar-inner { grid-template-areas: "brand status actions"; column-gap: 8px; }
.topbar .brand-lockup { height: 54px; }
.topbar .brand-lockup h1 { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.topbar-status .live-status { display: none; }
.kpi-chips { gap: 4px; }
.kpi-chip { gap: 3px; padding: 3px 6px; font-size: var(--fs-sm); }
.topbar .toolbar { flex-wrap: nowrap; width: auto; }
.topbar .toolbar button { flex: none; }
.topbar .toolbar .primary { width: 36px; height: 36px; padding: 0; }
.toolbar-label { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.topbar .panel-tabs { position: fixed; right: 0; bottom: 0; left: 0; z-index: 45; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 2px; margin: 0; padding: 4px 6px calc(4px + env(safe-area-inset-bottom)); overflow: visible; border-top: 1px solid var(--line); background: rgba(21, 26, 33, .97); backdrop-filter: blur(10px); }
.topbar .panel-tabs button { display: flex; flex-direction: column; gap: 3px; min-height: 52px; padding: 6px 2px; border: 0; border-radius: var(--radius-md); font-size: var(--fs-xs); }
.topbar .panel-tabs button.active { background: var(--accent-soft); color: var(--text); }
.topbar .panel-tabs .nav-secondary { display: none; }
.topbar .panel-tabs .nav-more { display: flex; }
.topbar .panel-tabs.nav-more-open .nav-secondary { display: flex; }
.canvas-card, .demo-mode .canvas-card, .shell:has(.status-line) .canvas-card { height: calc(100dvh - var(--topbar-h) - 250px); min-height: 380px; }
.topology-drawer { position: fixed; top: auto; right: 0; bottom: calc(64px + env(safe-area-inset-bottom)); left: 0; z-index: 44; width: auto; max-height: 55dvh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; box-shadow: 0 -16px 48px rgba(0, 0, 0, .5); }
.unlock-popover { right: 12px; }
.status-line .text-button { margin-left: 0; }
}
/* ── Graph: node cards ────────────────────────────────────────────────
Name first, status as a coloured left edge plus icon and label, facts as
chips, a single root-cause marker. */
.react-flow__node.service-node { border-left-width: 4px !important; box-shadow: 0 8px 22px rgba(0, 0, 0, .3) !important; }
.react-flow__node.status-healthy { border-left-color: var(--ok) !important; }
.react-flow__node.status-degraded { border-left-color: var(--warn) !important; }
.react-flow__node.status-down { border-left-color: var(--bad) !important; }
.react-flow__node.status-recovering { border-left-color: var(--accent) !important; }
.react-flow__node.status-maintenance { border-left-color: var(--maint) !important; }
.react-flow__node.status-unknown, .react-flow__node.status-unmonitored { border-left-color: var(--unknown) !important; }
.react-flow__node.domain-node { border-style: solid !important; }
.react-flow__node.service-node:has(.root-cause-badge) { border-color: var(--warn-line) !important; box-shadow: 0 0 0 1px var(--warn-line), 0 10px 30px rgba(0, 0, 0, .35) !important; }
.service-node-body, .domain-node .service-node-body, .application-node .service-node-body, .component-node .service-node-body { display: grid; align-content: start; gap: 6px; box-sizing: border-box; width: 236px; min-width: 0; min-height: 128px; padding: 11px 13px 12px; background: none; }
.node-head { display: flex; align-items: center; gap: 6px; min-width: 0; color: var(--text-3); }
.node-kind-icon { flex: none; }
.node-head .node-kicker { overflow: hidden; color: var(--text-3); font-size: var(--fs-xs); font-weight: 500; letter-spacing: 0; text-overflow: ellipsis; text-transform: none; white-space: nowrap; }
.service-node-body .node-name { display: -webkit-box; overflow: hidden; color: var(--text); font-size: var(--fs-lg); font-weight: 700; line-height: 1.2; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.node-state { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.service-node-body .node-status { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-sm); font-weight: 600; letter-spacing: 0; text-transform: none; }
.node-flag { display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; border: 1px solid var(--warn-line); border-radius: var(--radius-pill); background: var(--warn-bg); color: var(--warn); font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0; }
.node-flag.flap-badge { border-color: var(--line-strong); background: var(--surface-1); color: var(--text-2); }
.node-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.node-chip { padding: 1px 7px; border: 1px solid var(--line); border-radius: var(--radius-pill); background: var(--surface-1); color: var(--text-2); font-size: var(--fs-xs); line-height: 1.6; }
.node-chip.criticality-critical { border-color: var(--bad-line); color: var(--text); }
.node-chip-alert { border-color: var(--bad-line); background: var(--bad-bg); color: var(--bad); }
.service-node-body .node-note { display: -webkit-box; overflow: hidden; color: var(--text-3); font-size: var(--fs-xs); line-height: 1.35; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
/* ── Graph: edges ─────────────────────────────────────────────────────
Calm by default; colour only on the incident path, the selection and the
hovered node's relations. */
.living-edge-path { stroke: #4a5664; stroke-width: 1.6; }
.react-flow__edge.animated .living-edge-path { stroke-dasharray: none; animation: none; }
.react-flow__edge.edge-down .living-edge-path, .react-flow__edge.edge-degraded .living-edge-path { stroke: #4a5664; stroke-dasharray: none; }
.react-flow__edge.edge-down .living-edge-path.has-signal { stroke: var(--bad); stroke-width: 2.2; }
.react-flow__edge.edge-degraded .living-edge-path.has-signal { stroke: var(--warn); stroke-width: 2.2; }
.living-edge-path.has-signal { stroke: var(--accent); stroke-width: 2.2; }
.living-edge-path.is-dimmed { opacity: .18; }
.living-edge-signal { stroke-width: 2.4; }
.react-flow__edge .react-flow__edge-marker, .react-flow__edge.edge-down .react-flow__edge-marker, .react-flow__edge.edge-degraded .react-flow__edge-marker { fill: #4a5664; }
.react-flow__arrowhead polyline { stroke: #4a5664 !important; fill: #4a5664 !important; }
/* ── Panels: headings ──────────────────────────────────────────────── */
h2 { max-width: none; margin-bottom: 8px; font-size: var(--fs-xl); line-height: 1.25; letter-spacing: -.01em; }
h3 { font-size: var(--fs-lg); letter-spacing: -.01em; }
.overview-lead h2, .demo-mode .hero h2 { font-size: var(--fs-2xl); line-height: 1.15; }
.compact-hero h2 { font-size: var(--fs-xl); }
.settings-panel h2:not(:first-of-type) { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.locked-note { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.locked-note p { margin: 0; }
/* ── Services: one filter row and a compact table ──────────────────── */
.table-toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.table-toolbar > label { flex: 0 1 150px; min-width: 120px; color: var(--text-3); font-size: var(--fs-sm); }
.table-toolbar > .search-field { flex: 1 1 240px; }
.table-toolbar > .checkbox-field { flex: none; min-width: 0; align-self: center; margin-top: 18px; white-space: nowrap; }
.table-toolbar > .checkbox-field input { width: 16px; height: 16px; margin: 0; }
.table-toolbar input, .table-toolbar select { margin-top: 4px; padding: 8px 10px; }
.table-toolbar .toolbar-end { margin-left: auto; padding: 9px 14px; }
.table-panel { min-height: 0; }
.service-table { gap: 0; border: 1px solid var(--line); border-radius: var(--radius-md); overflow: clip; }
.service-table > .service-row-wrap { padding-left: 12px; border-bottom: 1px solid var(--line); }
.service-table > .service-row-wrap:last-of-type { border-bottom: 0; }
.service-table > .service-row-wrap:first-child { position: sticky; top: var(--topbar-h); z-index: 2; background: var(--surface-2); }
.service-table-head { padding: 9px 12px; }
.service-table-row { padding: 9px 12px; border: 0; border-radius: 0; background: transparent; }
.service-table-row:hover:not(:disabled) { border: 0; background: var(--surface-2); }
.service-row-wrap:has(.service-table-row[aria-pressed="true"]) { background: var(--accent-soft); box-shadow: inset 3px 0 var(--accent); }
.service-table-row[aria-pressed="true"] { border: 0; background: transparent; box-shadow: none; }
.service-table.no-metrics .service-table-head, .service-table.no-metrics .service-table-row { grid-template-columns: minmax(180px, 1.3fr) minmax(115px, .8fr) minmax(110px, .7fr) minmax(130px, .9fr) minmax(110px, .7fr); }
.service-table.no-metrics .service-table-head > :nth-child(n + 6), .service-table.no-metrics .service-table-row > :nth-child(n + 6) { display: none; }
.service-table-row .status-icon { margin-right: 4px; }
/* ── Activity: per day, readable rows ──────────────────────────────── */
.activity-days { display: grid; gap: 18px; margin-top: 8px; }
.activity-day h3 { position: sticky; top: var(--topbar-h); z-index: 1; margin: 0 0 6px; padding: 6px 0; background: var(--surface-1); color: var(--text-2); font-size: var(--fs-md); font-weight: 600; letter-spacing: 0; }
.activity-list { margin: 0; gap: 0; border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; }
.activity-list li.activity-row { grid-template-columns: 52px 24px minmax(0, 1fr) auto; gap: 10px; padding: 9px 12px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; }
.activity-list li.activity-row:last-child { border-bottom: 0; }
.activity-row time { color: var(--text-3); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.activity-icon { display: grid; width: 24px; height: 24px; place-items: center; border-radius: 50%; background: var(--surface-3); color: var(--text-2); }
.tone-ok .activity-icon { background: var(--ok-bg); color: var(--ok); }
.tone-warn .activity-icon { background: var(--warn-bg); color: var(--warn); }
.tone-bad .activity-icon { background: var(--bad-bg); color: var(--bad); }
.tone-maint .activity-icon { background: var(--maint-bg); color: var(--maint); }
.tone-accent .activity-icon { background: var(--accent-soft); color: var(--accent); }
.activity-text { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; min-width: 0; }
.activity-text strong { font-size: var(--fs-md); }
.activity-message { color: var(--text-3); font-size: var(--fs-sm); }
.activity-count { padding: 0 7px; border-radius: var(--radius-pill); background: var(--surface-3); color: var(--text-2); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
.activity-services { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; max-width: 46%; }
.activity-more { align-self: center; color: var(--text-3); font-size: var(--fs-xs); }
.activity-services .compact-button { padding: 3px 8px; white-space: nowrap; }
.activity-list li.activity-row { align-items: center; }
@media (max-width: 760px) {
.activity-list li.activity-row { grid-template-columns: 44px 24px minmax(0, 1fr); }
.activity-services { grid-column: 3; justify-content: flex-start; max-width: none; }
}
/* ── Loading skeletons in the final layout ─────────────────────────── */
.graph-skeleton { display: grid; grid-template-columns: repeat(4, 200px); gap: 28px 64px; place-content: center; height: 100%; padding: 32px; }
.skeleton-card, .skeleton-row { display: block; border-radius: var(--radius-md); background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-3) 50%, var(--surface-2) 100%); background-size: 200% 100%; animation: servicemap-shimmer 1.4s ease-in-out infinite; }
.skeleton-card { height: 112px; border-left: 4px solid var(--line-strong); }
.skeleton-card:nth-child(2n) { transform: translateY(40px); }
.table-skeleton { display: grid; gap: 1px; }
.skeleton-row { height: 46px; border-radius: 0; }
@keyframes servicemap-shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@media (max-width: 760px) { .graph-skeleton { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; padding: 16px; } }
/* Freshness next to the live status; amber once live updates stop. */
.freshness { color: var(--text-3); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; white-space: nowrap; }
.freshness.is-stale { color: var(--warn); }
@media (max-width: 760px) { .freshness { display: none; } }
@@ -0,0 +1,56 @@
// @vitest-environment jsdom
import { cleanup, render, screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import type { Edge, Node } from "@xyflow/react";
import { afterEach, describe, expect, it, vi } from "vitest";
import { GraphListView, nodeAriaLabel } from "./GraphListView";
import type { ServiceNodeData } from "./ServiceNode";
const data = (name: string, status: ServiceNodeData["status"], extra: Partial<ServiceNodeData> = {}): ServiceNodeData => ({
name,
status,
kind: "http",
latency: null,
dependencyCount: 0,
rootCause: false,
impacted: false,
group: null,
criticality: "medium",
flapping: false,
category: "service",
...extra,
});
const nodes: Node[] = [
{ id: "db", position: { x: 0, y: 0 }, data: data("PostgreSQL", "down", { rootCause: true }) },
{ id: "api", position: { x: 0, y: 0 }, data: data("API", "degraded", { impacted: true, latency: 812.4 }) },
];
const edges: Edge[] = [{ id: "db-api", source: "db", target: "api" }];
afterEach(cleanup);
describe("graph text alternative", () => {
it("names every node with its status and dependencies", () => {
render(<GraphListView nodes={nodes} edges={edges} onOpen={() => undefined} />);
const region = screen.getByRole("region", { name: "Topologie als lijst" });
const items = region.querySelectorAll("li");
expect([...items].map((item) => item.querySelector("strong")?.textContent)).toEqual(["API", "PostgreSQL"]);
expect(screen.getByText("Hangt af van PostgreSQL")).toBeTruthy();
expect(screen.getByRole("button", { name: /Uitgevallen PostgreSQL Hoofdoorzaak/ })).toBeTruthy();
});
it("opens a node with the keyboard", async () => {
const onOpen = vi.fn();
render(<GraphListView nodes={nodes} edges={edges} onOpen={onOpen} />);
const user = userEvent.setup();
await user.tab();
await user.keyboard("{Enter}");
expect(onOpen).toHaveBeenCalledWith(nodes[1]);
});
it("gives canvas nodes a spoken label", () => {
expect(nodeAriaLabel(nodes[0].data as ServiceNodeData)).toBe("Service PostgreSQL, Uitgevallen, waarschijnlijke hoofdoorzaak");
expect(nodeAriaLabel(nodes[1].data as ServiceNodeData)).toBe("Service API, Verminderd, geraakt, 812 ms");
});
});
+62
View File
@@ -0,0 +1,62 @@
import type { Edge, Node } from "@xyflow/react";
import { StatusIcon } from "../components/StatusIcon";
import { statusLabel, type ServiceNodeData } from "./ServiceNode";
/** Spoken name for a graph node: what it is and how it is doing. */
export function nodeAriaLabel(data: ServiceNodeData): string {
const kind =
data.nodeKind === "domain" ? "Domein" : data.nodeKind === "application" ? "Applicatie" : "Service";
const parts = [`${kind} ${data.name}`, statusLabel(data.status)];
if (data.rootCause) parts.push("waarschijnlijke hoofdoorzaak");
else if (data.impacted) parts.push("geraakt");
if (data.latency != null) parts.push(`${Math.round(data.latency)} ms`);
return parts.join(", ");
}
type Props = {
nodes: Node[];
edges: Edge[];
onOpen: (node: Node) => void;
};
/**
* Text alternative for the topology canvas (WCAG 1.1.1): every node with its
* status and what it depends on, operable with the keyboard alone.
*/
export function GraphListView({ nodes, edges, onOpen }: Props) {
const names = new Map(nodes.map((node) => [node.id, (node.data as ServiceNodeData).name]));
// Edges point from a dependency to the service that uses it.
const dependsOn = new Map<string, string[]>();
for (const edge of edges) {
const name = names.get(edge.source);
if (!name) continue;
dependsOn.set(edge.target, [...(dependsOn.get(edge.target) ?? []), name]);
}
const sorted = [...nodes].sort((a, b) =>
(a.data as ServiceNodeData).name.localeCompare((b.data as ServiceNodeData).name),
);
return (
<div className="graph-list" role="region" aria-label="Topologie als lijst">
<ul>
{sorted.map((node) => {
const data = node.data as ServiceNodeData;
const deps = dependsOn.get(node.id) ?? [];
return (
<li key={node.id} className={`status-${data.status}`}>
<button className="ghost" onClick={() => onOpen(node)}>
<span className="graph-list-status">
<StatusIcon status={data.status} /> {statusLabel(data.status)}
</span>
<strong>{data.name}</strong>
{data.rootCause && <span className="graph-list-flag">Hoofdoorzaak</span>}
{!data.rootCause && data.impacted && <span className="graph-list-flag">Geraakt</span>}
</button>
{deps.length > 0 && <small>Hangt af van {deps.join(", ")}</small>}
</li>
);
})}
</ul>
</div>
);
}
+59 -61
View File
@@ -1,5 +1,10 @@
import { Handle, Position, type Node, type NodeProps } from "@xyflow/react";
import { Box, Boxes, Crosshair, Layers } from "lucide-react";
import { StatusIcon } from "../components/StatusIcon";
import { criticalityText, statusText } from "../labels";
import type {
ComponentRole,
Criticality,
@@ -33,63 +38,60 @@ export type ServiceNodeData = {
export type ServiceNode = Node<ServiceNodeData, "service">;
const statusLabel = (status: HealthStatus) =>
status === "unmonitored"
? "Not monitored"
: status[0].toUpperCase() + status.slice(1);
const statusIcon = (status: HealthStatus) =>
({
healthy: "✓",
degraded: "△",
down: "!",
recovering: "↻",
maintenance: "Ⅱ",
unknown: "?",
unmonitored: "○",
})[status];
export const statusLabel = (status: HealthStatus) => statusText(status);
/** Splits "2/4 resolved · 2 unresolved · 1 incident" into separate chips. */
function factChips(text: string | undefined): string[] {
return (text ?? "").split(" · ").map((part) => part.trim()).filter(Boolean);
}
export function ServiceNodeView({ data }: NodeProps<ServiceNode>) {
const targetLabel =
data.nodeKind === "domain"
? `${data.memberIds?.length ?? 0} components`
: data.applicationNode
? `${data.monitoredComponents ?? 0} resolved · ${data.unmonitoredComponents ?? 0} unresolved`
: data.latency != null
? `${data.latency} ms · ${data.kind.toUpperCase()}`
: data.kind.toUpperCase();
const kind = data.nodeKind ?? (data.applicationNode ? "application" : "component");
const KindIcon = kind === "domain" ? Layers : kind === "application" ? Boxes : Box;
const memberCount = data.memberIds?.length ?? 0;
const kicker =
kind === "domain"
? `Domein · ${memberCount} ${memberCount === 1 ? "component" : "componenten"}`
: kind === "application"
? `Applicatie · ${memberCount} ${memberCount === 1 ? "component" : "componenten"}`
: `${data.role ?? data.category.replace("_", " ")} · ${data.kind.toUpperCase()}`;
const chips =
kind === "domain"
? factChips(data.explanation)
: kind === "application"
? [`${data.monitoredComponents ?? 0} opgelost`, `${data.unmonitoredComponents ?? 0} onopgelost`]
: [
...(data.latency != null ? [`${data.latency} ms`] : []),
`${data.dependencyCount} ${data.dependencyCount === 1 ? "afhankelijkheid" : "afhankelijkheden"}`,
];
const note = kind === "domain" ? null : data.explanation;
return (
<>
<Handle type="target" position={Position.Left} />
<div
className={`service-node-body status-${data.status}`}
aria-label={`${data.name}, ${statusLabel(data.status)}${data.rootCause ? ", likely root cause" : ""}`}
className={`service-node-body node-${kind}`}
aria-label={`${data.name}, ${statusLabel(data.status)}${data.rootCause ? ", waarschijnlijke hoofdoorzaak" : ""}`}
>
<div className="node-badges">
{data.rootCause && (
<span className="node-badge root-cause-badge">ROOT CAUSE</span>
)}
{!data.rootCause && data.impacted && (
<span className="node-badge impacted-badge">IMPACTED</span>
)}
{data.flapping && (
<span className="node-badge flap-badge">FLAPPING</span>
)}
<div className="node-head">
<KindIcon className="node-kind-icon" size={13} aria-hidden="true" />
<span className="node-kicker">{kicker}</span>
</div>
{data.nodeKind === "domain" && (
<span className="node-kicker">
DOMAIN · {data.memberIds?.length ?? 0} components
<strong className="node-name">{data.name}</strong>
<div className="node-state">
<span className={`node-status status-${data.status}`}>
<StatusIcon status={data.status} />
{statusLabel(data.status)}
</span>
)}
{data.applicationNode && (
<span className="node-kicker">
APPLICATION · {data.memberIds?.length ?? 0} components
</span>
)}
{data.applicationNode && data.roles?.length ? (
<span
className="app-micro-topology"
aria-label={`Component roles: ${data.roles.join(", ")}`}
>
{data.rootCause && (
<span className="node-flag root-cause-badge">
<Crosshair size={12} aria-hidden="true" />
Hoofdoorzaak
</span>
)}
{!data.rootCause && data.impacted && <span className="node-flag impacted-badge">Geraakt</span>}
{data.flapping && <span className="node-flag flap-badge">Wisselvallig</span>}
</div>
{kind === "application" && data.roles?.length ? (
<span className="app-micro-topology" aria-label={`Componentrollen: ${data.roles.join(", ")}`}>
{data.roles.slice(0, 5).map((role) => (
<i key={role} className={`role-${role}`}>
{role.slice(0, 1).toUpperCase()}
@@ -97,19 +99,15 @@ export function ServiceNodeView({ data }: NodeProps<ServiceNode>) {
))}
</span>
) : null}
{data.nodeKind === "component" && (
<span className="node-kicker">{data.role ?? data.category}</span>
)}
<strong>{data.name}</strong>
<span className={`node-status status-${data.status}`}>
<i aria-hidden="true">{statusIcon(data.status)}</i>{" "}
{statusLabel(data.status)}
</span>
<small>{targetLabel} · {data.criticality}</small>
<small>
{data.explanation ??
`${data.category.replace("_", " ")} · ${data.dependencyCount} ${data.dependencyCount === 1 ? "dependency" : "dependencies"}`}
</small>
<div className="node-chips">
<span className={`node-chip criticality-${data.criticality}`}>{criticalityText(data.criticality)}</span>
{chips.map((chip) => (
<span key={chip} className={`node-chip${/incident/.test(chip) ? " node-chip-alert" : ""}`}>
{chip}
</span>
))}
</div>
{note && <small className="node-note">{note}</small>}
</div>
<Handle type="source" position={Position.Right} />
</>
+24 -21
View File
@@ -1,6 +1,7 @@
import type { Dispatch, SetStateAction } from "react";
import type { Criticality, HealthStatus, MonitoringState } from "../api";
import { MONITORING_LABELS, criticalityText, lifecycleText, modeText, statusText } from "../labels";
import {
domainLocation,
isTopologyRoot,
@@ -10,7 +11,7 @@ import {
} from "../topologyNavigation";
export type TopologyMode = "landscape" | "dependencies" | "impact";
export type FilterStatus = "all" | "unresolved" | HealthStatus;
export type FilterStatus = "all" | "unresolved" | "problems" | HealthStatus;
export type MonitoringFilter = "all" | MonitoringState;
type TopologyCommandBarProps = {
@@ -99,18 +100,18 @@ export function TopologyCommandBar({
lifecycleFilter,
].filter((value) => value !== "all").length;
return (
<section className="topology-command-bar" aria-label="Topology commands">
<div className="topology-breadcrumbs" aria-label="Topology hierarchy">
<section className="topology-command-bar" aria-label="Topologieopdrachten">
<div className="topology-breadcrumbs" aria-label="Topologiehiërarchie">
{!isTopologyRoot(location) && (
<button
className="ghost compact-button"
onClick={() => setLocation((current) => topologyUp(current))}
>
← Back
← Terug
</button>
)}
<button className="text-button" onClick={() => setLocation(topologyRoot())}>
Infrastructure
Infrastructuur
</button>
{selectedDomain && (
<>
@@ -144,20 +145,22 @@ export function TopologyCommandBar({
>
{candidate === "impact"
? "Impact"
: candidate[0].toUpperCase() + candidate.slice(1)}
: modeText(candidate)}
</button>
))}
<input
aria-label="Search topology"
aria-label="Topologie doorzoeken"
value={search}
onChange={(event) => setSearch(event.target.value)}
placeholder="Search topology"
placeholder="Topologie doorzoeken"
/>
<button
className={statusFilter === "down" || statusFilter === "degraded" ? "compact-button" : "ghost compact-button"}
onClick={() => setStatusFilter(statusFilter === "all" ? "down" : "all")}
className={statusFilter === "problems" ? "compact-button" : "ghost compact-button"}
aria-pressed={statusFilter === "problems"}
title="Uitgevallen, verminderd en herstellend"
onClick={() => setStatusFilter(statusFilter === "problems" ? "all" : "problems")}
>
Problems only
Alleen problemen
</button>
<details
className="filter-popover"
@@ -166,18 +169,18 @@ export function TopologyCommandBar({
>
<summary>Filters{activeFilterCount ? ` (${activeFilterCount})` : ""}</summary>
<div>
<label>Status<select aria-label="Filter topology by status" value={statusFilter} onChange={(event) => setStatusFilter(event.target.value as FilterStatus)}><option value="all">All status</option><option value="unresolved">Unresolved health</option>{(["healthy", "degraded", "down", "recovering", "unmonitored", "unknown", "maintenance"] as HealthStatus[]).map((item) => <option key={item} value={item}>{item === "unmonitored" ? "Not monitored" : item}</option>)}</select></label>
<label>Monitoring<select aria-label="Filter topology by monitoring source" value={monitoringFilter} onChange={(event) => setMonitoringFilter(event.target.value as MonitoringFilter)}><option value="all">Any source</option>{(["active_probe", "docker_health", "appops_observation", "observed", "unmonitored"] as MonitoringState[]).map((item) => <option key={item} value={item}>{item.replaceAll("_", " ")}</option>)}</select></label>
<label>Domain<select aria-label="Filter topology by domain" value={domainFilter} onChange={(event) => setDomainFilter(event.target.value)}><option value="all">All domains</option>{domains.map((item) => <option key={item}>{item}</option>)}</select></label>
<label>Application<select aria-label="Filter topology by application" value={applicationFilter} onChange={(event) => setApplicationFilter(event.target.value)}><option value="all">All applications</option>{applications.map((item) => <option key={item}>{item}</option>)}</select></label>
<label>Environment<select aria-label="Filter topology by environment" value={environmentFilter} onChange={(event) => setEnvironmentFilter(event.target.value)}><option value="all">All environments</option>{environments.map((item) => <option key={item}>{item}</option>)}</select></label>
<label>Criticality<select aria-label="Filter topology by criticality" value={criticalityFilter} onChange={(event) => setCriticalityFilter(event.target.value)}><option value="all">All criticality</option>{(["low", "medium", "high", "critical"] as Criticality[]).map((item) => <option key={item}>{item}</option>)}</select></label>
<label>Lifecycle<select aria-label="Filter topology by lifecycle" value={lifecycleFilter} onChange={(event) => setLifecycleFilter(event.target.value)}><option value="all">All lifecycle</option>{["active", "missing", "stale", "retired", "ignored"].map((item) => <option key={item}>{item}</option>)}</select></label>
<label>Status<select aria-label="Topologie filteren op status" value={statusFilter} onChange={(event) => setStatusFilter(event.target.value as FilterStatus)}><option value="all">Alle statussen</option><option value="problems">Problemen (uitgevallen, verminderd, herstellend)</option><option value="unresolved">Onopgeloste gezondheid</option>{(["healthy", "degraded", "down", "recovering", "unmonitored", "unknown", "maintenance"] as HealthStatus[]).map((item) => <option key={item} value={item}>{statusText(item)}</option>)}</select></label>
<label>Bewaking<select aria-label="Topologie filteren op bewakingsbron" value={monitoringFilter} onChange={(event) => setMonitoringFilter(event.target.value as MonitoringFilter)}><option value="all">Elke bron</option>{(["active_probe", "docker_health", "appops_observation", "observed", "unmonitored"] as MonitoringState[]).map((item) => <option key={item} value={item}>{MONITORING_LABELS[item] ?? item.replaceAll("_", " ")}</option>)}</select></label>
<label>Domein<select aria-label="Topologie filteren op domein" value={domainFilter} onChange={(event) => setDomainFilter(event.target.value)}><option value="all">Alle domeinen</option>{domains.map((item) => <option key={item}>{item}</option>)}</select></label>
<label>Applicatie<select aria-label="Topologie filteren op applicatie" value={applicationFilter} onChange={(event) => setApplicationFilter(event.target.value)}><option value="all">Alle applicaties</option>{applications.map((item) => <option key={item}>{item}</option>)}</select></label>
<label>Omgeving<select aria-label="Topologie filteren op omgeving" value={environmentFilter} onChange={(event) => setEnvironmentFilter(event.target.value)}><option value="all">Alle omgevingen</option>{environments.map((item) => <option key={item}>{item}</option>)}</select></label>
<label>Kritiek<select aria-label="Topologie filteren op kritiek" value={criticalityFilter} onChange={(event) => setCriticalityFilter(event.target.value)}><option value="all">Alle kritiekniveaus</option>{(["low", "medium", "high", "critical"] as Criticality[]).map((item) => <option key={item} value={item}>{criticalityText(item)}</option>)}</select></label>
<label>Levenscyclus<select aria-label="Topologie filteren op levenscyclus" value={lifecycleFilter} onChange={(event) => setLifecycleFilter(event.target.value)}><option value="all">Alle levenscycli</option>{["active", "missing", "stale", "retired", "ignored"].map((item) => <option key={item} value={item}>{lifecycleText(item)}</option>)}</select></label>
</div>
</details>
<button className="ghost compact-button" onClick={onFit}>Fit</button>
<button className="ghost compact-button" onClick={onArrange}>Arrange</button>
<button className="ghost compact-button" onClick={onToggleInspector}>{inspectorOpen ? "Hide details" : "Details"}</button>
<button className="ghost compact-button" onClick={onFit}>Passend</button>
<button className="ghost compact-button" onClick={onArrange}>Schikken</button>
<button className="ghost compact-button" onClick={onToggleInspector}>{inspectorOpen ? "Details verbergen" : "Details"}</button>
</div>
{activeFilters
.filter((item) => item.value !== "all")
@@ -0,0 +1,69 @@
import { describe, expect, it } from "vitest";
import type { HealthStatus, SemanticTopology } from "../api";
import { matchesStatusFilter, semanticTopologyGraph } from "./semanticGraph";
function component(id: string, application: string, status: HealthStatus, dependencies: string[] = []) {
return {
service_id: id,
name: id.toUpperCase(),
kind: "http" as const,
application_id: application,
domain_id: "platform",
role: "api" as const,
direct_status: status,
effective_status: status,
unknown_reason: null,
runtime_state: "running",
runtime_health: status,
monitoring_state: "active_probe" as const,
latest_latency_ms: null,
dependency_ids: dependencies,
dependent_ids: [],
root_cause: false,
affected: false,
};
}
function topology(): SemanticTopology {
return {
generated_at: "2026-11-17T12:00:00Z",
domains: [],
applications: [],
components: [
component("api", "shop", "healthy", ["db"]),
component("db", "shop", "degraded"),
component("worker", "shop", "down", ["db"]),
component("cache", "shop", "recovering"),
],
relations: [],
monitoring_coverage: {},
} as unknown as SemanticTopology;
}
describe("semantic topology filters and facts", () => {
it("'problems' covers down, degraded and recovering", () => {
expect(["down", "degraded", "recovering"].every((status) => matchesStatusFilter(status, "problems"))).toBe(true);
expect(matchesStatusFilter("healthy", "problems")).toBe(false);
const graph = semanticTopologyGraph(topology(), "components", "shop", false, "", "problems");
expect(graph.nodes.map((node) => node.id).sort()).toEqual(["cache", "db", "worker"]);
});
it("applies per-service attribute filters and real criticality/flapping", () => {
const graph = semanticTopologyGraph(topology(), "components", "shop", false, "", "all", {
serviceFacts: (id) => (id === "db" ? { criticality: "critical", flapping: true } : { criticality: "low", flapping: false }),
serviceFilter: (id) => id !== "cache",
});
expect(graph.nodes.map((node) => node.id).sort()).toEqual(["api", "db", "worker"]);
const db = graph.nodes.find((node) => node.id === "db");
expect(db?.data.criticality).toBe("critical");
expect(db?.data.flapping).toBe(true);
expect(graph.nodes.find((node) => node.id === "api")?.data.criticality).toBe("low");
});
it("draws relations dependency -> dependent and counts nothing hidden at component level", () => {
const graph = semanticTopologyGraph(topology(), "components", "shop", false, "", "all");
expect(graph.edges.map((edge) => `${edge.source}->${edge.target}`).sort()).toEqual(["db->api", "db->worker"]);
expect(graph.hiddenEdgeCount).toBe(0);
});
});
+59 -16
View File
@@ -1,10 +1,42 @@
import { MarkerType, type Edge } from "@xyflow/react";
import type { HealthStatus, SemanticTopology } from "../api";
import type { Criticality, HealthStatus, SemanticTopology } from "../api";
import type { ServiceNode } from "./ServiceNode";
export type SemanticView = "domains" | "applications" | "components";
export type SemanticFilterStatus = "all" | "unresolved" | HealthStatus;
export type SemanticFilterStatus = "all" | "unresolved" | "problems" | HealthStatus;
/** Statuses that "Problems only" shows: anything needing attention. */
export const PROBLEM_STATUSES: ReadonlySet<string> = new Set(["down", "degraded", "recovering"]);
export function matchesStatusFilter(status: string, filter: SemanticFilterStatus): boolean {
if (filter === "all") return true;
if (filter === "unresolved") return status === "unknown" || status === "unmonitored";
if (filter === "problems") return PROBLEM_STATUSES.has(status);
return status === filter;
}
const CRITICALITY_RANK: Record<Criticality, number> = { low: 0, medium: 1, high: 2, critical: 3 };
export type ServiceFacts = { criticality: Criticality; flapping: boolean };
export type SemanticGraphOptions = {
/** Per-service facts the semantic projection does not carry. */
serviceFacts?: (serviceId: string) => ServiceFacts | undefined;
/**
* Extra filters (domain, application, environment, criticality, lifecycle,
* monitoring, group) evaluated per service. A domain or application node is
* shown when at least one of its components matches.
*/
serviceFilter?: (serviceId: string) => boolean;
};
export type SemanticGraph = {
nodes: ServiceNode[];
edges: Edge[];
/** Relations not drawn because of the per-level cap or the weight rule. */
hiddenEdgeCount: number;
};
/** Projects canonical services and relationships into the active semantic level. */
export function semanticTopologyGraph(
@@ -14,7 +46,21 @@ export function semanticTopologyGraph(
incidentOnly: boolean,
search: string,
statusFilter: SemanticFilterStatus,
): { nodes: ServiceNode[]; edges: Edge[] } {
options: SemanticGraphOptions = {},
): SemanticGraph {
const facts = (ids: string[]): ServiceFacts => {
let criticality: Criticality = "low";
let flapping = false;
let known = false;
for (const id of ids) {
const item = options.serviceFacts?.(id);
if (!item) continue;
known = true;
if (CRITICALITY_RANK[item.criticality] > CRITICALITY_RANK[criticality]) criticality = item.criticality;
flapping ||= item.flapping;
}
return known ? { criticality, flapping } : { criticality: "medium", flapping: false };
};
const applicationById = new Map(
topology.applications.map((item) => [item.id, item]),
);
@@ -51,14 +97,13 @@ export function semanticTopologyGraph(
rootCause: domain.root_cause,
impacted: domain.affected,
group: domain.name,
criticality: "medium",
flapping: false,
...facts(domain.application_ids.flatMap((id) => applicationById.get(id)?.component_ids ?? [])),
category: "domain",
memberIds: domain.application_ids.flatMap(
(id) => applicationById.get(id)?.component_ids ?? [],
),
nodeKind: "domain",
explanation: `${domain.resolved_application_count}/${domain.application_count} resolved · ${domain.unresolved_application_count} unresolved${domain.incident_count ? ` · ${domain.incident_count} incident` : ""}`,
explanation: `${domain.resolved_application_count}/${domain.application_count} opgelost · ${domain.unresolved_application_count} onopgelost${domain.incident_count ? ` · ${domain.incident_count} incident` : ""}`,
},
className: `service-node domain-node status-${domain.status}`,
}))
@@ -77,8 +122,7 @@ export function semanticTopologyGraph(
rootCause: app.root_cause,
impacted: app.affected,
group: domainById.get(app.domain_id)?.name ?? null,
criticality: "medium",
flapping: false,
...facts(app.component_ids),
category: "application",
application: app.name,
applicationNode: true,
@@ -106,20 +150,21 @@ export function semanticTopologyGraph(
impacted: component.affected,
group:
applicationById.get(component.application_id)?.name ?? null,
criticality: "medium",
flapping: false,
...facts([component.service_id]),
category: component.role,
nodeKind: "component",
role: component.role,
explanation: component.unknown_reason
? `${component.unknown_reason.replaceAll("_", " ")} · ${component.dependent_ids.length} dependents`
: `${component.monitoring_state.replace("_", " ")} · ${component.dependent_ids.length} dependents`,
? `${component.unknown_reason.replaceAll("_", " ")} · ${component.dependent_ids.length} afhankelijken`
: `${component.monitoring_state.replace("_", " ")} · ${component.dependent_ids.length} afhankelijken`,
},
className: `service-node component-node status-${component.effective_status}`,
}));
const normalizedSearch = search.trim().toLocaleLowerCase();
const serviceFilter = options.serviceFilter;
const visibleNodes = nodes.filter((node) => {
const descendants = node.data.memberIds ?? [node.id];
if (serviceFilter && !descendants.some((serviceId) => serviceFilter(serviceId))) return false;
const descendantMatches = descendants.some((serviceId) =>
componentById
.get(serviceId)
@@ -132,10 +177,7 @@ export function semanticTopologyGraph(
.toLocaleLowerCase()
.includes(normalizedSearch) ||
descendantMatches) &&
(statusFilter === "all" ||
(statusFilter === "unresolved"
? ["unknown", "unmonitored"].includes(node.data.status)
: node.data.status === statusFilter))
matchesStatusFilter(node.data.status, statusFilter)
);
});
const nodeIds = new Set(visibleNodes.map((node) => node.id));
@@ -244,6 +286,7 @@ export function semanticTopologyGraph(
);
return {
nodes: visibleNodes,
hiddenEdgeCount: projectedEdges.length - visibleEdges.length,
edges: visibleEdges.map((edge) => ({
id: edge.id,
source: edge.source,
+29
View File
@@ -0,0 +1,29 @@
import { describe, expect, it } from "vitest";
import type { Edge, Node } from "@xyflow/react";
import { arrangeTopology, clearTopologyLayoutCache, topologyStructureKey } from "./topologyLayout";
const node = (id: string): Node => ({ id, position: { x: 0, y: 0 }, data: {} });
describe("topology layout", () => {
it("lays out in-thread without Worker support and reuses cached results", async () => {
clearTopologyLayoutCache();
const nodes = [node("a"), node("b")];
const edges: Edge[] = [{ id: "a-b", source: "a", target: "b" }];
const first = await arrangeTopology(nodes, edges);
expect(Object.keys(first.positions).sort()).toEqual(["a", "b"]);
expect(await arrangeTopology(nodes, edges)).toBe(first);
});
it("keeps the layout cache bounded", async () => {
clearTopologyLayoutCache();
const firstNodes = [node("n0")];
const first = await arrangeTopology(firstNodes, []);
for (let index = 1; index <= 40; index += 1) {
await arrangeTopology([node(`n${index}`)], []);
}
// The oldest entry was evicted, so a fresh object is computed.
expect(await arrangeTopology(firstNodes, [])).not.toBe(first);
expect(topologyStructureKey(firstNodes, [])).toBe("n0|");
});
});
+48 -11
View File
@@ -1,7 +1,7 @@
import type ElkConstructor from "elkjs/lib/elk.bundled.js";
import type ElkApi from "elkjs/lib/elk-api.js";
import type { Edge, Node } from "@xyflow/react";
type ElkInstance = InstanceType<typeof ElkConstructor>;
type ElkInstance = InstanceType<typeof ElkApi>;
export type TopologyRoute = { x: number; y: number }[];
export type TopologyLayout = {
@@ -14,13 +14,42 @@ type ElkRoutedEdge = {
sections?: { startPoint?: ElkPoint; bendPoints?: ElkPoint[]; endPoint?: ElkPoint }[];
};
let elk: ElkInstance | null = null;
/** Must match the node card size in styles.css (.service-node-body). */
export const NODE_WIDTH = 236;
export const NODE_HEIGHT = 128;
let elk: Promise<ElkInstance> | null = null;
/** Bounded LRU: every distinct filter/scope combination used to stay forever. */
const CACHE_LIMIT = 30;
const cache = new Map<string, TopologyLayout>();
async function layoutEngine(): Promise<ElkInstance> {
if (elk) return elk;
const { default: ElkConstructor } = await import("elkjs/lib/elk.bundled.js");
elk = new ElkConstructor();
function remember(key: string, layout: TopologyLayout): void {
cache.delete(key);
cache.set(key, layout);
while (cache.size > CACHE_LIMIT) {
const oldest = cache.keys().next().value;
if (oldest === undefined) break;
cache.delete(oldest);
}
}
/**
* ELK runs in a Web Worker so a large layout never blocks the main thread
* (drag, scroll and SSE updates stay responsive). Environments without
* Worker support (unit tests) fall back to the in-thread bundle.
*/
function layoutEngine(): Promise<ElkInstance> {
elk ??= (async () => {
if (typeof Worker !== "undefined") {
const [{ default: Elk }, { default: workerUrl }] = await Promise.all([
import("elkjs/lib/elk-api.js"),
import("elkjs/lib/elk-worker.min.js?url"),
]);
return new Elk({ workerUrl });
}
const { default: Bundled } = await import("elkjs/lib/elk.bundled.js");
return new Bundled() as unknown as ElkInstance;
})();
return elk;
}
@@ -41,7 +70,10 @@ export async function arrangeTopology(
): Promise<TopologyLayout> {
const key = topologyStructureKey(nodes, edges);
const cached = cache.get(key);
if (cached) return cached;
if (cached) {
remember(key, cached);
return cached;
}
const layout = await (await layoutEngine()).layout({
id: "servicemap-topology",
layoutOptions: {
@@ -51,10 +83,15 @@ export async function arrangeTopology(
"elk.layered.nodePlacement.strategy": "NETWORK_SIMPLEX",
"elk.layered.crossingMinimization.strategy": "LAYER_SWEEP",
"elk.spacing.nodeNode": "44",
"elk.layered.spacing.nodeNodeBetweenLayers": "92",
"elk.layered.spacing.nodeNodeBetweenLayers": "110",
// Keep parallel orthogonal routes apart instead of stacking them into one "comb".
"elk.spacing.edgeEdge": "16",
"elk.layered.spacing.edgeEdgeBetweenLayers": "16",
"elk.layered.spacing.edgeNodeBetweenLayers": "28",
"elk.layered.mergeEdges": "false",
"elk.padding": "[top=42,left=42,bottom=42,right=42]",
},
children: nodes.map((node) => ({ id: node.id, width: 230, height: 132 })),
children: nodes.map((node) => ({ id: node.id, width: NODE_WIDTH, height: NODE_HEIGHT })),
edges: edges.map((edge) => ({
id: edge.id,
sources: [edge.source],
@@ -79,7 +116,7 @@ export async function arrangeTopology(
]),
);
const result = { positions, routes };
cache.set(key, result);
remember(key, result);
return result;
}