From b2344cdbbd68e1562f970b4d4f1691d45cf8c6e3 Mon Sep 17 00:00:00 2001 From: rcourtman Date: Mon, 30 Mar 2026 02:38:32 +0100 Subject: [PATCH] refactor(alerts): canonicalize thresholds surface routing --- .../v6/internal/subsystems/alerts.md | 15 +- .../subsystems/frontend-primitives.md | 16 +- .../src/components/Alerts/ThresholdsTable.tsx | 19 +- .../Alerts/__tests__/ThresholdsTable.test.tsx | 101 ++++++-- .../useThresholdsTableState.test.tsx | 6 +- .../thresholds/hooks/useThresholdsHostData.ts | 10 +- .../hooks/useThresholdsTableState.ts | 44 ++-- .../features/alerts/thresholds/tableTypes.ts | 2 +- frontend-modern/src/pages/Alerts.tsx | 2 +- .../pages/__tests__/Alerts.helpers.test.ts | 2 + .../alertOverviewPresentation.test.ts | 2 +- .../alertThresholdsPresentation.test.ts | 22 +- .../src/utils/alertOverviewPresentation.ts | 2 +- .../src/utils/alertThresholdsPresentation.ts | 14 +- tests/integration/tests/01-core-e2e.spec.ts | 12 +- .../tests/26-truenas-alert-thresholds.spec.ts | 215 ++++++++++++++++++ 16 files changed, 390 insertions(+), 94 deletions(-) create mode 100644 tests/integration/tests/26-truenas-alert-thresholds.spec.ts diff --git a/docs/release-control/v6/internal/subsystems/alerts.md b/docs/release-control/v6/internal/subsystems/alerts.md index f2ac3d8f7..2a608a9fc 100644 --- a/docs/release-control/v6/internal/subsystems/alerts.md +++ b/docs/release-control/v6/internal/subsystems/alerts.md @@ -234,7 +234,14 @@ tab render owners live in threshold row grouping, override-ID compatibility, resource normalization, thresholds-table controller logic, or per-tab runtime should land in those feature hooks and tab owners rather than being rebuilt inside the shell. -Within the Proxmox tab, render-heavy ownership now further routes through +The shell-owned thresholds sub-routes are now the neutral user-facing paths +`/alerts/thresholds/infrastructure`, `/alerts/thresholds/systems`, +`/alerts/thresholds/mail-gateway`, and `/alerts/thresholds/containers`. +Legacy `/alerts/thresholds/proxmox` and `/alerts/thresholds/agents` links +must redirect to the neutral infrastructure and systems routes so API-backed +platforms like TrueNAS do not remain stranded behind provider-specific deep +links. +Within the infrastructure tab, render-heavy ownership now further routes through `frontend-modern/src/components/Alerts/ThresholdsTableProxmoxNodesSection.tsx`, `frontend-modern/src/components/Alerts/ThresholdsTableProxmoxPBSSection.tsx`, `frontend-modern/src/components/Alerts/ThresholdsTableProxmoxGuestsSection.tsx`, @@ -244,7 +251,7 @@ Within the Proxmox tab, render-heavy ownership now further routes through and `frontend-modern/src/components/Alerts/ThresholdsTableProxmoxStorageSection.tsx` with the shared section contract in `frontend-modern/src/features/alerts/thresholds/thresholdsTableSectionProps.ts`. -Future Proxmox thresholds presentation work should extend those section owners +Future infrastructure-thresholds presentation work should extend those section owners instead of expanding `frontend-modern/src/components/Alerts/ThresholdsTableProxmoxTab.tsx` back into a mixed render surface. The Docker tab now follows that same section-owner shape through @@ -255,10 +262,10 @@ and `frontend-modern/src/components/Alerts/ThresholdsTableDockerContainersSectio Future Docker thresholds presentation work should extend those section owners instead of expanding `frontend-modern/src/components/Alerts/ThresholdsTableDockerTab.tsx` back into a mixed render surface. -The agents tab now follows that same shell-versus-section pattern through +The systems tab now follows that same shell-versus-section pattern through `frontend-modern/src/components/Alerts/ThresholdsTableAgentsResourcesSection.tsx` and `frontend-modern/src/components/Alerts/ThresholdsTableAgentDisksSection.tsx`. -Future agent thresholds presentation work should extend those section owners +Future systems-thresholds presentation work should extend those section owners instead of expanding `frontend-modern/src/components/Alerts/ThresholdsTableAgentsTab.tsx` back into a mixed render surface. The alert resource thresholds editor now follows the same shape: shared metric diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md index 7cb2da783..b003be1e9 100644 --- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md +++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md @@ -1230,7 +1230,15 @@ and the tab render owners live in `frontend-modern/src/components/Alerts/ThresholdsTablePMGTab.tsx`, `frontend-modern/src/components/Alerts/ThresholdsTableAgentsTab.tsx`, and `frontend-modern/src/components/Alerts/ThresholdsTableDockerTab.tsx`. -The Proxmox tab is itself now a shell that composes +`frontend-modern/src/features/alerts/thresholds/hooks/useThresholdsTableState.ts` +owns the neutral thresholds sub-route contract: +`/alerts/thresholds/infrastructure`, `/alerts/thresholds/systems`, +`/alerts/thresholds/mail-gateway`, and `/alerts/thresholds/containers`. +Legacy `/alerts/thresholds/proxmox` and `/alerts/thresholds/agents` links +must redirect to the neutral infrastructure and systems routes so API-backed +platforms such as TrueNAS stay on canonical page language rather than +provider-specific aliases. +The infrastructure tab is itself now a shell that composes `frontend-modern/src/components/Alerts/ThresholdsTableProxmoxNodesSection.tsx`, `frontend-modern/src/components/Alerts/ThresholdsTableProxmoxPBSSection.tsx`, `frontend-modern/src/components/Alerts/ThresholdsTableProxmoxGuestsSection.tsx`, @@ -1240,7 +1248,7 @@ The Proxmox tab is itself now a shell that composes and `frontend-modern/src/components/Alerts/ThresholdsTableProxmoxStorageSection.tsx` using the shared contract in `frontend-modern/src/features/alerts/thresholds/thresholdsTableSectionProps.ts`. -Future Proxmox thresholds presentation changes should extend those section +Future infrastructure-thresholds presentation changes should extend those section surfaces rather than restoring mixed JSX ownership to `frontend-modern/src/components/Alerts/ThresholdsTableProxmoxTab.tsx`. The Docker tab now follows that same composition pattern through @@ -1251,10 +1259,10 @@ and `frontend-modern/src/components/Alerts/ThresholdsTableDockerContainersSectio Future Docker thresholds presentation changes should extend those section surfaces rather than restoring mixed JSX ownership to `frontend-modern/src/components/Alerts/ThresholdsTableDockerTab.tsx`. -The agents tab now follows that same composition pattern through +The systems tab now follows that same composition pattern through `frontend-modern/src/components/Alerts/ThresholdsTableAgentsResourcesSection.tsx` and `frontend-modern/src/components/Alerts/ThresholdsTableAgentDisksSection.tsx`. -Future agent thresholds presentation changes should extend those section +Future systems-thresholds presentation changes should extend those section surfaces rather than restoring mixed JSX ownership to `frontend-modern/src/components/Alerts/ThresholdsTableAgentsTab.tsx`. The thresholds tab adapter contract now lives in diff --git a/frontend-modern/src/components/Alerts/ThresholdsTable.tsx b/frontend-modern/src/components/Alerts/ThresholdsTable.tsx index c889b5df3..16c0c1389 100644 --- a/frontend-modern/src/components/Alerts/ThresholdsTable.tsx +++ b/frontend-modern/src/components/Alerts/ThresholdsTable.tsx @@ -87,12 +87,11 @@ export function ThresholdsTable(props: ThresholdsTableProps) {