Skip to content

feat(filemanager): add real-time progress tracking to browser batch downloads#332

Merged
HFO4 merged 2 commits into
cloudreve:masterfrom
OnAirGame:feat/batch-download-progress
Mar 31, 2026
Merged

feat(filemanager): add real-time progress tracking to browser batch downloads#332
HFO4 merged 2 commits into
cloudreve:masterfrom
OnAirGame:feat/batch-download-progress

Conversation

@OnAirGame

Copy link
Copy Markdown
Contributor

Summary

Replaces the indeterminate "Batch download has started..." snackbar with a real-time progress tracker for browser-side batch downloads.

Before

  • Indeterminate spinner with no progress information
  • "Details" button opens a text log
  • No warning when closing tab during download
  • No feedback on completion or cancellation

After

  • File counter: "3 / 76 files downloaded (2%)"
  • Byte-based progress bar that updates smoothly during large file downloads
  • Current filename being downloaded (with "saving..." status during disk write)
  • Download speed in MB/s (rolling 5-sample average)
  • Total bytes downloaded
  • Cancel button (red X) that cleanly aborts the download
  • Green "Download complete!" toast with file count and total size on success
  • Yellow "Download cancelled" toast when user cancels
  • Browser beforeunload warning to prevent accidental tab closure during downloads

How it works

  • Streams each fetch response via ReadableStream.getReader() to count bytes in real-time
  • Walks the file tree upfront to calculate total expected bytes for accurate percentage
  • Throttles Redux dispatches to every 500ms to avoid render storms
  • Uses the existing cancelSignals AbortController for clean cancellation
  • Uses the existing LoadingSnackbar getProgress callback for the circular progress indicator

Files changed

| File | Change |
| src/redux/thunks/download.ts | Progress tracking, byte streaming, cancel/complete handling |
| src/component/Common/Snackbar/snackbar.tsx | Progress and completion UI components |
| src/redux/globalStateSlice.ts | BatchDownloadProgress state and reducers |
| src/component/Common/Snackbar/LoadingSnackbar.tsx | Layout adjustment for progress display |
| src/redux/thunks/file.ts | Added getProgress param to longRunningTaskWithSnackbar |
| public/locales/en-US/application.json | i18n strings for new UI text |

Test plan

  • Select multiple files → Download → Browser-side download to folder
  • Verify progress bar, file counter, speed, and current filename update in real-time
  • Verify large files show "(saving...)" status during disk write
  • Click cancel during download → verify download stops and "Download cancelled" toast appears
  • Let download complete → verify "Download complete!" toast with summary
  • Try closing/refreshing tab during download → verify browser "Leave site?" warning
  • Verify existing download log dialog still works via "Details" button
CANCEL.mp4
DOWNLOADCOMPLETE.mp4
DOWNLOADING.mp4
DOWNLOAD TAB

…ownloads

Replace the indeterminate "Batch download has started" snackbar with a
detailed progress tracker showing file count, byte-based percentage,
download speed (rolling average), current filename, and a progress bar.

- Stream response bodies via ReadableStream to track bytes in real-time
- Calculate download speed using a rolling 5-sample average
- Show "saving..." status during filesystem write operations
- Add cancel button that cleanly aborts the download
- Show completion/cancellation toasts with download summary
- Add beforeunload warning to prevent accidental tab closure

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@CLAassistant

CLAassistant commented Mar 31, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Comment thread src/component/Common/Snackbar/snackbar.tsx Outdated
@HFO4

HFO4 commented Mar 31, 2026

Copy link
Copy Markdown
Member

Thanks!
I've pushed new changes to improve the UI and localization.

@HFO4 HFO4 merged commit 401b981 into cloudreve:master Mar 31, 2026
1 check passed
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.

[Tweak Request] Batch download shows no progress information (file count, speed, or current file)

4 participants