feat(backup): move Engine into the location editor's Advanced tab

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 <noreply@anthropic.com>
Signed-off-by: librelad <librelad@digitalangels.vip>
This commit is contained in:
librelad 2026-05-23 14:39:48 +01:00
parent 8a99ebd080
commit 24abe412e0
3 changed files with 15 additions and 7 deletions

View File

@ -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/<id>)|custom:Custom path]

View File

@ -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 {
: `<div class="backup-empty-state">No advanced options for this location type.</div>`;
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();
}

View File

@ -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/<id>)|custom:Custom path]"