From 80d4558b424e58a18eb6bc1780bdbb6dc8461098 Mon Sep 17 00:00:00 2001 From: rcourtman Date: Thu, 6 Aug 2026 10:15:46 +0100 Subject: [PATCH] fix(alerts): single global defaults editor for recovery and snapshots The Recovery and Snapshot Age threshold sections rendered two Global Defaults surfaces at once, the live editor row plus a synthetic read-only resource row of the same values. Both looked editable but the synthetic row's pencil editor saved through findThresholdResource, which never finds the pseudo-resource, so its edits were dropped silently. Reported in #1680 by FabienD74. The synthetic rows are gone; the always-live editor row is the single surface in both table and card layouts. The dead editScope field and its unreachable saveEdit branches go with them. The size columns move from Recovery to Snapshot Age where they belong. BackupAlertConfig has no size fields, so on Recovery they always rendered an inert Off. SnapshotAlertConfig sizes are live in the alert engine (backup_snapshot.go) but were previously invisible and, worse, unpersistable. The records now carry the normalized warningSizeGiB and criticalSizeGiB metric keys the column editor reads and writes, and applyAlertsConfigToSnapshot plus buildAlertsConfigurationPayload carry the size fields through load and save instead of stripping them. Verified end to end against the mock dev stack, PUT then GET returns the saved sizes and a reload shows them. Guests in the VMs & Containers section now sort by display name with vmid as tiebreaker. The old vmid-first order looked random because the rows do not render the vmid, which is what the sorting complaint in #1680 was about. Dropping the phantom columns and the per-row bulk-edit checkbox also brings the Recovery table under the desktop width budget, so it renders as a table at 1280px and up instead of falling back to cards. --- .../v6/internal/subsystems/alerts.md | 18 ++++ .../subsystems/frontend-primitives.md | 7 ++ frontend-modern/browser-verification.json | 99 +++++++------------ .../ThresholdsTableProxmoxBackupsSection.tsx | 22 +---- ...ThresholdsTableProxmoxSnapshotsSection.tsx | 27 ++--- .../alerts/alertsConfigurationModel.ts | 12 +++ .../truenasThresholdPersistence.test.tsx | 4 - .../useThresholdsOverrideMutations.test.tsx | 4 - ...seThresholdsRecoveryDefaultsState.test.tsx | 4 +- .../hooks/useThresholdsGuestData.ts | 10 +- .../hooks/useThresholdsOverrideMutations.ts | 60 +---------- .../useThresholdsRecoveryDefaultsState.ts | 11 ++- .../hooks/useThresholdsTableState.ts | 2 - .../features/alerts/thresholds/tableTypes.ts | 1 - .../utils/__tests__/metricThresholds.test.ts | 14 +++ .../src/utils/alertThresholdDefaults.ts | 3 + 16 files changed, 115 insertions(+), 183 deletions(-) diff --git a/docs/release-control/v6/internal/subsystems/alerts.md b/docs/release-control/v6/internal/subsystems/alerts.md index dcf85fb8e..dc4643e49 100644 --- a/docs/release-control/v6/internal/subsystems/alerts.md +++ b/docs/release-control/v6/internal/subsystems/alerts.md @@ -459,6 +459,24 @@ templates, threshold ignored-prefix input, and incident timeline notes must compose `FormTextarea` for label/id/help wiring and textarea chrome instead of recreating raw labelled `