Add configurable backup schedule with admin UI

- Make backup frequency (6h/12h/1d/7d), time, and day-of-week
  configurable via settings, stored in appSettings key-value table
- Add rescheduleBackup() to dynamically update cron job at runtime
- Differentiate manual (sofa-manual-*) vs scheduled (sofa-scheduled-*)
  backup filenames with source icons and tooltips in the backup list
- Pruning now only targets scheduled backups, leaving manual ones intact
- Merge backup-actions.ts into actions.ts, use shadcn DropdownMenu for
  all selectors (consistent with dashboard stats cards)
- Fix hydration mismatch on relative backup timestamps

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-04 13:43:40 -05:00
co-authored by Claude Opus 4.6
parent b17f54f6db
commit 6cfe3a0439
6 changed files with 465 additions and 129 deletions
+12
View File
@@ -64,6 +64,15 @@ export default async function SettingsPage() {
const maxBackupRetention = isAdmin
? Number.parseInt(getSetting("maxBackupRetention") ?? "7", 10)
: 7;
const backupFrequency = isAdmin
? (getSetting("backupScheduleFrequency") ?? "1d")
: "1d";
const backupTime = isAdmin
? (getSetting("backupScheduleTime") ?? "02:00")
: "02:00";
const backupDow = isAdmin
? Number.parseInt(getSetting("backupScheduleDow") ?? "0", 10)
: 0;
const repoUrl = "https://github.com/jakejarvis/sofa";
@@ -129,6 +138,9 @@ export default async function SettingsPage() {
initialBackups={backups}
initialScheduledEnabled={scheduledBackupsEnabled}
initialMaxRetention={maxBackupRetention}
initialFrequency={backupFrequency as "6h" | "12h" | "1d" | "7d"}
initialTime={backupTime}
initialDow={backupDow}
/>
</Card>
</div>