| 10 |
10 |
|
|
| 11 |
11 |
|
let currentSection = 'appearance';
|
| 12 |
12 |
|
|
|
13 |
+ |
// Mirror of NewBackupSettings in src-tauri/src/backup_scheduler.rs; used only
|
|
14 |
+ |
// to decide whether the backup "Customize" disclosure starts open.
|
|
15 |
+ |
const DEFAULT_BACKUP_FREQUENCY_MINUTES = 15;
|
|
16 |
+ |
const DEFAULT_BACKUPS_TO_KEEP = 10;
|
|
17 |
+ |
|
| 13 |
18 |
|
// Settings Page
|
| 14 |
19 |
|
|
| 15 |
20 |
|
/**
|
| 221 |
226 |
|
];
|
| 222 |
227 |
|
|
| 223 |
228 |
|
const renderFormField = GoingsOn.ui.renderFormField;
|
|
229 |
+ |
// Frequency and retention sit behind a disclosure: the defaults are
|
|
230 |
+ |
// right for almost everyone, so the section reads as one on/off
|
|
231 |
+ |
// choice until someone asks for more. Open it when the settings are
|
|
232 |
+ |
// already customized, so a non-default value is never hidden.
|
|
233 |
+ |
const customized =
|
|
234 |
+ |
settings.backupFrequencyMinutes !== DEFAULT_BACKUP_FREQUENCY_MINUTES
|
|
235 |
+ |
|| settings.maxBackupsToKeep !== DEFAULT_BACKUPS_TO_KEEP;
|
| 224 |
236 |
|
backupHtml = `
|
| 225 |
237 |
|
<div class="settings-section-block">
|
| 226 |
238 |
|
<h4 class="settings-subheading">Backups</h4>
|
| 240 |
252 |
|
<span>Enable automatic backups</span>
|
| 241 |
253 |
|
</label>
|
| 242 |
254 |
|
</div>
|
| 243 |
|
- |
${renderFormField({
|
| 244 |
|
- |
kind: 'select',
|
| 245 |
|
- |
name: 'backup-frequency',
|
| 246 |
|
- |
id: 'backup-frequency',
|
| 247 |
|
- |
label: 'Backup Frequency',
|
| 248 |
|
- |
value: settings.backupFrequencyMinutes,
|
| 249 |
|
- |
options: frequencyOptions.map(o => ({
|
| 250 |
|
- |
value: String(o.value),
|
| 251 |
|
- |
label: o.label,
|
| 252 |
|
- |
selected: settings.backupFrequencyMinutes === o.value,
|
| 253 |
|
- |
})),
|
| 254 |
|
- |
})}
|
| 255 |
|
- |
${renderFormField({
|
| 256 |
|
- |
kind: 'select',
|
| 257 |
|
- |
name: 'backup-retention',
|
| 258 |
|
- |
id: 'backup-retention',
|
| 259 |
|
- |
label: 'Retention Policy',
|
| 260 |
|
- |
value: settings.maxBackupsToKeep,
|
| 261 |
|
- |
options: retentionOptions.map(o => ({
|
| 262 |
|
- |
value: String(o.value),
|
| 263 |
|
- |
label: o.label,
|
| 264 |
|
- |
selected: settings.maxBackupsToKeep === o.value,
|
| 265 |
|
- |
})),
|
| 266 |
|
- |
hint: 'Older backups are automatically deleted to save space.',
|
| 267 |
|
- |
})}
|
|
255 |
+ |
<details class="settings-disclosure"${customized ? ' open' : ''}>
|
|
256 |
+ |
<summary class="settings-disclosure-toggle">Customize</summary>
|
|
257 |
+ |
${renderFormField({
|
|
258 |
+ |
kind: 'select',
|
|
259 |
+ |
name: 'backup-frequency',
|
|
260 |
+ |
id: 'backup-frequency',
|
|
261 |
+ |
label: 'Backup Frequency',
|
|
262 |
+ |
value: settings.backupFrequencyMinutes,
|
|
263 |
+ |
options: frequencyOptions.map(o => ({
|
|
264 |
+ |
value: String(o.value),
|
|
265 |
+ |
label: o.label,
|
|
266 |
+ |
selected: settings.backupFrequencyMinutes === o.value,
|
|
267 |
+ |
})),
|
|
268 |
+ |
})}
|
|
269 |
+ |
${renderFormField({
|
|
270 |
+ |
kind: 'select',
|
|
271 |
+ |
name: 'backup-retention',
|
|
272 |
+ |
id: 'backup-retention',
|
|
273 |
+ |
label: 'Retention Policy',
|
|
274 |
+ |
value: settings.maxBackupsToKeep,
|
|
275 |
+ |
options: retentionOptions.map(o => ({
|
|
276 |
+ |
value: String(o.value),
|
|
277 |
+ |
label: o.label,
|
|
278 |
+ |
selected: settings.maxBackupsToKeep === o.value,
|
|
279 |
+ |
})),
|
|
280 |
+ |
hint: 'Older backups are automatically deleted to save space.',
|
|
281 |
+ |
})}
|
|
282 |
+ |
</details>
|
| 268 |
283 |
|
<div class="settings-actions-row settings-actions-row--center">
|
| 269 |
284 |
|
<button class="btn btn-primary" data-act="export.saveBackupSettings">Save Backup Settings</button>
|
| 270 |
285 |
|
<span class="settings-status-text">${esc(lastBackupText)}</span>
|