diff --git a/containers/libreportal/frontend/js/components/backup/backup-page.js b/containers/libreportal/frontend/js/components/backup/backup-page.js index c11ae2f..668094f 100644 --- a/containers/libreportal/frontend/js/components/backup/backup-page.js +++ b/containers/libreportal/frontend/js/components/backup/backup-page.js @@ -12,8 +12,8 @@ const BACKUP_RETENTION_PRESETS = { }; const BACKUP_RETENTION_PRESET_META = { - 'inherit-global': { label: 'Inherit global retention (default)', hint: 'Use whatever the Configuration tab specifies. Pick something else here only when this location needs a different policy.' }, - 'self-hosting': { label: 'Self-hosting (default)', hint: '30 days of daily backups. Plenty for a homelab — covers accidental deletes and app screw-ups.' }, + 'inherit-global': { label: 'Inherit global retention', hint: 'Use whatever the Configuration tab specifies. Pick something else here only when this location needs a different policy.' }, + 'self-hosting': { label: 'Self-hosting', hint: '30 days of daily backups. Plenty for a homelab — covers accidental deletes and app screw-ups.' }, 'personal': { label: 'Personal', hint: '30 days of daily backups plus 6 monthly snapshots. Good for personal data where "what did this look like last summer" matters.' }, 'enterprise': { label: 'Enterprise', hint: '30 daily + 12 monthly + 5 yearly. Compliance-style retention with multi-year history.' }, 'custom': { label: 'Custom…', hint: 'Define each retention tier yourself.' } @@ -937,9 +937,7 @@ class BackupPage { const preset = backupRetentionDetectPreset(readVals()); const meta = BACKUP_RETENTION_PRESET_META[preset]; - const presetOptions = Object.entries(BACKUP_RETENTION_PRESET_META) - .map(([k, v]) => ``) - .join(''); + const presetOptions = this.retentionPresetOptions(preset, false); const block = document.createElement('div'); block.className = 'backup-retention-preset-block'; @@ -980,6 +978,23 @@ class BackupPage { }); } + /* Build the `; + }).join(''); + } + /* Retention preset dropdown + hidden underlying fields. `prefix` is the CFG name prefix, e.g. 'CFG_BACKUP_' or 'CFG_BACKUP_LOC_3_'. When `includeInherit` is true (per-location scope), an "Inherit global" @@ -990,10 +1005,7 @@ class BackupPage { formRetention(prefix, values, includeInherit = false) { const preset = backupRetentionDetectPreset(values, includeInherit); const meta = BACKUP_RETENTION_PRESET_META[preset]; - const presetOptions = Object.entries(BACKUP_RETENTION_PRESET_META) - .filter(([k]) => k !== 'inherit-global' || includeInherit) - .map(([k, v]) => ``) - .join(''); + const presetOptions = this.retentionPresetOptions(preset, includeInherit); const customRetentionHidden = includeInherit ? ``