Skip to content

v2: backups management page in settings#1109

Merged
canalesb93 merged 1 commit into
mainfrom
v2/settings-backups
May 16, 2026
Merged

v2: backups management page in settings#1109
canalesb93 merged 1 commit into
mainfrom
v2/settings-backups

Conversation

@canalesb93
Copy link
Copy Markdown
Owner

Summary

Adds a Backups section to the v2 settings modal so admins can manage PostgreSQL dumps from the new dashboard. Previously the only way to manage backups was the v1 admin UI at /settings/backups.

The page wraps the existing internal/service.BackupService via a new admin-only /web/v1/backups/* surface:

Method Path What
GET /web/v1/backups list backups + status (count, total size, schedule, retention, preflight, db name, backup dir)
POST /web/v1/backups create a manual backup
DELETE /web/v1/backups/{filename} delete a backup
GET /web/v1/backups/{filename}/download stream .sql.gz to the browser
POST /web/v1/backups/{filename}/restore restore from an existing file (AlertDialog confirm)
POST /web/v1/backups/restore restore from an uploaded .sql.gz (multipart, capped at 500 MB)
PUT /web/v1/backups/schedule update schedule + retention

All routes are session-only and admin-only (admin.IsAdmin gate — editor/viewer get 403). The v1 admin handlers at /-/backups/* are unchanged; both UIs coexist.

The SPA side is one new BackupsSection feature component built on existing shadcn primitives (Alert, AlertDialog, Badge, Button, Form, Input, Select, Separator, Skeleton, Tooltip). No new components added to components/ui or components/.

Validation

Tested live against a worktree server with a real PostgreSQL backup created end-to-end (create → list → schedule → confirmations all wired). Desktop and mobile both render cleanly.

Desktop — initial view (1280×1100, dialog clipped to its 600 px max):

Backups settings — desktop (top)

Desktop — full content (dialog auto-height so the file list and schedule form are visible):

Backups settings — desktop (full)

Mobile (390×844, sheet scrolled to the Backups heading):

Backups settings — mobile

Test plan

  • GET /web/v1/backups returns status + list with stored files
  • POST /web/v1/backups produces a new .sql.gz and the row appears in the list
  • DELETE /web/v1/backups/{filename} removes it
  • Schedule form persists backup_schedule + backup_retention_days (visible in app_config)
  • Restore from upload accepts only .sql.gz; other file types are rejected with INVALID_FILE
  • Non-admin sessions hitting any /web/v1/backups/* route receive 403 FORBIDDEN
  • Toggling between Account / Backups in the modal preserves the URL-based modal state

Adds a "Backups" section to the v2 settings modal so admins can manage
PostgreSQL dumps without dropping back to the v1 admin UI:

- list + at-a-glance stats (count, total size, schedule, retention,
  database, backup directory, preflight status)
- create on-demand backup
- restore from an existing backup (with confirmation)
- restore from an uploaded .sql.gz (with confirmation)
- delete a backup
- download a backup
- edit the automatic schedule + retention window

The SPA talks to a new admin-only /web/v1/backups/* surface that wraps
the existing internal/service.BackupService. The v1 admin handlers at
/-/backups/* are untouched. All shadcn primitives are used as-is; no
new UI components introduced.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@canalesb93 canalesb93 force-pushed the v2/settings-backups branch from d17c6ce to f2d30cb Compare May 16, 2026 05:58
@canalesb93 canalesb93 enabled auto-merge (squash) May 16, 2026 05:58
@canalesb93 canalesb93 merged commit c29020c into main May 16, 2026
7 checks passed
@canalesb93 canalesb93 deleted the v2/settings-backups branch May 16, 2026 06:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant