A modern, self-hosted backup solution for secure, encrypted backups across local and cloud storage.
fix: resolves incorrect backup count display issue
towfiqiff81a5aa658a
diff --git a/frontend/src/@types/restores.ts b/frontend/src/@types/restores.tsindex 607a346..a87dbd4 100644--- a/frontend/src/@types/restores.ts+++ b/frontend/src/@types/restores.ts@@ -2,6 +2,7 @@ export interface Restore {id: number;status: string;error: string | null;+ inProgress: boolean;taskStats: {total_files: number;files_restored: number;@@ -39,6 +40,7 @@ export interface RestoreSlim {id: string;status: 'completed' | 'cancelled' | 'failed' | 'started';error: string | null;+ inProgress: boolean;taskStats: RestoredItemsStats | null;config: {target: string;diff --git a/frontend/src/components/Plan/PlanBackups/PlanBackups.tsx b/frontend/src/components/Plan/PlanBackups/PlanBackups.tsxindex f110a23..07dde0d 100644--- a/frontend/src/components/Plan/PlanBackups/PlanBackups.tsx+++ b/frontend/src/components/Plan/PlanBackups/PlanBackups.tsx@@ -16,6 +16,9 @@ const PlanBackups = ({ plan }: PlanBackupsProps) => {const { backups = [], stats, restores = [], method, sourceId, sourceType, settings, storage } = plan;+ const finishedBackups = backups.filter((b) => b.inProgress === false);+ const finishedRestores = restores.filter((r) => r.inProgress === false);+const sortedHistory = [...(backups || [])].sort((a, b) => new Date(b.started).getTime() - new Date(a.started).getTime());const isSync = method === 'sync';const snapshotsCount = stats.snapshots?.length || 0;@@ -25,10 +28,10 @@ const PlanBackups = ({ plan }: PlanBackupsProps) => {<div className={classes.backupsHeader}><div className={classes.historyTabs}><button onClick={() => setHistoryTab('backups')} className={historyTab === 'backups' ? classes.historyTabActive : ''}>- {isSync ? 'Sync Tasks' : 'Backups'} <i>{sortedHistory.length}</i>+ {isSync ? 'Sync Tasks' : 'Backups'} <i>{finishedBackups.length}</i></button><button onClick={() => setHistoryTab('restores')} className={historyTab === 'restores' ? classes.historyTabActive : ''}>- Restores <i>{restores.length}</i>+ Restores <i>{finishedRestores.length}</i></button></div>{!isSync && historyTab === 'backups' && (diff --git a/frontend/src/hooks/usePlanSingleActions.tsx b/frontend/src/hooks/usePlanSingleActions.tsxindex bda4382..41b49b5 100644--- a/frontend/src/hooks/usePlanSingleActions.tsx+++ b/frontend/src/hooks/usePlanSingleActions.tsx@@ -50,7 +50,7 @@ export const usePlanSingleActions = (): {const sortedHistory = [...(plan.backups || [])].sort((a, b) => b.started - a.started);const activeBackups = sortedHistory.filter((s) => s.inProgress);- const activeRestores = (plan.restores || []).filter((s) => s.status === 'started');+ const activeRestores = (plan.restores || []).filter((s) => s.inProgress);const lastBackupItem = isSync ? sortedHistory.filter((s) => s.status === 'completed')[0] : sortedHistory[0];const actionInProgress = activeBackups.length > 0 || activeRestores.length > 0;const taskPending = pauseMutation.isPending || resumeMutation.isPending || performBackupMutation.isPending;