From 24abe412e0f10fa018ee8cf9a416254fd027cc41 Mon Sep 17 00:00:00 2001 From: librelad Date: Sat, 23 May 2026 14:39:48 +0100 Subject: [PATCH] feat(backup): move Engine into the location editor's Advanced tab MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The backup engine is an implementation detail — LibrePortal picks a sensible default and handles it — so it doesn't belong next to Name/Type on the Connection tab. Add ENGINE to LOC_ADVANCED_SUFFIXES and mark it **ADVANCED** in the location.config template + seed so it's metadata-driven. Since the engine select now lives in the Advanced tab while SSH-auth and path-mode stay on Connection, refreshInlineTypeFields re-applies the dynamic behaviors (engine filtering, SSH/path visibility) against the shared .task-details scope rather than a single panel. Also fixed the live per-location engine label (restic -> Restic) which now surfaces in the dropdown via the generator-emitted options. Co-Authored-By: Claude Opus 4.7 Signed-off-by: librelad --- configs/backup/locations/1/location.config | 2 +- .../js/components/backup/backup-page.js | 18 +++++++++++++----- scripts/backup/locations/location_add.sh | 2 +- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/configs/backup/locations/1/location.config b/configs/backup/locations/1/location.config index 7b51b6e..308ef4e 100644 --- a/configs/backup/locations/1/location.config +++ b/configs/backup/locations/1/location.config @@ -2,7 +2,7 @@ # Edit via the Locations page on /backup, or directly here. CFG_BACKUP_LOC_1_NAME="Local disk" # Location Name - Friendly label shown in the UI CFG_BACKUP_LOC_1_ENABLED=true # Enabled - Snapshot to this location -CFG_BACKUP_LOC_1_ENGINE=restic # Engine - Backup engine used at this location [restic:Restic|borg:BorgBackup|kopia:Kopia] +CFG_BACKUP_LOC_1_ENGINE=restic # Engine - Backup engine used at this location [restic:Restic|borg:BorgBackup|kopia:Kopia] **ADVANCED** CFG_BACKUP_LOC_1_PASSWORD=RANDOMIZEDPASSWORD1 # Repository Password - Used to encrypt/decrypt snapshots — back up offline! CFG_BACKUP_LOC_1_TYPE=local # Type - Backend [local:Local / mounted path|sftp:SFTP|rest:REST|s3:S3|b2:Backblaze B2|gs:Google Cloud Storage|azure:Azure|rclone:rclone] CFG_BACKUP_LOC_1_PATH_MODE=auto # Path Mode - Where this location stores its data [auto:Automatic (/docker/backups/)|custom:Custom path] diff --git a/containers/libreportal/frontend/js/components/backup/backup-page.js b/containers/libreportal/frontend/js/components/backup/backup-page.js index 4b66dee..affb874 100644 --- a/containers/libreportal/frontend/js/components/backup/backup-page.js +++ b/containers/libreportal/frontend/js/components/backup/backup-page.js @@ -64,8 +64,9 @@ const BACKUP_LOC_FIELDS_BY_TYPE = { // Suffixes that live in the editor's "Advanced" tab. configs.json can flag // more via a **ADVANCED** comment marker; this set keeps the known overrides -// advanced even on legacy location.configs that predate the marker. -const LOC_ADVANCED_SUFFIXES = new Set(['URI', 'SSH_PORT', 'APPEND_ONLY']); +// advanced even on legacy location.configs that predate the marker. Engine is +// here too — the system picks a sensible default, so most users never touch it. +const LOC_ADVANCED_SUFFIXES = new Set(['ENGINE', 'URI', 'SSH_PORT', 'APPEND_ONLY']); function backupRetentionDetectPreset(values, includeInherit = false) { const norm = (v) => (v == null ? '' : String(v).trim()); @@ -769,9 +770,6 @@ class BackupPage { if (conn) { conn.innerHTML = this.renderLocFields(idx, groups.connection, { ...loc, type }); this.tagFieldsForSave(conn); - this.filterEngineSelect(conn, type, loc.engine); - this.applySshAuthVisibility(conn); - this.applyPathModeVisibility(conn); } // The Advanced tab's fields are type-dependent too (URI override only @@ -783,6 +781,16 @@ class BackupPage { : `
No advanced options for this location type.
`; this.tagFieldsForSave(adv); } + + // Re-apply dynamic behaviors across the whole details scope: the engine + // select lives in the Advanced tab while SSH-auth / path-mode live in + // Connection, so target the shared parent rather than one panel. + const scope = (conn || adv)?.closest('.task-details'); + if (scope) { + this.filterEngineSelect(scope, type, loc.engine); + this.applySshAuthVisibility(scope); + this.applyPathModeVisibility(scope); + } this.enhanceEngineDetailsButton(); } diff --git a/scripts/backup/locations/location_add.sh b/scripts/backup/locations/location_add.sh index 5f97048..f5506c9 100644 --- a/scripts/backup/locations/location_add.sh +++ b/scripts/backup/locations/location_add.sh @@ -32,7 +32,7 @@ locationAdd() echo "# Edit via the Locations page on /backup, or directly here." echo "CFG_BACKUP_LOC_${idx}_NAME=\"${name}\" # Location Name - Friendly label shown in the UI" echo "CFG_BACKUP_LOC_${idx}_ENABLED=false # Enabled - Snapshot to this location" - echo "CFG_BACKUP_LOC_${idx}_ENGINE=${default_engine} # Engine - Backup engine used at this location [restic:Restic|borg:BorgBackup|kopia:Kopia]" + echo "CFG_BACKUP_LOC_${idx}_ENGINE=${default_engine} # Engine - Backup engine used at this location [restic:Restic|borg:BorgBackup|kopia:Kopia] **ADVANCED**" echo "CFG_BACKUP_LOC_${idx}_PASSWORD=RANDOMIZEDPASSWORD1 # Repository Password - Used to encrypt/decrypt snapshots — back up offline!" echo "CFG_BACKUP_LOC_${idx}_TYPE=${type} # Type - Backend [local:Local / mounted path|sftp:SFTP|rest:REST|s3:S3|b2:Backblaze B2|gs:Google Cloud Storage|azure:Azure|rclone:rclone]" echo "CFG_BACKUP_LOC_${idx}_PATH_MODE=${default_path_mode} # Path Mode - Where this location stores its data [auto:Automatic (/docker/backups/)|custom:Custom path]"