Files
tiny-forge/plans/backup-management/phase-3-backup-ui.md
T
alexei.dolgolyov a9c7775bb7 feat: configuration backup management with manual and auto backup
Add backup/restore functionality for the SQLite database. Users can
trigger manual backups, configure automatic backups on an interval
with retention policies, list/download/delete backups, and restore
from any backup.

- Backup engine using VACUUM INTO (safe with WAL mode)
- Backup metadata tracked in DB, files stored in DATA_DIR/backups/
- Settings: backup_enabled, backup_interval_hours, backup_retention_count
- API: POST/GET/DELETE /api/backups, download, restore endpoints
- Autobackup via cron scheduler with configurable interval
- Retention: prune on startup, after each backup (manual and auto)
- Orphan cleanup: removes backup files without metadata on startup
- Restore: replaces DB and triggers graceful server shutdown
- Settings UI: /settings/backup with toggle, interval, retention config
- Backup list with download, delete, restore actions
- i18n: English and Russian translations
2026-04-02 15:32:15 +03:00

46 lines
1.7 KiB
Markdown

# Phase 3: Backup Settings & Management UI
**Status:** ⬜ Not Started
**Parent plan:** [PLAN.md](./PLAN.md)
**Domain:** frontend
## Objective
Create a backup management page under settings with autobackup configuration,
manual backup trigger, and backup list with download/delete/restore actions.
## Tasks
- [ ] Task 1: Add API functions in api.ts
- triggerBackup, listBackups, downloadBackup, deleteBackup, restoreBackup
- [ ] Task 2: Add types in types.ts (BackupInfo interface)
- [ ] Task 3: Add i18n keys for backup page (en.json, ru.json)
- [ ] Task 4: Create backup settings page at `/settings/backup/+page.svelte`
- Autobackup toggle + interval selector + retention count
- "Backup Now" button with loading state
- Backup list table: filename, date, size, type, actions
- Download button (direct file download)
- Delete button with confirmation
- Restore button with strong warning dialog
- [ ] Task 5: Add navigation link in settings layout
- [ ] Task 6: Create IconBackup component (or reuse IconHardDrive/IconDatabase)
## Files to Modify/Create
- `web/src/lib/api.ts` — add backup API functions
- `web/src/lib/types.ts` — add BackupInfo type
- `web/src/lib/i18n/en.json` — add backup i18n keys
- `web/src/lib/i18n/ru.json` — add backup i18n keys
- `web/src/routes/settings/backup/+page.svelte` — new page
- `web/src/routes/settings/+layout.svelte` — add nav item
## Acceptance Criteria
- Backup page accessible at /settings/backup
- Autobackup settings save correctly
- Manual backup triggers and shows result
- Backup list shows all backups with correct metadata
- Download streams file to browser
- Delete removes backup with confirmation
- Restore shows warning and triggers restore
## Handoff to Next Phase
<!-- Filled in after completion -->