Skip to content

Build your personal knowledge base with Trilium Notes

feat(options/backup): deduplicate backup path

Elian Doran5beed607340d
diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.json
index f55bc1ee08..ada7869af3 100644
--- a/apps/client/src/translations/en/translation.json
+++ b/apps/client/src/translations/en/translation.json
@@ -1590,6 +1590,7 @@
"backup_now": "Backup now",
"backup_database_now": "Backup database now",
"existing_backups": "Existing backups",
+ "backup_location_description": "Backups are stored in {{- backupFolder}}.",
"date-and-time": "Date & time",
"path": "Path",
"database_backed_up_to": "Database has been backed up to {{- backupFilePath}}",
diff --git a/apps/client/src/widgets/type_widgets/options/backup.tsx b/apps/client/src/widgets/type_widgets/options/backup.tsx
index 1579402a3b..87812d40d0 100644
--- a/apps/client/src/widgets/type_widgets/options/backup.tsx
+++ b/apps/client/src/widgets/type_widgets/options/backup.tsx
@@ -85,15 +85,24 @@ export function BackupConfiguration({ refreshCallback }: { refreshCallback: () =
}
export function BackupList({ backups }: { backups: DatabaseBackup[] }) {
+ // All backups live in the same directory, so display it once instead of repeating it per file.
+ const firstBackup = backups.at(0);
+ const backupFolder = firstBackup?.filePath.slice(0, -(firstBackup.fileName.length + 1));
+
return (
- <OptionsSection title={t("backup.existing_backups")}>
+ <OptionsSection
+ title={t("backup.existing_backups")}
+ description={backupFolder && (
+ <span className="selectable-text">{t("backup.backup_location_description", { backupFolder })}</span>
+ )}
+ >
{backups.length > 0 ? (
- backups.map(({ mtime, filePath }) => (
+ backups.map(({ fileName, filePath, mtime }) => (
<OptionsRow
key={filePath}
name="existing-backup"
- label={mtime ? formatDateTime(mtime) : "-"}
- description={<span className="selectable-text">{filePath}</span>}
+ label={<span className="selectable-text">{fileName}</span>}
+ description={mtime ? formatDateTime(mtime) : "-"}
>
<a href={`api/database/backup/download?filePath=${encodeURIComponent(filePath)}`} download>
<ActionButton icon="bx bx-download" text={t("backup.download")} />