From e97dbd3c92faf99fef5ad97cfff4e78512f8de36 Mon Sep 17 00:00:00 2001 From: Pulse Monitor Date: Tue, 26 Aug 2025 11:42:39 +0000 Subject: [PATCH] fix: improve PVE node filtering logic for backups tab search - When searching shows local/snapshot backups, only display nodes with those specific backups - PBS/remote backups are shared across nodes, so they alone shouldn't show all nodes - If search only returns PBS backups, then show nodes with access to them - Prevents all nodes from showing when searching for a guest that only exists on one node --- .../src/components/shared/PVENodeTable.tsx | 27 +++++++++++++++---- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/frontend-modern/src/components/shared/PVENodeTable.tsx b/frontend-modern/src/components/shared/PVENodeTable.tsx index 2d635d2b4..5a51038c9 100644 --- a/frontend-modern/src/components/shared/PVENodeTable.tsx +++ b/frontend-modern/src/components/shared/PVENodeTable.tsx @@ -53,11 +53,26 @@ export const PVENodeTable: Component = (props) => { props.storage?.forEach(s => nodesWithItems.add(s.node)); break; case 'backups': - // Filter based on backups - only add PVE node names, not PBS instance names + // Smart filtering for backups: + // - If we have any local/snapshot backups, only show nodes with those + // - If we only have PBS backups, show nodes that can access them + const hasLocalBackups = props.filteredBackups?.some(b => + b.backupType === 'snapshot' || b.backupType === 'local' + ); + props.filteredBackups?.forEach(b => { - // Only add if it's a node that exists in our PVE nodes list - if (props.nodes.some(n => n.name === b.node)) { - nodesWithItems.add(b.node); + // If we have local backups, only show nodes with local/snapshot backups + if (hasLocalBackups) { + if (b.backupType === 'snapshot' || b.backupType === 'local') { + if (props.nodes.some(n => n.name === b.node)) { + nodesWithItems.add(b.node); + } + } + } else { + // Only PBS backups - show nodes that have access to them + if (props.nodes.some(n => n.name === b.node)) { + nodesWithItems.add(b.node); + } } }); break; @@ -100,8 +115,10 @@ export const PVENodeTable: Component = (props) => { const storageCount = props.storage?.filter(s => s.node === node.name).length || 0; return [storageCount]; case 'backups': - // If we have filtered backups, count those; otherwise use the provided counts + // If we have filtered backups, count all types for display + // but remember that PBS backups are shared across nodes if (props.filteredBackups !== undefined) { + // Count all backups that match this node (including PBS for display purposes) const backupCount = props.filteredBackups.filter(b => b.node === node.name).length; return [backupCount]; }