feat(frontend): select all documents across pages - #2590
Closed
LiangYuHai wants to merge 1 commit into
Closed
Conversation
The document list loads incrementally via infinite scroll, so the header select-all checkbox could only select the loaded slice; reaching documents further down required scrolling until every page had loaded. Fetch all ids matching the current filters page by page (page_size 1000, the backend maximum) when select-all is checked. While fetching, the batch action bar shows a loading indicator and disables its action buttons so operations don't run on an incomplete selection. Cancelling select-all, switching filters or knowledge bases mid-fetch discards the in-flight result via a generation counter, and the selection is no longer pruned against the loaded window while cross-page select-all is active.
Collaborator
|
我不认为循环遍历全部分页是一个正确的方式 |
Author
|
同意,前端循环翻页拉全量 ID 不是理想方案,是在现有「批量接口只收 ids、且单次 ≤200」约束下的过渡实现。 更干净的方向我理解有两类: 1、轻量 ID 接口:例如按当前筛选一次性(或 cursor)只返回 id 列表,前端仍走现有 batch-by-ids; 你这边是更倾向 1 还是 2?若认可其中一条,我可以按那个方向改;若暂时不想动后端,这个 frontend-only PR 也可以先关掉或标成 draft。 另外,#2588 是在现有 ids 契约下按 200 分片,避免超限 400,和「是否循环分页全选」是正交的。 |
Collaborator
|
倾向于2,request中新加一个标识字段,让后端来处理 |
9 tasks
Author
|
已经按方案2完善“全选”+“筛选”功能: #2685 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
文档列表采用无限滚动加载,
cardList只保存已加载的窗口。表头"全选"只能选中已加载的部分,想要选中靠后的文档,
用户必须一直向下滚动直到所有页面加载完成,操作繁琐且容易遗漏。
改动
(page_size 取后端上限 1000),与列表筛选条件保持一致。
移动等操作按钮,避免对尚未拉全的选择集执行操作。
切换筛选条件或知识库时,丢弃本次拉取结果。
(选择集本来就包含未加载窗口内的 id)。
关联
本功能让选中超过 200 个文档变得容易,依赖配套的批量提交修复:
https://github.com/Tencent/WeKnora/pull/2588(按 200 分批提交,避免后端 400)。
建议两个 PR 一并合入。
测试
批量操作栏计数随拉取增长直至总数。