Peach: Local-first video metadata scraper and media manager.
feat(ui): 任务中心的链接放左、动作放右
longmeidaob8b61a1838c8
diff --git a/frontend/src/react/activity/background-issues.tsx b/frontend/src/react/activity/background-issues.tsxindex d8cd65a24..2dd236182 100644--- a/frontend/src/react/activity/background-issues.tsx+++ b/frontend/src/react/activity/background-issues.tsx@@ -4,7 +4,8 @@* 数据来自 `/api/background-issues`,服务端每次现读各服务的快照,问题消失这一行就不在了。* 一行只写是什么、从什么时候开始,加一个写明去处的链接(文案由服务端给);原因只在链接* 指向的那个设置位置讲,这里不复述。原地重跑就可能修好的(网络、调度、amane 桥)多给一个- * 「立即重试」,排在链接左边;要改设置、填凭据的只有链接。+ * 「立即重试」;要改设置、填凭据的只有链接。链接在左、重试在右:原地修好的那个动作是这一行+ * 的主动作,和分区底部操作条一样排在最右;没有重试的行,链接也落在同一个位置。** 时间分两种:服务自己记下的起点写「自 … 起」;服务不记失败时刻的,写这一次运行里第一次* 读到它的时刻「发现于 …」,两者不混用。没有问题时整段不画,取数失败也不画:服务连不上时@@ -67,11 +68,11 @@ function IssueRow({ issue }: { issue: BackgroundIssue }) {return (<Note tone="error" title={issue.title} action={<div className="flex flex-wrap items-center gap-2">+ <LinkButton href={issue.href} size="small" trailingIcon={RiArrowRightLine}>{issue.link_label}</LinkButton>{issue.retry? <Button variant="secondary" size="small" disabled={!issue.retry_available}{...busyProps(retry.isPending)} onClick={() => retry.mutate()}>立即重试</Button>: null}- <LinkButton href={issue.href} size="small" trailingIcon={RiArrowRightLine}>{issue.link_label}</LinkButton></div>}>{retry.error ? `${moment}\n没有重试:${errorMessage(retry.error)}` : moment}diff --git a/frontend/src/react/activity/downloads-panel.tsx b/frontend/src/react/activity/downloads-panel.tsxindex 55db268eb..d3ff8bd88 100644--- a/frontend/src/react/activity/downloads-panel.tsx+++ b/frontend/src/react/activity/downloads-panel.tsx@@ -167,20 +167,25 @@ function TaskCard({ task, writable }: { task: DownloadTask; writable: boolean })? <p className="min-w-0 truncate text-caption-1-regular text-text-secondary" title={task.ledger_path}>{task.ledger_path}</p>: null}{action.error ? <ErrorText>{action.error}</ErrorText> : null}- <div className="flex flex-wrap items-center gap-2 pt-1 sm:mt-auto">+ {/* 辅助的(看标题、抄磁力)靠左,改动这条任务的靠右,最右是这张卡此刻的主动作。 */}+ <div data-download-actions="" className="flex flex-wrap items-center gap-2 pt-1 sm:mt-auto"><Button variant="ghost" size="small" aria-expanded={fullTitle} aria-controls={fullTitle ? titleId : undefined}onClick={() => setFullTitle(!fullTitle)}>{fullTitle ? '收起标题' : '展开标题'}</Button>- {writable && task.cancellable- ? <Button variant="secondary" size="small" {...busyProps(action.busy === 'cancel')} onClick={cancel}>取消</Button>- : null}- {writable && task.resubmittable- ? <Button variant="secondary" size="small" {...busyProps(action.busy === 'resubmit')} onClick={resubmit}>重新提交</Button>- : null}- {writable && task.postprocess_retryable- ? <Button variant="secondary" size="small" {...busyProps(action.busy === 'postprocess')}- onClick={retryPostprocess}>重试入库后整理</Button>- : null}<Button variant="ghost" size="small" onClick={copy}>{copied ? '已复制磁力' : '复制磁力'}</Button>+ {writable && (task.cancellable || task.resubmittable || task.postprocess_retryable)+ ? <div className="ml-auto flex flex-wrap items-center gap-2">+ {task.cancellable+ ? <Button variant="secondary" size="small" {...busyProps(action.busy === 'cancel')} onClick={cancel}>取消</Button>+ : null}+ {task.resubmittable+ ? <Button variant="secondary" size="small" {...busyProps(action.busy === 'resubmit')} onClick={resubmit}>重新提交</Button>+ : null}+ {task.postprocess_retryable+ ? <Button variant="secondary" size="small" {...busyProps(action.busy === 'postprocess')}+ onClick={retryPostprocess}>重试入库后整理</Button>+ : null}+ </div>+ : null}</div></div></div>diff --git a/frontend/test/react/activity.test.tsx b/frontend/test/react/activity.test.tsxindex 0a1992a6c..176a5b1a9 100644--- a/frontend/test/react/activity.test.tsx+++ b/frontend/test/react/activity.test.tsx@@ -170,9 +170,9 @@ it('后台问题排在最前,每项只写是什么、从什么时候起和写expect(buttonNamed('立即重试', tunnel!)).toBeNull();expect(follow?.textContent).toContain('自 ');expect(follow?.textContent).toContain(' 起');- // 按钮在左、链接在右。+ // 链接在左、重试在右。const [first, second] = [...follow!.querySelectorAll('[data-note-action] a, [data-note-action] button')];- expect([first?.textContent, second?.textContent]).toEqual(['立即重试', expect.stringContaining('打开关注调度')]);+ expect([first?.textContent, second?.textContent]).toEqual([expect.stringContaining('打开关注调度'), '立即重试']);await click(buttonNamed('立即重试', follow!));await vi.waitFor(() => { if (host.querySelectorAll('[role="alert"]').length !== 1) throw new Error('重试后那一项还在') });diff --git a/frontend/test/react/downloads-panel.test.tsx b/frontend/test/react/downloads-panel.test.tsxindex 569b5ba3f..ff8828ff7 100644--- a/frontend/test/react/downloads-panel.test.tsx+++ b/frontend/test/react/downloads-panel.test.tsx@@ -110,6 +110,9 @@ it('远端在跑的任务给进度与取消键,取消发到取消接口', asynexpect(card.querySelector('[role=progressbar]')?.getAttribute('aria-valuenow')).toBe('42');expect(card.textContent).toContain('远端下载中');expect(buttonNamed('重新提交', card)).toBeNull();+ // 辅助的两个在前,改动任务的取消排在最后。+ expect([...card.querySelectorAll('[data-download-actions] button')].map((node) => node.textContent))+ .toEqual(['展开标题', '复制磁力', '取消']);await click(buttonNamed('取消', card));await settle();expect(posts()).toEqual([['/api/downloads/cancel', { id: 1 }]]);diff --git a/web/dist/peach-app.js b/web/dist/peach-app.jsindex fea13e045..7d6ef3b02 100644--- a/web/dist/peach-app.js+++ b/web/dist/peach-app.js@@ -2,7 +2,7 @@(function() {try {var e = typeof window < "u" ? window : typeof global < "u" ? global : typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : {}, t = new e.Error().stack;- t && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[t] = "78ba88d3-4026-4c43-92f5-21c0e99edd13", e._sentryDebugIdIdentifier = "sentry-dbid-78ba88d3-4026-4c43-92f5-21c0e99edd13");+ t && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[t] = "846ceca9-5b00-4c94-a82e-dce20d3a86ab", e._sentryDebugIdIdentifier = "sentry-dbid-846ceca9-5b00-4c94-a82e-dce20d3a86ab");} catch {}})();var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescriptor, r = Object.getOwnPropertyNames, i = Object.getPrototypeOf, a = Object.prototype.hasOwnProperty, o = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), s = (e, n) => {@@ -38458,19 +38458,19 @@ function Jve({ issue: e }) {title: e.title,action: /* @__PURE__ */ (0, D.jsxs)("div", {className: "flex flex-wrap items-center gap-2",- children: [e.retry ? /* @__PURE__ */ (0, D.jsx)(q, {+ children: [/* @__PURE__ */ (0, D.jsx)(IA, {+ href: e.href,+ size: "small",+ trailingIcon: aA,+ children: e.link_label+ }), e.retry ? /* @__PURE__ */ (0, D.jsx)(q, {variant: "secondary",size: "small",disabled: !e.retry_available,...Y(n.isPending),onClick: () => n.mutate(),children: "立即重试"- }) : null, /* @__PURE__ */ (0, D.jsx)(IA, {- href: e.href,- size: "small",- trailingIcon: aA,- children: e.link_label- })]+ }) : null]}),children: n.error ? `${r}\n没有重试:${V(n.error)}` : r});@@ -38722,6 +38722,7 @@ function nye({ task: e, writable: t }) {}) : null,r.error ? /* @__PURE__ */ (0, D.jsx)(tj, { children: r.error }) : null,/* @__PURE__ */ (0, D.jsxs)("div", {+ "data-download-actions": "",className: "flex flex-wrap items-center gap-2 pt-1 sm:mt-auto",children: [/* @__PURE__ */ (0, D.jsx)(q, {@@ -38732,33 +38733,38 @@ function nye({ task: e, writable: t }) {onClick: () => s(!o),children: o ? "收起标题" : "展开标题"}),- t && e.cancellable ? /* @__PURE__ */ (0, D.jsx)(q, {- variant: "secondary",- size: "small",- ...Y(r.busy === "cancel"),- onClick: g,- children: "取消"- }) : null,- t && e.resubmittable ? /* @__PURE__ */ (0, D.jsx)(q, {- variant: "secondary",- size: "small",- ...Y(r.busy === "resubmit"),- onClick: _,- children: "重新提交"- }) : null,- t && e.postprocess_retryable ? /* @__PURE__ */ (0, D.jsx)(q, {- variant: "secondary",- size: "small",- ...Y(r.busy === "postprocess"),- onClick: y,- children: "重试入库后整理"- }) : null,/* @__PURE__ */ (0, D.jsx)(q, {variant: "ghost",size: "small",onClick: v,children: i ? "已复制磁力" : "复制磁力"- })+ }),+ t && (e.cancellable || e.resubmittable || e.postprocess_retryable) ? /* @__PURE__ */ (0, D.jsxs)("div", {+ className: "ml-auto flex flex-wrap items-center gap-2",+ children: [+ e.cancellable ? /* @__PURE__ */ (0, D.jsx)(q, {+ variant: "secondary",+ size: "small",+ ...Y(r.busy === "cancel"),+ onClick: g,+ children: "取消"+ }) : null,+ e.resubmittable ? /* @__PURE__ */ (0, D.jsx)(q, {+ variant: "secondary",+ size: "small",+ ...Y(r.busy === "resubmit"),+ onClick: _,+ children: "重新提交"+ }) : null,+ e.postprocess_retryable ? /* @__PURE__ */ (0, D.jsx)(q, {+ variant: "secondary",+ size: "small",+ ...Y(r.busy === "postprocess"),+ onClick: y,+ children: "重试入库后整理"+ }) : null+ ]+ }) : null]})]@@ -115761,4 +115767,4 @@ pxt(mxt);//#endregionexport { $w as applyTheme, Zk as peachHistory, Jo as popCount, Vgt as showToast };-//# debugId=78ba88d3-4026-4c43-92f5-21c0e99edd13\ No newline at end of file+//# debugId=846ceca9-5b00-4c94-a82e-dce20d3a86ab\ No newline at end of file