Skip to content

A modern, self-hosted backup solution for secure, encrypted backups across local and cloud storage.

refactor: snapshot file change count to only count files and not directories

towfiqiea6e97060dc8
diff --git a/backend/__tests__/stores/PlanStore.test.ts b/backend/__tests__/stores/PlanStore.test.ts
index 7a1f29c..7066dea 100644
--- a/backend/__tests__/stores/PlanStore.test.ts
+++ b/backend/__tests__/stores/PlanStore.test.ts
@@ -195,7 +195,14 @@ describe('PlanStore', () => {
expect(result[0].totalSize).toBe(1024);
expect(result[0].duration).toBe(90);
expect(result[0].active).toBe(true);
- expect(result[0].changes).toEqual({ new: 2, modified: 2, removed: 0 });
+ // Headline counts are files only; folder counts are surfaced separately (issue #77).
+ expect(result[0].changes).toEqual({
+ new: 1,
+ modified: 2,
+ removed: 0,
+ newDirs: 1,
+ modifiedDirs: 0,
+ });
// Check second backup (not in snapshots)
expect(result[1].active).toBe(false);
});
@@ -240,6 +247,16 @@ describe('PlanStore', () => {
authToken: '',
tags: '',
},
+ slack: {
+ enabled: false,
+ case: 'failure',
+ url: '',
+ },
+ discord: {
+ enabled: false,
+ case: 'failure',
+ url: '',
+ },
},
performance: {},
integrity: {
@@ -251,12 +268,14 @@ describe('PlanStore', () => {
enabled: false,
type: 'smtp',
emails: '',
+ case: 'failure',
},
webhook: {
enabled: false,
method: 'POST',
contentType: 'application/json',
url: '',
+ case: 'failure',
},
push: {
enabled: false,
@@ -264,6 +283,17 @@ describe('PlanStore', () => {
authType: 'none',
authToken: '',
tags: '',
+ case: 'failure',
+ },
+ slack: {
+ enabled: false,
+ case: 'failure',
+ url: '',
+ },
+ discord: {
+ enabled: false,
+ case: 'failure',
+ url: '',
},
},
},
@@ -370,5 +400,4 @@ describe('PlanStore', () => {
updateSpy.mockRestore();
});
});
-
});
diff --git a/backend/src/notifications/templates/email/backup/BackupSuccessNotification.ts b/backend/src/notifications/templates/email/backup/BackupSuccessNotification.ts
index 1db08fc..63fcc82 100644
--- a/backend/src/notifications/templates/email/backup/BackupSuccessNotification.ts
+++ b/backend/src/notifications/templates/email/backup/BackupSuccessNotification.ts
@@ -292,8 +292,8 @@ export class BackupSuccessNotification extends BaseNotification {
const hasReplicationFailures = replicationFailures && replicationFailures.length > 0;
const sourceCount = plan.sourceConfig.includes.length;
const backupChanges = () => {
- const newCount = (stats?.files_new || 0) + (stats?.dirs_new || 0);
- const modifiedCount = (stats?.files_changed || 0) + (stats?.dirs_changed || 0);
+ const newCount = stats?.files_new || 0;
+ const modifiedCount = stats?.files_changed || 0;
const removedCount = 0;
const parts = [];
if (newCount > 0) parts.push(`${newCount} New`);
diff --git a/backend/src/stores/PlanStore.ts b/backend/src/stores/PlanStore.ts
index 42f4a95..abe9616 100644
--- a/backend/src/stores/PlanStore.ts
+++ b/backend/src/stores/PlanStore.ts
@@ -172,9 +172,11 @@ export class PlanStore {
duration: Math.floor((backupEnded - backupStarted) / 1000),
active: stats?.snapshots?.includes(backup.id) || false,
changes: {
- new: (taskStats?.files_new || 0) + (taskStats?.dirs_new || 0),
- modified: (taskStats?.files_changed || 0) + (taskStats?.dirs_changed || 0),
+ new: taskStats?.files_new || 0,
+ modified: taskStats?.files_changed || 0,
removed: 0,
+ newDirs: taskStats?.dirs_new || 0,
+ modifiedDirs: taskStats?.dirs_changed || 0,
},
};
});
diff --git a/frontend/src/@types/backups.ts b/frontend/src/@types/backups.ts
index 46a69b1..f465a75 100644
--- a/frontend/src/@types/backups.ts
+++ b/frontend/src/@types/backups.ts
@@ -59,7 +59,7 @@ export type Backup = {
inProgress: boolean;
totalFiles: number;
totalSize: number;
- changes: { new: number; modified: number; removed: number };
+ changes: { new: number; modified: number; removed: number; newDirs?: number; modifiedDirs?: number };
active?: boolean;
errorMsg?: string;
hasRevisions?: boolean;
diff --git a/frontend/src/components/Plan/Backups/Backups.module.scss b/frontend/src/components/Plan/Backups/Backups.module.scss
index 410990f..9bfcdb0 100644
--- a/frontend/src/components/Plan/Backups/Backups.module.scss
+++ b/frontend/src/components/Plan/Backups/Backups.module.scss
@@ -1,7 +1,7 @@
.backupsTable {
width: 100%;
border: 1px solid var(--line-color);
- border-radius: 6px;
+ border-radius: 0 6px 6px 6px;
.noBackups {
padding: 50px;
diff --git a/frontend/src/components/Plan/Backups/Backups.tsx b/frontend/src/components/Plan/Backups/Backups.tsx
index 10232eb..ba71c3b 100644
--- a/frontend/src/components/Plan/Backups/Backups.tsx
+++ b/frontend/src/components/Plan/Backups/Backups.tsx
@@ -252,9 +252,9 @@ const Backups = ({
className={classes.changes}
data-tooltip-id="htmlToolTip"
data-tooltip-html={`
- <div><b>New Items</b>: ${changes.new}</div>
- <div><b>Modified Items</b>: ${changes.modified}</div>
- <div><b>Deleted Items</b>: ${changes.removed || 0}</div>
+ <div><b>New Files</b>: ${changes.new}</div>
+ <div><b>Modified Files</b>: ${changes.modified}</div>
+ <div><b>Deleted Files</b>: ${changes.removed || 0}</div>
`}
>
<span className={classes.changesNew}>