Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Open Patrol's thresholds link on the resource's own row
rcourtman482373a8750e
diff --git a/docs/release-control/v6/internal/subsystems/alerts.md b/docs/release-control/v6/internal/subsystems/alerts.mdindex 9e9efb7b70..a4790de047 100644--- a/docs/release-control/v6/internal/subsystems/alerts.md+++ b/docs/release-control/v6/internal/subsystems/alerts.md@@ -2999,6 +2999,22 @@ the active app locale.The Recovery section is a thresholds deep link: `/alerts/thresholds/proxmox#backups`expands and scrolls to it like `#pbs` and `#pmg` (`useThresholdsTableState.test.tsx`).++The thresholds resource search is route state: `useThresholdsTableState`+reads and writes `?q=` (`ALERT_THRESHOLDS_QUERY_PARAMS.query`) with replace+navigation, keeps it across platform tab clicks, section hashes and the+legacy-path redirects, so a link from elsewhere can open a tab already+searched to one resource (`buildAlertThresholdsPath`). Host and Docker host+rows match the search on their shown, display and raw names+(`matchesThresholdResourceSearch`), because a link carries the full display+label while those rows show a shortened name and keep the label as their raw+name. Because each search edit navigates within the+page, the Alerts page's unsaved-changes guard asks only when the destination+path differs (`shouldConfirmAlertsLeave` in `alertConfigPresentation.ts`):+narrowing the list keeps an unsaved edit without a prompt, leaving the page+still asks (`useThresholdsTableState.test.tsx`,+`alertConfigPresentation.test.ts`, `Alerts.helpers.test.ts`).+A successful Alerts page save re-reads the shared `alertsActivation` config in`useAlertsConfigurationState.ts` (only when the config write landed and thesave still owns the editor), because backup shields and metric colours ondiff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.mdindex 1043cfeb08..5af7bd6dc9 100644--- a/docs/release-control/v6/internal/subsystems/api-contracts.md+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md@@ -603,6 +603,11 @@ presented as interchangeable totals.`GET /api/resources/{id}` for the subject's platform and falls back to thetype hint, so both fields must keep naming the subject the alert or findingis about (an alert's `unifiedAlertType` display words are accepted as hints).++The same resolution picks the thresholds tab and search behind the alert-only+guidance link, so the registry resource's display label must stay the label+the thresholds rows are built from (`getAlertResourceDisplayLabel`).+The attention list's authenticated read contract is independent of Patrol'smodel-readiness and on/off state. `PatrolIntelligenceSurface.tsx` must not gatethe attention transport or its canonical list on `shouldShowPatrolSetupOnly`;diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.mdindex d9d6314441..3a76dcb893 100644--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md@@ -8872,6 +8872,14 @@ own. `ProxmoxPageSurface` passes `routeActive` to the Storage surface it keepsmounted behind its other tabs, so a guest tab's `?resource=` link is not readas a storage deep link.+### Thresholds search is a route search++The thresholds resource search writes `?q=` through `navigate(..., { replace:+true })` instead of a component signal, so a deep link, a reload and the back+button all keep the narrowed list. Pages with an unsaved-changes leave guard+must compare the destination path, not every navigation, before asking, or a+route-owned search prompts on every keystroke (`shouldConfirmAlertsLeave`).+### Alert groups use the shared localization boundaryAlert group disclosure and group acknowledgement copy routes throughdiff --git a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md b/docs/release-control/v6/internal/subsystems/patrol-intelligence.mdindex c2f8380669..1506f9060c 100644--- a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md+++ b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md@@ -2828,6 +2828,21 @@ the owning tab. A subject that names no platform hides the link rather thanopening a page without it (`resourcePagePath.test.ts`,`PatrolAttentionWorkbench.test.tsx`).+### Alert-only guidance links to the subject's thresholds++A decision about a bare alert tells the operator to adjust when the alert+fires or turn it off under alert thresholds. Its `Adjust alert thresholds`+link used to open `/alerts/thresholds`, the top of the Proxmox tab, whatever+the subject was. The workbench now builds it with+`buildResourceThresholdsPath`+(`frontend-modern/src/features/platformNavigation/resourcePagePath.ts`) from+the same resolved subject as `Open resource`: the platform picks the+thresholds tab (standalone agents open Systems) and the resource's display+label, the one its thresholds row is built from, fills the thresholds search. A composed label such as `Disk (node)` and a physical+disk, which has no thresholds row of its own, open the tab unsearched rather+than a search that hides every row (`resourcePagePath.test.ts`,+`PatrolAttentionWorkbench.test.tsx`).+### A used-up cost budget pauses Patrol visiblyPatrol distinguishes "Pulse declined to spend" from "the provider failed".diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.mdindex 65a8b34be7..2e0da76e5a 100644--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md@@ -6569,6 +6569,14 @@ listed yet opens when its record arrives. Once a visit has needed a lookup,any pool the operator opens or closes outranks the link, whether the lookupor a record update finds the pool first.+### Thresholds deep links open no storage or recovery path++`buildAlertThresholdsPath` in `frontend-modern/src/routing/resourceLinks.ts`+adds only a thresholds tab and its `?q=` name search. It reads no storage or+recovery state and grants no storage action, and Patrol's alert-only guidance+sends a physical disk to its tab unsearched, so it never filters storage or+recovery rows by a disk name they do not carry.+### App-shell AI navigation gating opens no recovery path`App.tsx` now passes the `assistantEnabled` session capability to the keyboarddiff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.mdindex 6f9a117ca3..4521760371 100644--- a/docs/release-control/v6/internal/subsystems/unified-resources.md+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md@@ -2676,6 +2676,12 @@ the Recovery thresholds whose fresh and stale hours colour every backupshield; the backup dialog links there and the thresholds page treats`#backups` like `#pbs` and `#pmg` (`resourceLinks.test.ts`).+`buildAlertThresholdsPath(tab, { query })` builds a thresholds tab address+already searched to one resource through `ALERT_THRESHOLDS_QUERY_PARAMS`,+the `?q=` key the thresholds page owns; callers pass a resource's display+label, never an id, because the thresholds search matches names+(`resourceLinks.test.ts`).+17. Platform table ordering is a two-layer contract. Each platform table'sdefault order is owned by its page model's status-first compare(`compareDockerContainers`, `compareKubernetesPods`, and peers), whichdiff --git a/frontend-modern/browser-verification/52ff75e5846bf2ac.json b/frontend-modern/browser-verification/52ff75e5846bf2ac.jsonnew file mode 100644index 0000000000..18856504b0--- /dev/null+++ b/frontend-modern/browser-verification/52ff75e5846bf2ac.json@@ -0,0 +1,57 @@+{+ "version": 1,+ "base_sha": "cca418cc8a64e3a7a374c26d83e4f3e3f88098fc",+ "verified_at": "2026-10-15T09:52:00Z",+ "result": "passed",+ "changed_paths": [+ "frontend-modern/src/features/alerts/thresholds/hooks/useThresholdsDockerData.ts",+ "frontend-modern/src/features/alerts/thresholds/hooks/useThresholdsHostData.ts",+ "frontend-modern/src/features/alerts/thresholds/hooks/useThresholdsTableState.ts",+ "frontend-modern/src/features/alerts/thresholds/thresholdsResourceModel.ts",+ "frontend-modern/src/features/patrol/PatrolAttentionWorkbench.tsx",+ "frontend-modern/src/features/platformNavigation/resourcePagePath.ts",+ "frontend-modern/src/pages/Alerts.tsx",+ "frontend-modern/src/routing/resourceLinks.ts",+ "frontend-modern/src/utils/alertConfigPresentation.ts"+ ],+ "content_sha256": {+ "frontend-modern/src/features/alerts/thresholds/hooks/useThresholdsDockerData.ts": "4654f132e57efb71bd38a9d252924d513a25d9a16643e37b19a4f5968f19b94a",+ "frontend-modern/src/features/alerts/thresholds/hooks/useThresholdsHostData.ts": "e408196118ebb049de342ce7d237f4e6eb0456d12f49eb33f95e887cba9812ff",+ "frontend-modern/src/features/alerts/thresholds/hooks/useThresholdsTableState.ts": "97d6bddbc81b42dd1f2cd121e7c9045cd8a786cd0995cef3031089484ca33bf0",+ "frontend-modern/src/features/alerts/thresholds/thresholdsResourceModel.ts": "9a3b58efd273c189eca6d8526d519b5219c67a4a05e4c91926a14fcad4e78cc5",+ "frontend-modern/src/features/patrol/PatrolAttentionWorkbench.tsx": "75a31a38c42c9a0b7f0b1532b9d57aa691627a605eba5cf0f21e0794f2b701df",+ "frontend-modern/src/features/platformNavigation/resourcePagePath.ts": "e68f42e30aaf624982ec9c7f57d593436025ac35b133c4f6f83f577660ed4a01",+ "frontend-modern/src/pages/Alerts.tsx": "baf922754878022cb1895c7a421e49171c404974634fd3d21944293027f7bb73",+ "frontend-modern/src/routing/resourceLinks.ts": "73fb1a734d8347866dc68f7886b7bb7dc907210eb8672a0e789fa779432e5c86",+ "frontend-modern/src/utils/alertConfigPresentation.ts": "bcafc0973871f68b381a1e38cfe97c781d250dec1691d0b2c6aaae9bed8c7611"+ },+ "routes": [+ "/patrol",+ "/alerts/thresholds/vmware",+ "/alerts/thresholds/truenas",+ "/alerts/thresholds/docker",+ "/alerts/thresholds/proxmox"+ ],+ "viewports": [+ {+ "width": 1280,+ "height": 800+ },+ {+ "width": 375,+ "height": 812+ }+ ],+ "states": [+ "Before (main): every Patrol alert-only decision linked \"Adjust alert thresholds\" to /alerts/thresholds, the top of the Proxmox tab, whatever its resource",+ "After: each decision links to its platform tab searched to the resource display name (esxi-07.lab.local, Utility Network, Edge Stateful, archive-tier, edge-cold-iscsi on vSphere, archive and tank/projects on TrueNAS, grafana-agent and inventory-api on Docker); every searched page shows that row",+ "A physical disk and composed ZFS labels open the Proxmox tab unsearched instead of a search that hides every row",+ "With an unsaved threshold edit, typing in the search updates ?q= without a leave prompt and keeps the edit; leaving for Docker still asks"+ ],+ "interactions": [+ "Opened every listed Patrol decision and read its Adjust alert thresholds href",+ "Followed each distinct thresholds link and confirmed the resource row is listed",+ "Edited CPU default to 81, retyped the search, then clicked Docker in the navigation menu and declined the prompt",+ "At 375px followed the archive-tier link: vSphere tab, Datastores group with archive-tier only, no horizontal overflow"+ ]+}diff --git a/frontend-modern/src/components/Alerts/__tests__/ThresholdsTable.test.tsx b/frontend-modern/src/components/Alerts/__tests__/ThresholdsTable.test.tsxindex dd57de354b..740c0c636f 100644--- a/frontend-modern/src/components/Alerts/__tests__/ThresholdsTable.test.tsx+++ b/frontend-modern/src/components/Alerts/__tests__/ThresholdsTable.test.tsx@@ -500,7 +500,11 @@ describe('ThresholdsTable navigation and redirection', () => {fireEvent.click(screen.getByRole('button', { name: 'Clear filters' }));expect(search).toHaveValue('');- expect(mockNavigate).not.toHaveBeenCalled();+ // The search lives in the route (?q=), so clearing it rewrites the address+ // in place; it must never leave the Docker tab.+ for (const [path] of mockNavigate.mock.calls) {+ expect(path).toMatch(/^\/alerts\/thresholds\/docker(?:#|$)/);+ }expect(screen.getByRole('tab', { name: 'Docker' })).toHaveAttribute('aria-selected', 'true');});});diff --git a/frontend-modern/src/features/alerts/thresholds/__tests__/thresholdsResourceModel.test.ts b/frontend-modern/src/features/alerts/thresholds/__tests__/thresholdsResourceModel.test.tsindex 07c17b292e..26ea8839fe 100644--- a/frontend-modern/src/features/alerts/thresholds/__tests__/thresholdsResourceModel.test.ts+++ b/frontend-modern/src/features/alerts/thresholds/__tests__/thresholdsResourceModel.test.ts@@ -5,6 +5,7 @@ import type { Resource } from '@/types/resource';import {agentDiskResourceId,hostOverrideIdCandidates,+ matchesThresholdResourceSearch,normalizeStorageStatus,uniqueIds,} from '../thresholdsResourceModel';@@ -57,4 +58,14 @@ describe('thresholdsResourceModel', () => {expect(normalizeStorageStatus('offline')).toBe('offline');expect(normalizeStorageStatus(undefined)).toBe('offline');});++ // A resource search opened from elsewhere carries the registry name, which+ // for hosts can be the full hostname rather than the shown label.+ it('matches a resource search against its shown, display and raw names', () => {+ const host = { name: 'pve1', displayName: 'Primary node', rawName: 'pve1.lab.example' };+ expect(matchesThresholdResourceSearch(host, '')).toBe(true);+ expect(matchesThresholdResourceSearch(host, 'pve1.lab')).toBe(true);+ expect(matchesThresholdResourceSearch(host, 'primary')).toBe(true);+ expect(matchesThresholdResourceSearch(host, 'pve2')).toBe(false);+ });});diff --git a/frontend-modern/src/features/alerts/thresholds/hooks/__tests__/useThresholdsTableState.test.tsx b/frontend-modern/src/features/alerts/thresholds/hooks/__tests__/useThresholdsTableState.test.tsxindex 38eeb1e2d4..2c55903b45 100644--- a/frontend-modern/src/features/alerts/thresholds/hooks/__tests__/useThresholdsTableState.test.tsx+++ b/frontend-modern/src/features/alerts/thresholds/hooks/__tests__/useThresholdsTableState.test.tsx@@ -6,11 +6,12 @@ import { useThresholdsTableState } from '../useThresholdsTableState';let mockPathname = '/alerts/thresholds/systems';let mockHash = '';+let mockSearch = '';const setCollapsedSpy = vi.fn();const navigateSpy = vi.fn();vi.mock('@solidjs/router', () => ({- useLocation: () => ({ pathname: mockPathname, hash: mockHash }),+ useLocation: () => ({ pathname: mockPathname, hash: mockHash, search: mockSearch }),useNavigate: () => navigateSpy,}));@@ -186,6 +187,7 @@ const buildProps = (): ThresholdsTableProps =>beforeEach(() => {mockPathname = '/alerts/thresholds/systems';mockHash = '';+ mockSearch = '';setCollapsedSpy.mockReset();navigateSpy.mockReset();localStorage.clear();@@ -262,4 +264,45 @@ describe('useThresholdsTableState', () => {captured!.registerSection('backups')(section);expect(section.scrollIntoView).toHaveBeenCalledWith({ block: 'start' });});+ // Patrol links a bare alert's decision here to change when that resource's+ // alert fires, so the search must arrive from the link and survive tabs.+ it('keeps the resource search in the route across edits, tabs and redirects', () => {+ mockPathname = '/alerts/thresholds/proxmox';+ mockSearch = '?q=nginx';+ mockHash = '#backups';+ let captured: ReturnType<typeof useThresholdsTableState> | undefined;+ const Harness = () => {+ captured = useThresholdsTableState(buildProps());+ return null;+ };+ render(() => <Harness />);++ expect(captured!.searchTerm()).toBe('nginx');++ captured!.setSearchTerm('web');+ expect(navigateSpy).toHaveBeenLastCalledWith('/alerts/thresholds/proxmox?q=web#backups', {+ replace: true,+ });+ captured!.setSearchTerm('');+ expect(navigateSpy).toHaveBeenLastCalledWith('/alerts/thresholds/proxmox#backups', {+ replace: true,+ });++ captured!.handleTabClick('docker');+ expect(navigateSpy).toHaveBeenLastCalledWith('/alerts/thresholds/docker?q=nginx');+ });++ it('keeps the search when a legacy thresholds address redirects', () => {+ mockPathname = '/alerts/thresholds/containers';+ mockSearch = '?q=nginx';+ const Harness = () => {+ useThresholdsTableState(buildProps());+ return null;+ };+ render(() => <Harness />);++ expect(navigateSpy).toHaveBeenCalledWith('/alerts/thresholds/docker?q=nginx', {+ replace: true,+ });+ });});diff --git a/frontend-modern/src/features/alerts/thresholds/hooks/useThresholdsDockerData.ts b/frontend-modern/src/features/alerts/thresholds/hooks/useThresholdsDockerData.tsindex 3fe978a85b..8f83e87909 100644--- a/frontend-modern/src/features/alerts/thresholds/hooks/useThresholdsDockerData.ts+++ b/frontend-modern/src/features/alerts/thresholds/hooks/useThresholdsDockerData.ts@@ -14,6 +14,7 @@ import {getFriendlyAlertNodeName,getFriendlyNodeName,hasThresholdDiff,+ matchesThresholdResourceSearch,platformData,} from '../thresholdsResourceModel';@@ -81,7 +82,7 @@ export function useThresholdsDockerData(inputs: ThresholdsDataInputs) {});});- return search ? hosts.filter((host) => host.name.toLowerCase().includes(search)) : hosts;+ return search ? hosts.filter((host) => matchesThresholdResourceSearch(host, search)) : hosts;}, []);const dockerContainersByHostId = createMemo(() => {diff --git a/frontend-modern/src/features/alerts/thresholds/hooks/useThresholdsHostData.ts b/frontend-modern/src/features/alerts/thresholds/hooks/useThresholdsHostData.tsindex b4e06a8a1c..22810065a2 100644--- a/frontend-modern/src/features/alerts/thresholds/hooks/useThresholdsHostData.ts+++ b/frontend-modern/src/features/alerts/thresholds/hooks/useThresholdsHostData.ts@@ -13,6 +13,7 @@ import {hasThresholdDiff,hostActionId,hostOverrideIdCandidates,+ matchesThresholdResourceSearch,platformData,readRecord,readString,@@ -81,7 +82,7 @@ export function useThresholdsHostData(inputs: ThresholdsDataInputs) {} satisfies TableResource;});- return search ? nodes.filter((node) => node.name.toLowerCase().includes(search)) : nodes;+ return search ? nodes.filter((node) => matchesThresholdResourceSearch(node, search)) : nodes;}, []);const agentsWithOverrides = createMemo<TableResource[]>((prev = []) => {@@ -155,7 +156,9 @@ export function useThresholdsHostData(inputs: ThresholdsDataInputs) {} satisfies TableResource);});- return search ? agents.filter((agent) => agent.name.toLowerCase().includes(search)) : agents;+ return search+ ? agents.filter((agent) => matchesThresholdResourceSearch(agent, search))+ : agents;}, []);const agentDisksWithOverrides = createMemo<TableResource[]>((prev = []) => {diff --git a/frontend-modern/src/features/alerts/thresholds/hooks/useThresholdsTableState.ts b/frontend-modern/src/features/alerts/thresholds/hooks/useThresholdsTableState.tsindex 776ca89fa5..a24a8747a7 100644--- a/frontend-modern/src/features/alerts/thresholds/hooks/useThresholdsTableState.ts+++ b/frontend-modern/src/features/alerts/thresholds/hooks/useThresholdsTableState.ts@@ -1,5 +1,6 @@import { createEffect, createMemo, createSignal } from 'solid-js';import { useLocation, useNavigate } from '@solidjs/router';+import { ALERT_THRESHOLDS_QUERY_PARAMS } from '@/routing/resourceLinks';import type { PMGThresholdDefaults, SnapshotAlertConfig, BackupAlertConfig } from '@/types/alerts';import { useAlertsActivation } from '@/stores/alertsActivation';@@ -111,7 +112,25 @@ export function useThresholdsTableState(props: ThresholdsTableProps) {}};- const [searchTerm, setSearchTerm] = createSignal('');+ // The resource search is route-owned (`?q=`) so a link can open the+ // thresholds already narrowed to one resource, and a narrowed view survives+ // reload, tab switches and sharing.+ const searchTerm = (): string =>+ new URLSearchParams(location.search ?? '').get(ALERT_THRESHOLDS_QUERY_PARAMS.query) ?? '';+ const setSearchTerm = (value: string): void => {+ const params = new URLSearchParams(location.search ?? '');+ if (value === '') params.delete(ALERT_THRESHOLDS_QUERY_PARAMS.query);+ else params.set(ALERT_THRESHOLDS_QUERY_PARAMS.query, value);+ const query = params.toString();+ navigate(`${location.pathname}${query ? `?${query}` : ''}${location.hash ?? ''}`, {+ replace: true,+ });+ };+ const withSearch = (path: string): string => {+ const query = location.search ?? '';+ const [route, hash] = path.split('#');+ return `${route}${query}${hash ? `#${hash}` : ''}`;+ };const [overrideFilter, setOverrideFilter] = createSignal('all');const [editingId, setEditingId] = createSignal<string | null>(null);const [editingThresholds, setEditingThresholds] = createSignal<@@ -186,17 +205,17 @@ export function useThresholdsTableState(props: ThresholdsTableProps) {createEffect(() => {if (location.pathname === '/alerts/thresholds') {- navigate('/alerts/thresholds/proxmox', { replace: true });+ navigate(withSearch('/alerts/thresholds/proxmox'), { replace: true });return;}if (location.pathname === '/alerts/thresholds/infrastructure') {- navigate('/alerts/thresholds/proxmox', { replace: true });+ navigate(withSearch('/alerts/thresholds/proxmox'), { replace: true });return;}if (location.pathname === '/alerts/thresholds/containers') {- navigate('/alerts/thresholds/docker', { replace: true });+ navigate(withSearch('/alerts/thresholds/docker'), { replace: true });return;}@@ -204,17 +223,17 @@ export function useThresholdsTableState(props: ThresholdsTableProps) {location.pathname === '/alerts/thresholds/mail-gateway' ||location.pathname === '/alerts/thresholds/pmg') {- navigate('/alerts/thresholds/proxmox#pmg', { replace: true });+ navigate(withSearch('/alerts/thresholds/proxmox#pmg'), { replace: true });return;}if (location.pathname === '/alerts/thresholds/pbs') {- navigate('/alerts/thresholds/proxmox#pbs', { replace: true });+ navigate(withSearch('/alerts/thresholds/proxmox#pbs'), { replace: true });return;}if (location.pathname === '/alerts/thresholds/agents') {- navigate('/alerts/thresholds/systems', { replace: true });+ navigate(withSearch('/alerts/thresholds/systems'), { replace: true });}});@@ -227,7 +246,7 @@ export function useThresholdsTableState(props: ThresholdsTableProps) {vmware: '/alerts/thresholds/vmware',systems: '/alerts/thresholds/systems',};- navigate(tabRoutes[tab]);+ navigate(withSearch(tabRoutes[tab]));};const handleDockerIgnoredChange = (value: string) => {diff --git a/frontend-modern/src/features/alerts/thresholds/thresholdsResourceModel.ts b/frontend-modern/src/features/alerts/thresholds/thresholdsResourceModel.tsindex a7c3f7a158..d44b7558da 100644--- a/frontend-modern/src/features/alerts/thresholds/thresholdsResourceModel.ts+++ b/frontend-modern/src/features/alerts/thresholds/thresholdsResourceModel.ts@@ -38,6 +38,19 @@ export const uniqueIds = (...values: unknown[]): string[] => {return ids;};+// A row matches the resource search by the name it shows or the full name it+// stands for: host rows shorten `titan.example.com` to `titan`, and a link+// that searches for the full name must still find the row.+export const matchesThresholdResourceSearch = (+ resource: { name?: string; displayName?: string; rawName?: string },+ search: string,+): boolean => {+ if (!search) return true;+ return [resource.name, resource.displayName, resource.rawName].some((value) =>+ value?.toLowerCase().includes(search),+ );+};+export const createOverridesMap = (overrides: Override[] | undefined) =>new Map((overrides ?? []).map((override) => [override.id, override]));diff --git a/frontend-modern/src/features/patrol/PatrolAttentionWorkbench.tsx b/frontend-modern/src/features/patrol/PatrolAttentionWorkbench.tsxindex b4c383360f..9bbb07decf 100644--- a/frontend-modern/src/features/patrol/PatrolAttentionWorkbench.tsx+++ b/frontend-modern/src/features/patrol/PatrolAttentionWorkbench.tsx@@ -60,7 +60,11 @@ import {parsePatrolAttentionItemId,} from '@/routing/resourceLinks';import { ResourceAPI } from '@/api/resources';-import { buildResourcePagePath } from '@/features/platformNavigation/resourcePagePath';+import {+ buildResourcePagePath,+ buildResourceThresholdsPath,+ type ResourcePageSubject,+} from '@/features/platformNavigation/resourcePagePath';import type { Resource } from '@/types/resource';import type { EvidenceEnvelope } from '@/types/operationalTrust';import type { ActionDetailResponse } from '@/types/actionAudit';@@ -928,16 +932,26 @@ function AttentionDetail(props: {});onCleanup(() => controller.abort());});- const resourceHref = () => {+ const pageSubject = (): ResourcePageSubject | null => {const value = item();if (!value) return null;const resolved = resolvedSubject();- return buildResourcePagePath({+ return {id: value.subjectResourceId,name: value.subjectResourceName,type: value.subjectResourceType,resource: resolved?.id === value.subjectResourceId.trim() ? resolved.resource : null,- });+ };+ };+ const resourceHref = () => {+ const subject = pageSubject();+ return subject ? buildResourcePagePath(subject) : null;+ };+ // A bare alert's lasting control is its thresholds: open the subject's+ // platform tab already searched to it, not the top of every threshold.+ const thresholdsHref = () => {+ const subject = pageSubject();+ return subject ? buildResourceThresholdsPath(subject) : ALERT_THRESHOLDS_PATH;};const openAssistant = () => {const value = detail();@@ -1202,6 +1216,7 @@ function AttentionDetail(props: {item={loaded().item}linkedFindings={linkedFindings()}onOpenFindings={props.onOpenFindings}+ thresholdsHref={thresholdsHref()}/><details class="rounded-lg border border-border-subtle">@@ -1556,6 +1571,7 @@ function AttentionLastingDecisions(props: {item: AttentionItem;linkedFindings: UnifiedFinding[];onOpenFindings?: (item: AttentionItem) => void;+ thresholdsHref: string;}) {const [pending, setPending] = createSignal<PatrolLastingDecision | null>(null);const [note, setNote] = createSignal('');@@ -1654,6 +1670,7 @@ function AttentionLastingDecisions(props: {<AttentionAlertOnlyGuidanceitem={props.item}onOpenFindings={props.onOpenFindings}+ thresholdsHref={props.thresholdsHref}/>}>@@ -1783,6 +1800,7 @@ function AttentionLastingDecisions(props: {function AttentionAlertOnlyGuidance(props: {item: AttentionItem;onOpenFindings?: (item: AttentionItem) => void;+ thresholdsHref: string;}) {return (<div>@@ -1793,7 +1811,7 @@ function AttentionAlertOnlyGuidance(props: {</p><div class="mt-2 flex flex-wrap gap-2"><ButtonLink- href={ALERT_THRESHOLDS_PATH}+ href={props.thresholdsHref}variant="secondary"size="sm"class="min-h-11 sm:min-h-0"diff --git a/frontend-modern/src/features/patrol/__tests__/PatrolAttentionWorkbench.test.tsx b/frontend-modern/src/features/patrol/__tests__/PatrolAttentionWorkbench.test.tsxindex 5ba003213d..5c1f09149c 100644--- a/frontend-modern/src/features/patrol/__tests__/PatrolAttentionWorkbench.test.tsx+++ b/frontend-modern/src/features/patrol/__tests__/PatrolAttentionWorkbench.test.tsx@@ -1334,9 +1334,11 @@ describe('PatrolAttentionWorkbench', () => {/turn it off for Database VM under alert thresholds/i,);expect(screen.queryByRole('list', { name: 'Lasting decisions' })).not.toBeInTheDocument();+ // The thresholds open on the subject's platform tab, searched to it,+ // instead of the top of every threshold section.expect(screen.getByRole('link', { name: 'Adjust alert thresholds' })).toHaveAttribute('href',- '/alerts/thresholds',+ '/alerts/thresholds/proxmox?q=Database+VM',);fireEvent.click(screen.getByRole('button', { name: 'Browse Patrol findings for this resource' }),diff --git a/frontend-modern/src/features/platformNavigation/__tests__/resourcePagePath.test.ts b/frontend-modern/src/features/platformNavigation/__tests__/resourcePagePath.test.tsindex b5003eabd4..90ac6ae716 100644--- a/frontend-modern/src/features/platformNavigation/__tests__/resourcePagePath.test.ts+++ b/frontend-modern/src/features/platformNavigation/__tests__/resourcePagePath.test.ts@@ -1,7 +1,7 @@import { describe, expect, it } from 'vitest';import type { Resource } from '@/types/resource';-import { buildResourcePagePath } from '../resourcePagePath';+import { buildResourcePagePath, buildResourceThresholdsPath } from '../resourcePagePath';const resource = (overrides: Partial<Resource>): Resource =>({ id: 'res-1', name: 'res-1', status: 'online', ...overrides }) as Resource;@@ -224,4 +224,69 @@ describe('buildResourcePagePath', () => {}),).toBe('/standalone/availability');});+ it('opens the thresholds tab that holds a resource, searched to its name', () => {+ expect(buildResourceThresholdsPath({ id: 'c-1', name: 'nginx', type: 'app-container' })).toBe(+ '/alerts/thresholds/docker?q=nginx',+ );+ expect(+ buildResourceThresholdsPath({+ id: 'mock-1-105',+ name: 'postgres-replica-01',+ resource: resource({+ id: 'vm-2e08',+ type: 'vm',+ name: 'postgres-replica-01',+ platformScopes: ['proxmox-pve'],+ }),+ }),+ ).toBe('/alerts/thresholds/proxmox?q=postgres-replica-01');+ expect(+ buildResourceThresholdsPath({+ id: 'agent-1',+ resource: resource({+ id: 'agent-1',+ type: 'agent',+ name: 'Apollo-114',+ platformScopes: ['agent'],+ }),+ }),+ ).toBe('/alerts/thresholds/systems?q=Apollo-114');+ // Threshold rows are built from the display label, not the registry name.+ expect(+ buildResourceThresholdsPath({+ id: 'node-1',+ resource: resource({+ id: 'node-1',+ type: 'agent',+ name: 'titan.example.com',+ displayName: 'Primary',+ platformScopes: ['proxmox-pve'],+ }),+ }),+ ).toBe('/alerts/thresholds/proxmox?q=Primary');+ // A composed record label would match no row and hide them all.+ expect(+ buildResourceThresholdsPath({+ id: 'pve1-local-zfs/zfs-pool:rpool',+ name: 'west-a-service-pool (local-zfs, sdb2)',+ type: 'storage',+ }),+ ).toBe('/alerts/thresholds/proxmox');+ // Physical disks have no threshold rows of their own to search for.+ expect(+ buildResourceThresholdsPath({+ id: 'disk-1',+ type: 'proxmox-disk',+ resource: resource({+ id: 'physical_disk-1',+ type: 'physical_disk' as Resource['type'],+ name: 'Samsung SSD',+ sources: ['proxmox'],+ }),+ }),+ ).toBe('/alerts/thresholds/proxmox');+ expect(buildResourceThresholdsPath({ id: 'x', type: 'something-new' })).toBe(+ '/alerts/thresholds',+ );+ });});diff --git a/frontend-modern/src/features/platformNavigation/resourcePagePath.ts b/frontend-modern/src/features/platformNavigation/resourcePagePath.tsindex b13273b306..1416e95d17 100644--- a/frontend-modern/src/features/platformNavigation/resourcePagePath.ts+++ b/frontend-modern/src/features/platformNavigation/resourcePagePath.ts@@ -1,5 +1,6 @@import type { Resource } from '@/types/resource';import {+ buildAlertThresholdsPath,buildDockerPath,buildKubernetesPath,buildProxmoxPath,@@ -11,7 +12,9 @@ import {DOCKER_QUERY_PARAMS,KUBERNETES_QUERY_PARAMS,STANDALONE_QUERY_PARAMS,+ type AlertThresholdsTab,} from '@/routing/resourceLinks';+import { getPreferredInfrastructureDisplayName } from '@/utils/resourceIdentity';import {collectResourcePlatformEvidence,type PrimaryPlatformNavId,@@ -167,6 +170,51 @@ const withQuery = (path: string, key: string, value: string | undefined): stringreturn trimmed ? `${path}?${new URLSearchParams({ [key]: trimmed }).toString()}` : path;};+/** The primary platform whose pages show a resource, or null. */+export function resolveResourcePlatform(subject: ResourcePageSubject): PrimaryPlatformNavId | null {+ const resource = subject.resource ?? null;+ const hintType = normalizeType(subject.type);+ const type = normalizeType(resource?.type) || hintType;+ return resource+ ? (platformFromResource(resource, type) ?? platformFromTypeHint(hintType))+ : platformFromTypeHint(type);+}++const THRESHOLDS_TAB_BY_PLATFORM: Record<PrimaryPlatformNavId, AlertThresholdsTab> = {+ proxmox: 'proxmox',+ docker: 'docker',+ kubernetes: 'kubernetes',+ truenas: 'truenas',+ vmware: 'vmware',+ standalone: 'systems',+};++/**+ * The alert thresholds tab that holds a resource's rows, searched to the+ * resource's name. A registry resource is searched by its display name, the+ * label its thresholds row is built from (`getAlertResourceDisplayLabel`),+ * which can differ from its registry name. Otherwise a record name that is+ * not a composed label such as `pool (local-zfs, sda2)` is used, and physical+ * disks (which have no rows of their own there) get none: a search that+ * matches nothing would hide every row.+ */+export function buildResourceThresholdsPath(subject: ResourcePageSubject): string {+ const platform = resolveResourcePlatform(subject);+ const recordName = subject.name?.trim();+ const isDisk =+ DISK_TYPES.has(normalizeType(subject.resource?.type)) ||+ DISK_TYPES.has(normalizeType(subject.type));+ const shownName = subject.resource+ ? getPreferredInfrastructureDisplayName(subject.resource) || subject.resource.name?.trim()+ : '';+ const query = isDisk+ ? ''+ : shownName || (recordName && !/[()]/.test(recordName) ? recordName : '');+ return buildAlertThresholdsPath(platform ? THRESHOLDS_TAB_BY_PLATFORM[platform] : undefined, {+ query,+ });+}+/*** The page that shows a resource, selecting or filtering to it where that* page can: `?resource=` on workload and Proxmox storage tables (resolved@@ -180,9 +228,7 @@ export function buildResourcePagePath(subject: ResourcePageSubject): string | nuconst type = normalizeType(resource?.type) || hintType;const id = (resource?.id ?? subject.id).trim();const name = (resource?.name ?? subject.name)?.trim();- const platform = resource- ? (platformFromResource(resource, type) ?? platformFromTypeHint(hintType))- : platformFromTypeHint(type);+ const platform = resolveResourcePlatform(subject);// A resolved type can be generic (`storage`, `agent`) where the hint is// specific (`truenas-disk`, `vmware-host`); either may name the kind.const isGuest = GUEST_TYPES.has(type);diff --git a/frontend-modern/src/pages/Alerts.tsx b/frontend-modern/src/pages/Alerts.tsxindex 320d8f175d..d7d2123510 100644--- a/frontend-modern/src/pages/Alerts.tsx+++ b/frontend-modern/src/pages/Alerts.tsx@@ -33,7 +33,10 @@ import {getAlertOverviewHydrationState,getAlertsPageHeaderMeta,} from '@/utils/alertOverviewPresentation';-import { getAlertConfigLeaveConfirmation } from '@/utils/alertConfigPresentation';+import {+ getAlertConfigLeaveConfirmation,+ shouldConfirmAlertsLeave,+} from '@/utils/alertConfigPresentation';import { useAlertsActivation } from '@/stores/alertsActivation';import LayoutDashboard from 'lucide-solid/icons/layout-dashboard';import History from 'lucide-solid/icons/history';@@ -181,12 +184,13 @@ export function Alerts() {});});- // Warn when navigating within the app+ // Warn when navigating within the app. Narrowing the same page (the+ // thresholds search lives in `?q=`, sections in `#`) keeps the edits, so it+ // must not ask on every keystroke.useBeforeLeave((e) => {- if (hasUnsavedChanges()) {- if (!confirm(getAlertConfigLeaveConfirmation())) {- e.preventDefault();- }+ if (!shouldConfirmAlertsLeave(e.to, e.from.pathname, hasUnsavedChanges())) return;+ if (!confirm(getAlertConfigLeaveConfirmation())) {+ e.preventDefault();}});diff --git a/frontend-modern/src/pages/__tests__/Alerts.helpers.test.ts b/frontend-modern/src/pages/__tests__/Alerts.helpers.test.tsindex bff8e75785..c52ce3b0b7 100644--- a/frontend-modern/src/pages/__tests__/Alerts.helpers.test.ts+++ b/frontend-modern/src/pages/__tests__/Alerts.helpers.test.ts@@ -325,6 +325,9 @@ describe('tab path helpers', () => {);expect(alertsPageSource).toContain('getAlertsTabGroups({ readOnly: readOnlySession() })');expect(alertsPageSource).toContain('touch-scroll');+ expect(alertsPageSource).toContain(+ 'shouldConfirmAlertsLeave(e.to, e.from.pathname, hasUnsavedChanges())',+ );expect(alertsPageSource).toContain('scrollbar-hide');expect(alertsPageSource).not.toContain('style="-webkit-overflow-scrolling: touch;"');expect(alertsPageSource).not.toContain('const loadAlertConfiguration = async');diff --git a/frontend-modern/src/routing/__tests__/resourceLinks.test.ts b/frontend-modern/src/routing/__tests__/resourceLinks.test.tsindex 27e6e6f93a..482bbc1e6a 100644--- a/frontend-modern/src/routing/__tests__/resourceLinks.test.ts+++ b/frontend-modern/src/routing/__tests__/resourceLinks.test.ts@@ -11,6 +11,7 @@ import {KUBERNETES_QUERY_PARAMS,PMG_THRESHOLDS_PATH,ALERT_BACKUP_THRESHOLDS_PATH,+ buildAlertThresholdsPath,PATROL_AUTONOMY_OPERATIONS_LOOP_PATH,PATROL_CONTROL_ANCHOR,PATROL_CONTROL_PATH,@@ -347,6 +348,16 @@ describe('resource link routing contract', () => {expect(ALERT_BACKUP_THRESHOLDS_PATH).toBe('/alerts/thresholds/proxmox#backups');});+ it('builds a thresholds tab already searched to one resource', () => {+ expect(buildAlertThresholdsPath('docker', { query: ' nginx ' })).toBe(+ '/alerts/thresholds/docker?q=nginx',+ );+ expect(buildAlertThresholdsPath('proxmox', { query: 'web 01' })).toBe(+ '/alerts/thresholds/proxmox?q=web+01',+ );+ expect(buildAlertThresholdsPath()).toBe('/alerts/thresholds');+ });+it('deep-links one stable Patrol attention item without changing the route owner', () => {expect(buildPatrolAttentionPath('record/one')).toBe('/patrol?attention=record%2Fone');expect(buildPatrolAttentionPath('')).toBe('/patrol');diff --git a/frontend-modern/src/routing/resourceLinks.ts b/frontend-modern/src/routing/resourceLinks.tsindex 60561b1a45..07a48b347f 100644--- a/frontend-modern/src/routing/resourceLinks.ts+++ b/frontend-modern/src/routing/resourceLinks.ts@@ -50,6 +50,23 @@ export const ALERT_THRESHOLDS_PATH = '/alerts/thresholds';export const PMG_THRESHOLDS_PATH = '/alerts/thresholds/mail-gateway';// The Recovery section, whose fresh and stale hours colour every backup shield.export const ALERT_BACKUP_THRESHOLDS_PATH = `${ALERT_THRESHOLDS_PATH}/proxmox#backups`;+export const ALERT_THRESHOLDS_QUERY_PARAMS = {+ query: 'q',+} as const;+export type AlertThresholdsTab =+ 'proxmox' | 'docker' | 'kubernetes' | 'truenas' | 'vmware' | 'systems';++/** A thresholds tab, optionally already searched to one resource's rows. */+export const buildAlertThresholdsPath = (+ tab?: AlertThresholdsTab,+ options: { query?: string | null } = {},+): string => {+ const path = tab ? `${ALERT_THRESHOLDS_PATH}/${tab}` : ALERT_THRESHOLDS_PATH;+ const query = options.query?.trim();+ return query+ ? `${path}?${new URLSearchParams({ [ALERT_THRESHOLDS_QUERY_PARAMS.query]: query }).toString()}`+ : path;+};export const PATROL_PATH = '/patrol';export const PATROL_ATTENTION_QUERY_PARAM = 'attention';export const ACTIONS_PATH = '/actions';diff --git a/frontend-modern/src/utils/__tests__/alertConfigPresentation.test.ts b/frontend-modern/src/utils/__tests__/alertConfigPresentation.test.tsindex fed18b1026..5f412f5c74 100644--- a/frontend-modern/src/utils/__tests__/alertConfigPresentation.test.ts+++ b/frontend-modern/src/utils/__tests__/alertConfigPresentation.test.ts@@ -1,5 +1,6 @@import { describe, expect, it } from 'vitest';import {+ shouldConfirmAlertsLeave,ALERT_CONFIG_COOLDOWN_DESCRIPTION,ALERT_CONFIG_COOLDOWN_MAX_ALERTS_HELP,ALERT_CONFIG_COOLDOWN_MAX_ALERTS_LABEL,@@ -247,4 +248,15 @@ describe('alertConfigPresentation', () => {'• All notification controls are disabled - alerts will be sent immediately',);});+ // The thresholds search lives in the route, so every keystroke navigates+ // within the page; only leaving the page should ask about unsaved edits.+ it('asks before leaving unsaved settings for another page, not for same-page narrowing', () => {+ const page = '/alerts/thresholds/proxmox';+ expect(shouldConfirmAlertsLeave(`${page}?q=web`, page, true)).toBe(false);+ expect(shouldConfirmAlertsLeave(`${page}#backups`, page, true)).toBe(false);+ expect(shouldConfirmAlertsLeave('/alerts/thresholds/docker?q=web', page, true)).toBe(true);+ expect(shouldConfirmAlertsLeave('/proxmox/overview', page, true)).toBe(true);+ expect(shouldConfirmAlertsLeave(-1, page, true)).toBe(true);+ expect(shouldConfirmAlertsLeave('/proxmox/overview', page, false)).toBe(false);+ });});diff --git a/frontend-modern/src/utils/alertConfigPresentation.ts b/frontend-modern/src/utils/alertConfigPresentation.tsindex a9ece604e0..e63b54826b 100644--- a/frontend-modern/src/utils/alertConfigPresentation.ts+++ b/frontend-modern/src/utils/alertConfigPresentation.ts@@ -138,6 +138,20 @@ export function getAlertConfigResetDefaultsTitle() {return ALERT_CONFIG_RESET_DEFAULTS_TITLE;}+/**+ * Whether leaving with unsaved alert settings needs confirmation. Narrowing+ * the same page (the thresholds search in `?q=`, a `#section`) keeps the+ * edits, so only a different page asks.+ */+export function shouldConfirmAlertsLeave(+ to: string | number,+ fromPathname: string,+ hasUnsavedChanges: boolean,+): boolean {+ if (!hasUnsavedChanges) return false;+ return typeof to !== 'string' || to.split(/[?#]/)[0] !== fromPathname;+}+export function getAlertConfigLeaveConfirmation() {return ALERT_CONFIG_LEAVE_CONFIRMATION;}