fix(alerts): hide misleading Backup/Snapshot inputs in Global Defaults card, preserve per-resource backup config on threshold edit

The Global Defaults card in VMs & Containers rendered number inputs for
Backup and Snapshot columns. These wrote to guestDefaults which has no
backup/snapshot fields, so values were silently lost on save — appearing
to "reset to 0." Filter these special toggle columns out of the Global
Defaults card since backup/snapshot thresholds are configured in the
dedicated Backups/Snapshots sections.

Also fix saveEdit not preserving backup/snapshot in the raw override
config (hysteresisThresholds), which caused per-resource backup overrides
to be silently dropped when editing other thresholds on the same resource.

Related to #1126
This commit is contained in:
rcourtman 2026-02-02 16:01:12 +00:00
parent dbf603d7e2
commit 6b237db923
2 changed files with 7 additions and 1 deletions

View file

@ -511,7 +511,7 @@ export function ResourceTable(props: ResourceTableProps) {
</div>
<div class="grid grid-cols-2 gap-2">
<For each={props.columns}>
<For each={props.columns.filter((c) => { const m = normalizeMetricKey(c); return m !== 'backup' && m !== 'snapshot'; })}>
{(column) => {
const metric = normalizeMetricKey(column);
const bounds = metricBounds(metric);

View file

@ -2062,6 +2062,12 @@ export function ThresholdsTable(props: ThresholdsTableProps) {
} else {
delete hysteresisThresholds.note;
}
if (previousRaw?.backup) {
hysteresisThresholds.backup = previousRaw.backup;
}
if (previousRaw?.snapshot) {
hysteresisThresholds.snapshot = previousRaw.snapshot;
}
newRawConfig[resourceId] = hysteresisThresholds;
props.setRawOverridesConfig(newRawConfig);