From 1185294174cda2676900551179aabbfb54a25fce Mon Sep 17 00:00:00 2001 From: rcourtman Date: Fri, 26 Dec 2025 11:13:41 +0000 Subject: [PATCH] refactor(dashboard): merge Needs Backup into Problems filter - Removed redundant 'Needs Backup' toggle from filter bar - Problems filter already includes backup issues (stale, critical, never) - Reduces UI clutter while preserving functionality - Also includes user's lint fixes for Backups tests --- .../src/components/Dashboard/Dashboard.tsx | 23 +----------------- .../components/Dashboard/DashboardFilter.tsx | 24 +------------------ 2 files changed, 2 insertions(+), 45 deletions(-) diff --git a/frontend-modern/src/components/Dashboard/Dashboard.tsx b/frontend-modern/src/components/Dashboard/Dashboard.tsx index 7a16edcf20..95535a4629 100644 --- a/frontend-modern/src/components/Dashboard/Dashboard.tsx +++ b/frontend-modern/src/components/Dashboard/Dashboard.tsx @@ -200,7 +200,6 @@ interface DashboardProps { type ViewMode = 'all' | 'vm' | 'lxc'; type StatusMode = 'all' | 'running' | 'degraded' | 'stopped'; -type BackupMode = 'all' | 'needs-backup'; type GroupingMode = 'grouped' | 'flat'; type ProblemsMode = 'all' | 'problems'; @@ -243,11 +242,6 @@ export function Dashboard(props: DashboardProps) { : 'all', }); - // Backup filter mode - filter by backup status - const [backupMode, setBackupMode] = usePersistentSignal('dashboardBackupMode', 'all', { - deserialize: (raw) => (raw === 'all' || raw === 'needs-backup' ? raw : 'all'), - }); - // Grouping mode - grouped by node or flat list const [groupingMode, setGroupingMode] = usePersistentSignal( 'dashboardGroupingMode', @@ -576,7 +570,6 @@ export function Dashboard(props: DashboardProps) { selectedNode() !== null || viewMode() !== 'all' || statusMode() !== 'all' || - backupMode() !== 'all' || problemsMode() !== 'all'; if (hasActiveFilters) { @@ -588,7 +581,6 @@ export function Dashboard(props: DashboardProps) { setSelectedNode(null); setViewMode('all'); setStatusMode('all'); - setBackupMode('all'); setProblemsMode('all'); // Blur the search input if it's focused @@ -688,18 +680,7 @@ export function Dashboard(props: DashboardProps) { guests = guests.filter((g) => g.status !== 'running'); } - // Filter by backup status - if (backupMode() === 'needs-backup') { - guests = guests.filter((g) => { - // Skip templates - they don't need backups - if (g.template) return false; - const backupInfo = getBackupInfo(g.lastBackup, alertsActivation.getBackupThresholds()); - // Show guests that need backup: stale, critical, or never backed up - return backupInfo.status === 'stale' || backupInfo.status === 'critical' || backupInfo.status === 'never'; - }); - } - - // Filter by problems mode - show guests that need attention + // Filter by problems mode - show guests that need attention (includes backup issues) if (problemsMode() === 'problems') { guests = guests.filter((g) => { // Skip templates @@ -981,8 +962,6 @@ export function Dashboard(props: DashboardProps) { setViewMode={setViewMode} statusMode={statusMode} setStatusMode={setStatusMode} - backupMode={backupMode} - setBackupMode={setBackupMode} problemsMode={problemsMode} setProblemsMode={setProblemsMode} filteredProblemGuests={problemGuests} diff --git a/frontend-modern/src/components/Dashboard/DashboardFilter.tsx b/frontend-modern/src/components/Dashboard/DashboardFilter.tsx index 08a5b31d26..ef573cf62b 100644 --- a/frontend-modern/src/components/Dashboard/DashboardFilter.tsx +++ b/frontend-modern/src/components/Dashboard/DashboardFilter.tsx @@ -17,8 +17,6 @@ interface DashboardFilterProps { setViewMode: (value: 'all' | 'vm' | 'lxc') => void; statusMode: () => 'all' | 'running' | 'degraded' | 'stopped'; setStatusMode: (value: 'all' | 'running' | 'degraded' | 'stopped') => void; - backupMode: () => 'all' | 'needs-backup'; - setBackupMode: (value: 'all' | 'needs-backup') => void; problemsMode: () => 'all' | 'problems'; setProblemsMode: (value: 'all' | 'problems') => void; /** Guests that match the problems filter - used for AI investigation */ @@ -428,26 +426,8 @@ export const DashboardFilter: Component = (props) => { {/* End Primary Filters Group */} - {/* Secondary Controls Group: Backup, Grouping, View, Columns, Reset */} + {/* Secondary Controls Group: Grouping, View, Columns, Reset */}
- {/* Backup Filter */} - - - {/* Grouping Mode Toggle */}
@@ -512,7 +492,6 @@ export const DashboardFilter: Component = (props) => { props.search().trim() !== '' || props.viewMode() !== 'all' || props.statusMode() !== 'all' || - props.backupMode() !== 'all' || props.problemsMode() !== 'all' || props.groupingMode() !== 'grouped' }> @@ -524,7 +503,6 @@ export const DashboardFilter: Component = (props) => { props.setSortDirection('asc'); props.setViewMode('all'); props.setStatusMode('all'); - props.setBackupMode('all'); props.setProblemsMode('all'); props.setGroupingMode('grouped'); }}