feat(downloads): clear completed and failed downloads
Summary
• Add toolbar buttons to clear completed and failed downloads from the UI
• Optional checkbox to also delete downloaded files from disk (with prominent warning)
• Confirmation dialog (ClearDownloadsDialog) preventing accidental deletion
• Success and error toast notifications via new sonner infrastructure
• Backend: ClearDownloadsByStateCommand handler with terminal-state validation
• i18n: Full translations in English and French (22 new keys)
Technical Details
Backend Changes:
- New command handler validates downloads are in terminal state (Completed or Error only)
- Deletes from database first, then filesystem (ensures consistency)
- Emits
DownloadsCleareddomain event after each operation - Distinguishes
NotFounderrors (idempotent) from other I/O failures - 8 unit tests covering happy path, validation, file deletion, error handling
Frontend Changes:
- Two new toolbar buttons with CheckCheck and XCircle icons
- Vertical separator between bulk actions and clear actions
- Dialog with reactive warning panel (red background, AlertTriangle icon)
- Checkbox state controls button label: "Clear" → "Clear and delete files"
- Button variant changes to
destructivewhen deleteFiles is true - Toast notifications on success/error with item counts
Dependencies:
- Added sonner (^2.0.7) for toast notifications
- New abstraction layer
src/lib/toast.tsfor consistency
Testing:
- 8 ClearDownloadsDialog unit tests
- 5 new ActionsBar integration tests
- All 360 frontend Vitest tests passing
- All 577 Rust backend tests passing
- Zero lint warnings (oxlint + cargo clippy)
Type
feat
Summary by cubic
Adds “Clear completed” and “Clear failed” actions to the Downloads toolbar, with an optional “also delete files” flow and a confirmation dialog to safely clean up the list. Includes backend support, toast notifications via sonner, and EN/FR i18n.
-
New Features
- Downloads toolbar: buttons to clear completed or failed items, disabled at zero count.
- Confirmation dialog with “Also delete files from disk” checkbox, warning panel, and destructive label when enabled.
- Success/error toasts via
sonner; Toaster mounted globally with a minimalsrc/lib/toast.tswrapper. - Backend:
ClearDownloadsByStateCommand(Completed/Error only), deletes DB rows first then files, treats missing files as idempotent, emits events. - Tauri IPC:
download_clear_completedanddownload_clear_failed.
-
Bug Fixes
- Fixed
.vortex-metasidecar removal by passing the raw destination path todelete_meta. - Dialog catches rejected mutations to avoid unhandled promise rejections; failures still show an error toast.
- Clear buttons subscribe to
countByStateviauseTauriQueryso the disabled state updates after clearing.
- Fixed
Summary by CodeRabbit
-
New Features
- "Clear completed" and "Clear failed" toolbar buttons with confirmation dialogs and an optional "also delete files from disk" destructive warning; operations show success/error toasts and report counts.
-
Download Flow
- New fallback to download merged adaptive-stream files when adaptive-only streams are encountered.
-
Internationalization
- Added English and French strings for dialogs, actions, and toasts.
-
Tests
- Added unit and UI tests for dialog and actions bar flows.
-
Chores
- Integrated a runtime toast library and updated changelogs/docs.