Skip to content

armgit / Pulse

Public Imported from GitHub
0

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.

Keep card-layout backup and snapshot columns out of the numeric editor

rcourtman64d8b04d3637
diff --git a/frontend-modern/browser-verification.json b/frontend-modern/browser-verification.json
index e80d337d76..f19fe4384c 100644
--- a/frontend-modern/browser-verification.json
+++ b/frontend-modern/browser-verification.json
@@ -1,36 +1,40 @@
{
"version": 1,
- "base_sha": "14a3b8b5af276dc6d33a18098d8b80d1a131340f",
- "verified_at": "2026-08-13T22:14:37Z",
+ "base_sha": "a7646e5f86098b014476669fdc8105a692c22780",
+ "verified_at": "2026-08-13T22:56:10Z",
"result": "passed",
"changed_paths": [
- "frontend-modern/src/components/Workloads/useGuestRowState.ts"
+ "frontend-modern/src/components/Alerts/AlertResourceTableMobile.tsx",
+ "frontend-modern/src/features/alerts/thresholds/hooks/useThresholdsOverrideMutations.ts"
],
"content_sha256": {
- "frontend-modern/src/components/Workloads/useGuestRowState.ts": "51a68fb1a49eabd172482ae2f3e3087763aa772ddfe4d183b74e41838628433a"
+ "frontend-modern/src/components/Alerts/AlertResourceTableMobile.tsx": "6596f8b71c9cefb759d72751e4c5eeaf48292cd7fd90b3cc3a3f2026f59baf82",
+ "frontend-modern/src/features/alerts/thresholds/hooks/useThresholdsOverrideMutations.ts": "6db0718b9139daa8f98a41dc0d254bf3889b138ded7b3ac9a2ffa761ab3de70e"
},
"routes": [
- "/vmware/overview"
+ "/alerts/thresholds"
],
"viewports": [
{
- "width": 1440,
- "height": 1000
+ "width": 1280,
+ "height": 900
},
{
- "width": 768,
+ "width": 700,
"height": 900
}
],
"states": [
- "vSphere overview with the provider-unsupported Backup column hidden",
- "vSphere overview with the Backup column explicitly enabled",
- "vSphere overview reloaded with the enabled Backup preference persisted"
+ "VMs & Containers section expanded in the card layout at 700px with Backup and Snapshot rendered as toggle badges (Disabled) instead of number inputs",
+ "guest card edit mode (cold-archive-01) showing numeric inputs with On toggles for CPU/Memory/Disk while Backup and Snapshot remain toggle badges with no number input",
+ "unsaved-changes banner after toggling a backup badge, then discarded",
+ "1280px desktop viewport still using the card layout for the 14-column guests section, badges rendering identically"
],
"interactions": [
- "Opened View preferences and expanded the column chooser",
- "Enabled Backup and confirmed all 18 vSphere VM rows rendered an unavailable dash without a red warning",
- "Reloaded the overview and confirmed the persisted Backup column retained unavailable rather than no-backup semantics",
- "Restored the default hidden Backup column preference"
+ "expanded the VMs & Containers group",
+ "entered per-guest edit mode via Edit thresholds button",
+ "clicked a Backup toggle badge in card view mode and confirmed it flipped to enabled and staged unsaved changes",
+ "clicked Discard to clear the staged change",
+ "checked console errors (only pre-existing WebSocket reconnect noise from the absent 7655 backend)"
]
}
diff --git a/frontend-modern/src/components/Alerts/AlertResourceTableMobile.tsx b/frontend-modern/src/components/Alerts/AlertResourceTableMobile.tsx
index 11424aef10..b3c4e0200e 100644
--- a/frontend-modern/src/components/Alerts/AlertResourceTableMobile.tsx
+++ b/frontend-modern/src/components/Alerts/AlertResourceTableMobile.tsx
@@ -385,6 +385,37 @@ export function AlertResourceTableMobile(props: AlertResourceTableMobileProps) {
const metric = normalizeAlertResourceMetricKey(column);
if (!alertResourceSupportsMetric(resource.type, metric)) return null;
+ // Backup and snapshot carry day-based configs, not
+ // trigger/clear thresholds. Routing them through the
+ // numeric editor persisted {trigger, clear} into the
+ // backup block, which the backend reads as an all-zero
+ // disabled config (#1126). Render the same on/off
+ // toggle the desktop rows use instead.
+ if (metric === 'backup' || metric === 'snapshot') {
+ const config =
+ metric === 'backup' ? resource.backup : resource.snapshot;
+ const onToggle =
+ metric === 'backup'
+ ? props.table.onToggleBackup
+ : props.table.onToggleSnapshot;
+ if (!onToggle) return null;
+ const titlePrefix = metric === 'backup' ? 'Backup' : 'Snapshot';
+
+ return (
+ <div class="flex justify-between items-center p-1.5 bg-surface-alt rounded">
+ <span class="text-[10px] uppercase font-bold tracking-wider">
+ {column}
+ </span>
+ <StatusBadge
+ isEnabled={config?.enabled ?? true}
+ onToggle={() => onToggle(resource.id)}
+ titleEnabled={`${titlePrefix} alerts enabled. Click to disable for this resource.`}
+ titleDisabled={`${titlePrefix} alerts disabled. Click to enable for this resource.`}
+ />
+ </div>
+ );
+ }
+
const isDisabled = () => isAlertResourceMetricOff(thresholds()?.[metric]);
const inheritedDefault = () => resource.defaults?.[metric];
const bounds = getAlertResourceMetricBounds(metric);
diff --git a/frontend-modern/src/components/Alerts/ResourceTable.test.tsx b/frontend-modern/src/components/Alerts/ResourceTable.test.tsx
index 72d7eeb217..2a47419723 100644
--- a/frontend-modern/src/components/Alerts/ResourceTable.test.tsx
+++ b/frontend-modern/src/components/Alerts/ResourceTable.test.tsx
@@ -1536,6 +1536,44 @@ describe('ResourceTable', () => {
expect(screen.getByText('Production Web Server')).toBeInTheDocument();
});
+
+ it('renders backup as a toggle badge in the card layout, not a number input', () => {
+ // Routing backup through the numeric editor persisted {trigger, clear}
+ // into the backup block, which the backend reads as an all-zero
+ // disabled config (#1126).
+ const onToggleBackup = vi.fn();
+ const props = makeProps({
+ resources: [makeResource({ id: 'vm-1', name: 'Mobile VM', backup: { enabled: true } })],
+ columns: ['CPU %', 'Backup'],
+ onToggleBackup,
+ });
+ render(() => <ResourceTable {...props} />);
+
+ const badge = screen.getByTestId('status-badge');
+ expect(badge.title).toContain('Backup alerts enabled');
+ fireEvent.click(badge);
+ expect(onToggleBackup).toHaveBeenCalledWith('vm-1');
+ });
+
+ it('keeps backup and snapshot out of the numeric editor while editing in the card layout', () => {
+ const onToggleSnapshot = vi.fn();
+ const props = makeProps({
+ resources: [makeResource({ id: 'vm-1', name: 'Mobile VM', snapshot: { enabled: false } })],
+ columns: ['CPU %', 'Snapshot'],
+ editingId: () => 'vm-1',
+ editingThresholds: () => ({ cpu: 80 }),
+ onToggleSnapshot,
+ });
+ render(() => <ResourceTable {...props} />);
+
+ // Only the CPU metric may offer a number input; snapshot stays a badge.
+ expect(screen.getAllByRole('spinbutton')).toHaveLength(1);
+ const badge = screen.getByTitle(
+ 'Snapshot alerts disabled. Click to enable for this resource.',
+ );
+ fireEvent.click(badge);
+ expect(onToggleSnapshot).toHaveBeenCalledWith('vm-1');
+ });
});
describe('delay settings', () => {
diff --git a/frontend-modern/src/features/alerts/thresholds/hooks/__tests__/useThresholdsOverrideMutations.test.tsx b/frontend-modern/src/features/alerts/thresholds/hooks/__tests__/useThresholdsOverrideMutations.test.tsx
index c67ad52589..36711fff29 100644
--- a/frontend-modern/src/features/alerts/thresholds/hooks/__tests__/useThresholdsOverrideMutations.test.tsx
+++ b/frontend-modern/src/features/alerts/thresholds/hooks/__tests__/useThresholdsOverrideMutations.test.tsx
@@ -170,6 +170,116 @@ describe('useThresholdsOverrideMutations', () => {
});
});
+ it('saveEdit never persists staged backup/snapshot numbers as trigger/clear blocks', () => {
+ const overrideSignal = createSignal<any[]>([]);
+ const { props, rawOverridesConfig } = buildTableProps(overrideSignal);
+ // The card layout used to stage backup/snapshot as numeric metrics; a
+ // {trigger, clear} block under those keys reads back as an all-zero
+ // disabled config on the backend (#1126).
+ const [editingThresholds] = createSignal<Record<string, number | undefined>>({
+ cpu: 95,
+ backup: 11,
+ snapshot: 12,
+ });
+ const guestResource: TableResource = {
+ id: 'cluster-a:node-2:100',
+ name: 'db-01',
+ type: 'guest',
+ resourceType: 'VM',
+ vmid: 100,
+ node: 'node-2',
+ instance: 'cluster-a',
+ defaults: { cpu: 80 },
+ thresholds: { cpu: 80 },
+ };
+
+ const { result } = renderHook(() =>
+ useThresholdsOverrideMutations({
+ props,
+ resources: {
+ nodesWithOverrides: () => [],
+ agentsWithOverrides: () => [],
+ agentDisksWithOverrides: () => [],
+ dockerHostsWithOverrides: () => [],
+ guestsFlat: () => [guestResource],
+ dockerContainersFlat: () => [],
+ pbsServersWithOverrides: () => [],
+ pmgServersWithOverrides: () => [],
+ storageWithOverrides: () => [],
+ },
+ editingThresholds,
+ editingNote: () => '',
+ bulkEditIds: () => [],
+ cancelEdit: vi.fn(),
+ }),
+ );
+
+ result.saveEdit('cluster-a:node-2:100');
+
+ expect(overrideSignal[0]()).toEqual([
+ expect.objectContaining({
+ id: 'guest:cluster-a:100',
+ thresholds: { cpu: 95 },
+ }),
+ ]);
+ expect(rawOverridesConfig()).toEqual({
+ 'guest:cluster-a:100': {
+ cpu: {
+ clear: 90,
+ trigger: 95,
+ },
+ },
+ });
+ });
+
+ it('handleSaveBulkEdit ignores backup/snapshot keys in the staged thresholds', () => {
+ const overrideSignal = createSignal<any[]>([]);
+ const { props, rawOverridesConfig } = buildTableProps(overrideSignal);
+ const guestResource: TableResource = {
+ id: 'cluster-a:node-2:100',
+ name: 'db-01',
+ type: 'guest',
+ resourceType: 'VM',
+ vmid: 100,
+ node: 'node-2',
+ instance: 'cluster-a',
+ defaults: { cpu: 80 },
+ thresholds: {},
+ };
+
+ const { result } = renderHook(() =>
+ useThresholdsOverrideMutations({
+ props,
+ resources: {
+ nodesWithOverrides: () => [],
+ agentsWithOverrides: () => [],
+ agentDisksWithOverrides: () => [],
+ dockerHostsWithOverrides: () => [],
+ guestsFlat: () => [],
+ dockerContainersFlat: () => [],
+ pbsServersWithOverrides: () => [],
+ pmgServersWithOverrides: () => [],
+ storageWithOverrides: () => [guestResource],
+ },
+ editingThresholds: () => ({}),
+ editingNote: () => '',
+ bulkEditIds: () => [guestResource.id],
+ cancelEdit: vi.fn(),
+ }),
+ );
+
+ result.handleSaveBulkEdit({ cpu: 90, backup: 11, snapshot: 12 });
+
+ expect(rawOverridesConfig()).toEqual({
+ 'guest:cluster-a:100': {
+ cpu: {
+ clear: 85,
+ trigger: 90,
+ },
+ },
+ });
+ });
+
it('toggleBackup writes a sparse enabled-only override instead of freezing the globals', () => {
const overrideSignal = createSignal<any[]>([]);
const { props, rawOverridesConfig } = buildTableProps(overrideSignal);
diff --git a/frontend-modern/src/features/alerts/thresholds/hooks/useThresholdsOverrideMutations.ts b/frontend-modern/src/features/alerts/thresholds/hooks/useThresholdsOverrideMutations.ts
index 13b88b739f..2391949cc7 100644
--- a/frontend-modern/src/features/alerts/thresholds/hooks/useThresholdsOverrideMutations.ts
+++ b/frontend-modern/src/features/alerts/thresholds/hooks/useThresholdsOverrideMutations.ts
@@ -114,6 +114,11 @@ export function useThresholdsOverrideMutations({
const overrideThresholds: Record<string, number> = {};
Object.keys(editedThresholdMap).forEach((key) => {
+ // Backup and snapshot are day-based config blocks managed by their
+ // dedicated toggles. A numeric entry here would persist {trigger, clear}
+ // into the block, which the backend reads as an all-zero disabled
+ // config (#1126), so they must never pass through as thresholds.
+ if (key === 'backup' || key === 'snapshot') return;
const editedValue = editedThresholdMap[key];
const defaultValue = defaultThresholds[key];
if (editedValue !== undefined && editedValue !== defaultValue) {
@@ -236,6 +241,9 @@ export function useThresholdsOverrideMutations({
};
Object.keys(thresholds).forEach((key) => {
+ // Same guard as saveEdit: backup/snapshot are config blocks, not
+ // trigger/clear thresholds (#1126).
+ if (key === 'backup' || key === 'snapshot') return;
if (thresholds[key] !== undefined) {
const value = thresholds[key];
if (value === defaultThresholds[key]) {