Skip to content

feat(offline_download): add task progress list - #411

Closed
zwzzrl wants to merge 13 commits into
OpenListTeam:mainfrom
zwzzrl:main
Closed

zwzzrl wants to merge 13 commits into
OpenListTeam:mainfrom
zwzzrl:main

Conversation

@zwzzrl

@zwzzrl zwzzrl commented Mar 10, 2026

Copy link
Copy Markdown

Description / 描述

为工具栏的离线下载页面添加了任务列表,使得添加完离线下载任务后可以看到任务状态。

Motivation and Context / 背景

方便添加完离线下载任务后看到任务状态,不用打开后台。
屏幕截图 2026-03-10 223936
屏幕截图 2026-03-10 224009

Closes #410

How Has This Been Tested? / 测试

添加离线下载任务列表

Checklist / 检查清单

  • I have read the CONTRIBUTING document.
    我已阅读 CONTRIBUTING 文档。
  • I have formatted my code with go fmt or prettier.
    我已使用 go fmt 或 prettier 格式化提交的代码。
  • I have added appropriate labels to this PR (or mentioned needed labels in the description if lacking permissions).
    我已为此 PR 添加了适当的标签(如无权限或需要的标签不存在,请在描述中说明,管理员将后续处理)。
  • I have requested review from relevant code authors using the "Request review" feature when applicable.
    我已在适当情况下使用"Request review"功能请求相关代码作者进行审查。
  • I have updated the repository accordingly (If it’s needed).
    我已相应更新了相关仓库(若适用)。

zwzzrl and others added 6 commits March 10, 2026 22:21
@xrgzs xrgzs changed the title feat(offline_download):添加离线下载任务列表功能 feat(offline_download): add task list Mar 11, 2026
@xrgzs xrgzs changed the title feat(offline_download): add task list feat(offline_download): add task progress list Mar 11, 2026
@xrgzs
xrgzs requested a review from Copilot March 11, 2026 02:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an in-modal task progress list to the Home toolbar “Offline Download” flow so users can see ongoing task status immediately after submitting tasks (addresses #410).

Changes:

  • Extend the offline download modal to optionally show a periodically refreshed task list.
  • Add a small tasks fetch/store module and a TaskProgress UI component to render task state/progress.
  • Extend ModalInput with onSubmitWithValue to allow submit handlers to clear/reset the input value after success.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
src/pages/home/toolbar/OfflineDownload.tsx Shows task list in the modal and polls backend for task updates
src/pages/home/offlinedownload/task.ts Implements task fetching + merged list state (old/new endpoints)
src/pages/home/offlinedownload/TaskProgress.tsx Renders individual task progress cards with parsed metadata/links
src/components/ModalInput.tsx Adds onSubmitWithValue callback to expose setValue to submit handlers
src/lang/en/tasks.json Adds i18n strings for the offline download task list UI

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread src/components/ModalInput.tsx Resolved
Comment thread src/pages/home/offlinedownload/task.ts Resolved
Comment thread src/pages/home/offlinedownload/task.ts Resolved

@xrgzs xrgzs left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

需要清除重复代码、将文件移动到正确位置

@zwzzrl
zwzzrl requested a review from xrgzs March 11, 2026 07:37
xrgzs added 2 commits March 11, 2026 16:36
Signed-off-by: MadDogOwner <xiaoran@xrgzs.top>
Signed-off-by: MadDogOwner <xiaoran@xrgzs.top>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread src/pages/home/toolbar/TaskProgress.tsx Resolved
Comment thread src/pages/home/toolbar/TaskProgress.tsx Resolved
Comment thread src/pages/home/toolbar/TaskProgress.tsx Resolved
Comment thread src/pages/home/toolbar/TaskProgress.tsx Resolved

@pikachuren pikachuren left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

结论:需修改后再合并

离线下载任务进度列表面板:轮询用 isFetching 防并发叠加、关闭时 clearTimeout + onCleanup 清理、createEffect 依赖 showTasks() 使轮询随弹窗启停,生命周期处理正确;合并两个 endpoint 用 taskMap 去重并按 start_time 降序,思路合理。但有一处健壮性问题:

一、单端点失败导致整表不可见且无反馈(中等)
store/task.ts 用 Promise.all 同时请求 /task/offline_download/undone 和 /task/offline_download_transfer/undone,getTasksFromResp 对任一非 200 抛错,外层 catch 只 console.error。transfer 接口若异常(功能未启用/超时),整个任务列表静默失败,setTasks 不执行,用户看到陈旧/空列表且无提示。建议改为独立容错(各自 try/catch)或用 Promise.allSettled。

二、轮询失败被吞掉(中等)
轮询的 fetchOfflineDownloadTasks(false) 同样被 catch 吞掉,后端间歇性失败时任务列表一直显示旧数据,无 loading/error 状态,用户无法区分「正常无任务」与「拉取失败」。建议区分网络错误并显示占位提示。

三、提交成功后弹窗不再自动关闭(低,行为变更)
原 onSubmit 成功时 onClose(),新 handleSubmit 成功只清空输入框不关弹窗(为了看进度,属预期),需确认这是有意的 UX 变更。

合并建议:将 Promise.all 改为独立容错并对拉取失败给出用户可见提示,确认「提交后不关弹窗」为预期行为后合并。

@zwzzrl zwzzrl closed this Oct 2, 2026
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.

4 participants