Peach: Local-first video metadata scraper and media manager.
fix(web): 采集失败后页脚仍留着「扫描并补全资料」
longmeidao665c2a069bc5
diff --git a/frontend/src/react/library-processing/library-processing-card.tsx b/frontend/src/react/library-processing/library-processing-card.tsxindex 28a7a1e54..23be9ab54 100644--- a/frontend/src/react/library-processing/library-processing-card.tsx+++ b/frontend/src/react/library-processing/library-processing-card.tsx@@ -207,7 +207,6 @@ export function LibraryProcessingCard(props: LibraryProcessingProps) {: job.isError ? (job.data ? DISCONNECTED_TEXT : errorMessage(job.error)): '';const busy = start.isPending || state.status === 'running';- const retryable = state.status === 'failed' && !!state.retryable_asset_ids?.length;const line = currentLine(state);const run = (command: LibraryProcessingCommand) => {@@ -244,8 +243,10 @@ export function LibraryProcessingCard(props: LibraryProcessingProps) {{state.candidates? <LinkButton href="/review" size="small" trailingIcon={RiArrowRightLine}>复核资料</LinkButton>: null}- {/* 失败且有可重试项时,这一趟该做的事是「重试未完成项」,它在下面那条错误提示里。 */}- {retryable ? null : <ScanActions busy={busy} onRun={run} />}+ {/* 两个入口并存,各自答的不是一个问题:这里是「重新跑一整批」,下面那条错误提示里+ 的「重试未完成项」只补上一趟没做完的那些。采集里网络超时几乎每趟都留下几项可+ 重试的,页脚要是让位给重试键,新入库的片子就再也没有入口被扫到。 */}+ <ScanActions busy={busy} onRun={run} /></footer></section><Outcome state={state} problem={problem} settled={settled} onRetry={retry} toast={toast} />diff --git a/frontend/test/react/library-processing.test.tsx b/frontend/test/react/library-processing.test.tsxindex cfb067e30..450f4305c 100644--- a/frontend/test/react/library-processing.test.tsx+++ b/frontend/test/react/library-processing.test.tsx@@ -199,8 +199,8 @@ it('失败时把问题清单折叠进错误提示,重试只交失败的那些expect(log.closest('.text-text-secondary')).not.toBeNull();expect(log.closest('.border-t')).not.toBeNull();expect(details.querySelector('button[aria-label="在资源管理器中显示"]')).not.toBeNull();- // 这一趟该做的事是把没做完的补上,页脚不再摆「重新跑一整批」。- expect(buttonNamed('扫描并补全资料', host)).toBeNull();+ // 补上没做完的那些是这一趟的事,重新跑一整批是下一趟的事:页脚那颗留着,各答各的问题。+ expect(buttonNamed('扫描并补全资料', host)?.textContent).toBe('扫描并补全资料');// 重试键是这条提示的主动作:和卡片一样摆在右边,不是正文底下一颗次级键。const retry = buttonNamed('重试未完成项')!;@@ -213,6 +213,19 @@ it('失败时把问题清单折叠进错误提示,重试只交失败的那些expect(served.posts()).toEqual([{ job_id: 'one', retry: [7, 8] }]);});+it('有可重试项时页脚那颗发的仍是整批,不夹带上一趟的失败项', async () => {+ /* 新入库的片子只有整批才扫得到。采集里网络超时几乎每趟都留下几项可重试的,页脚那颗要是+ 在这种时候让位给重试键,就等于再也回不到整批。 */+ const served = await open({+ status: 'failed', job_id: 'one', error: '2 项需要处理',+ retryable_asset_ids: [7, 8], issue_preview: [],+ }, () => ({ status: 'running', job_id: 'two' }));+ const host = await mount(card({ toast: vi.fn() }));++ await click(buttonNamed('扫描并补全资料', host));+ expect(served.posts()).toEqual([{}]);+});+it('失败项都不可重试时仍能重新发起整批任务', async () => {await open({status: 'failed', job_id: 'one', error: '1 项需要处理', issue_count: 1,diff --git a/web/dist/peach-react.js b/web/dist/peach-react.jsindex edc9791b6..98146e0e1 100644--- a/web/dist/peach-react.js+++ b/web/dist/peach-react.js@@ -29688,7 +29688,7 @@ function cT(e) {(0, C.useEffect)(() => {i && n?.();}, [i, n]);- let s = r.data ?? { status: "idle" }, c = o.error ? q(o.error) : r.isError ? r.data ? Uw : q(r.error) : "", l = o.isPending || s.status === "running", u = s.status === "failed" && !!s.retryable_asset_ids?.length, d = Jw(s), f = (e) => {+ let s = r.data ?? { status: "idle" }, c = o.error ? q(o.error) : r.isError ? r.data ? Uw : q(r.error) : "", l = o.isPending || s.status === "running", u = Jw(s), d = (e) => {l || (o.reset(), o.mutate(e));};return /* @__PURE__ */ (0, w.jsxs)("div", {@@ -29712,20 +29712,20 @@ function cT(e) {s.status === "running" ? /* @__PURE__ */ (0, w.jsx)("div", {className: "flex flex-col gap-1.5",children: s.total ? /* @__PURE__ */ (0, w.jsxs)(w.Fragment, { children: [/* @__PURE__ */ (0, w.jsx)(dh, {- label: d,+ label: u,value: s.checked || 0,max: s.total}), /* @__PURE__ */ (0, w.jsxs)("p", {className: "text-caption-1-regular text-text-secondary",children: [- d,+ u," · ",s.checked || 0," / ",s.total," 个视频"]- })] }) : /* @__PURE__ */ (0, w.jsx)(lh, { label: d })+ })] }) : /* @__PURE__ */ (0, w.jsx)(lh, { label: u })}) : null]}), /* @__PURE__ */ (0, w.jsxs)("footer", {@@ -29743,9 +29743,9 @@ function cT(e) {trailingIcon: Mf,children: "复核资料"}) : null,- u ? null : /* @__PURE__ */ (0, w.jsx)(oT, {+ /* @__PURE__ */ (0, w.jsx)(oT, {busy: l,- onRun: f+ onRun: d})]})]@@ -29754,7 +29754,7 @@ function cT(e) {problem: c,settled: i,onRetry: () => {- !s.job_id || !s.retryable_asset_ids?.length || f({+ !s.job_id || !s.retryable_asset_ids?.length || d({job_id: s.job_id,retry: s.retryable_asset_ids});