diff --git a/CHANGELOG.md b/CHANGELOG.md index 4daddc8..d03396e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -76,6 +76,12 @@ > `0.1.12`),由 `scripts/version.py` 从 git **算出来**;开发交付的独立说明写入本文件“开发快照”章节,并打 `snapshot/vX.Y.Z` 注释标签 ⇒ 每次开发交付均可追溯, > 但"发布版本"仍然只能由人定(CI 不会自动升版本、不会打 tag)。 +## 开发快照 snapshot/v0.1.60 - 2026-10-25 + +### Added + +- 右侧问答详情顶部增加上一条、下一条,沿当前筛选后的完整已载入表格顺序切换;首尾自动禁用,后续页载入后自动开放下一条,读取中或失败仍能切换,关闭保留原表格焦点。 + ## 开发快照 snapshot/v0.1.59 - 2026-10-25 ### Fixed diff --git a/web/src/QAOperations.test.tsx b/web/src/QAOperations.test.tsx index a40d08e..52110f5 100644 --- a/web/src/QAOperations.test.tsx +++ b/web/src/QAOperations.test.tsx @@ -52,6 +52,58 @@ const props = { } describe('QA operations workbench', () => { + it('puts previous/next in the detail header and follows the entire filtered result, including loading and error states', () => { + const items = Array.from({ length: 101 }, (_, index) => ({ ...item, id: 'filtered-' + index })) + const cases = [ + { index: 0, previous: false, next: true }, + { index: 50, previous: true, next: true }, + { index: 100, previous: true, next: false }, + { index: -1, previous: false, next: false }, + ] + for (const state of ['ready', 'loading', 'failed']) { + for (const value of cases) { + const selected = items[value.index] ?? { ...item, id: 'not-in-this-filter' } + const html = renderToStaticMarkup( + + ) + const drawer = html.slice(html.indexOf('')) + for (const [label, enabled] of [ + ['上一条', value.previous], + ['下一条', value.next], + ] as const) { + const button = header.match(new RegExp(']*)>' + label + '')) + expect(button, state + ': ' + selected.id + ': ' + label).not.toBeNull() + expect(button?.[1].includes('disabled=""')).toBe(!enabled) + } + } + } + }) + it('enables next automatically when the background reader appends the next page', () => { + const items = Array.from({ length: 101 }, (_, index) => ({ ...item, id: 'filtered-' + index })) + for (const loaded of [100, 101]) { + const html = renderToStaticMarkup( + + ) + const drawer = html.slice(html.indexOf('')).match(/]*)>下一条<\/button>/) + expect(button).not.toBeNull() + expect(button?.[1].includes('disabled=""')).toBe(loaded === 100) + } + }) + it('puts all five selectors in their own table header cells, including empty filtered results', () => { const filtering = { filters: { coverage: '否' }, onFiltersChange: vi.fn() } for (const value of [page, { ...page, items: [], total: 0, has_more: false }]) { diff --git a/web/src/QAOperations.tsx b/web/src/QAOperations.tsx index c0dc8c7..33e7c86 100644 --- a/web/src/QAOperations.tsx +++ b/web/src/QAOperations.tsx @@ -52,6 +52,7 @@ interface ViewProps { loading: boolean error: string | null detail: QARecord | null + detailID?: string | null detailLoading: boolean detailError: string | null onSelect: (id: string) => void @@ -176,6 +177,9 @@ export function QAOperationsView(props: ViewProps) { return map }, [props.taskUpdates]) const detail = props.detail + const detailIndex = page?.items.findIndex((item) => item.id === (props.detailID ?? detail?.id)) ?? -1 + const previous = detailIndex > 0 ? page?.items[detailIndex - 1] : undefined + const next = detailIndex >= 0 ? page?.items[detailIndex + 1] : undefined const showDrawer = Boolean(detail || props.detailLoading || props.detailError) return (
@@ -320,9 +324,17 @@ export function QAOperationsView(props: ViewProps) { >

问答详情

- +
+ + + +
{detail ? ( (null) + const [detailID, setDetailID] = useState(null) const [detailLoading, setDetailLoading] = useState(false) const [detailError, setDetailError] = useState(null) const [progress, setProgress] = useState<{ loaded: number; total: number } | undefined>() @@ -454,6 +467,7 @@ export function QAOperations() { setError(null) detailRequest.current?.abort() setDetail(null) + setDetailID(null) return } const controller = new AbortController() @@ -465,6 +479,7 @@ export function QAOperations() { setPage(null) setProgress(undefined) setDetail(null) + setDetailID(null) setDetailError(null) setDetailLoading(false) void fetchQAStatus(controller.signal) @@ -547,9 +562,11 @@ export function QAOperations() { }, []) const select = useCallback(async (id: string) => { detailRequest.current?.abort() - returnFocus.current = document.activeElement as HTMLElement | null + if (!document.activeElement?.closest('.qa-ops-drawer')) + returnFocus.current = document.activeElement as HTMLElement | null const controller = new AbortController() detailRequest.current = controller + setDetailID(id) setDetail(null) setDetailError(null) setDetailLoading(true) @@ -585,6 +602,7 @@ export function QAOperations() { } detailRequest.current?.abort() setDetail(null) + setDetailID(null) setDetailError(null) setDetailLoading(false) returnFocus.current?.focus() @@ -728,6 +746,7 @@ export function QAOperations() { error={error} loading={loading} detail={detail} + detailID={detailID} detailLoading={detailLoading} detailError={detailError} onReloadDetail={() => { diff --git a/web/src/qaOps.css b/web/src/qaOps.css index a599a0e..c295575 100644 --- a/web/src/qaOps.css +++ b/web/src/qaOps.css @@ -366,6 +366,7 @@ } .qa-ops-drawer > header { display: flex; + flex-wrap: wrap; justify-content: space-between; align-items: center; flex: none; @@ -374,6 +375,11 @@ background: var(--bg-panel); border-bottom: 1px solid var(--border-base); } +.qa-detail-actions { + display: flex; + flex-wrap: wrap; + gap: 8px; +} .qa-detail-quality { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));