Skip to content

feat(ui): qzone 调度三组件 — schedule picker / 参考图选择器 / 任务行 (PR-F3)#154

Merged
sweetcornna merged 1 commit into
mainfrom
feat/ui-qzone-scheduler-components
Jul 18, 2026
Merged

feat(ui): qzone 调度三组件 — schedule picker / 参考图选择器 / 任务行 (PR-F3)#154
sweetcornna merged 1 commit into
mainfrom
feat/ui-qzone-scheduler-components

Conversation

@sweetcornna

Copy link
Copy Markdown
Owner

概要

QZone 定时任务页重接(PR-F4)的组件地基:三个独立可测的新组件 + 17 个 vitest 用例 + en/zh-CN 文案键。本 PR 不接页面 —— scheduler/qzone/page.tsx 未改动,接线留给 PR-F4。基于已合并的 #149(cron-schedule 纯库)与 #151(scheduler API client 扩展)。

组件契约(供 PR-F4 接线)

components/scheduler/qzone-schedule-picker.tsx

QzoneSchedulePicker({ value: ScheduleState, onChange: (next: ScheduleState) => void })
  • 受控 dumb 组件,状态全在 ScheduleStatelib/cron-schedule.ts)。
  • FilterChipGroup 单选 每天/每周/高级;每天 = <Input type="time">;每周 = 时间 + 周几多选 chips(周一开头显示,值保持 0=周日..6=周六);高级 = raw cron <Input>
  • 切模式不丢 time/weekdays/raw。父层用 composeCron(value) 得 cron(null 时禁用保存)。

components/scheduler/qzone-ref-image-picker.tsx

QzoneRefImagePicker({ personaId: string, selected: string[], onChange: (labels: string[]) => void })
  • selected = 资产 label 列表(任务持久化的形态)。personaId="" 时渲染"先选人格"提示、不发请求。
  • useQuery key = ["admin", "personas", personaId, "assets"](与 persona studio 页完全一致,缓存互通);过滤 kind === "reference"
  • 上传:隐藏 file input + ImagePlus 按钮;label = slugifyAssetLabel(file.name),与现有 label 冲突自动 -2/-3 后缀;client 端 MIME/大小/label 校验;成功后 invalidate 同 key 并自动选中新 label。
  • 删除:Trash2 → 共用 ConfirmDialogdeleteAsset → invalidate。
  • job 引用已删资产 → 虚线 missing chip(可点击取消选中,不静默剪除)。
  • selected.length > 8 → 提示"模型只看前 8 张"(导出 REFS_VISIBLE_CAP = 8,对齐后端 _MAX_REFS)。

components/scheduler/qzone-job-row.tsx

QzoneJobRow({ job: SchedulerJobRow, onTrigger, onEdit, onToggleEnabled, onDelete: (name: string) => void, triggering?: boolean })
  • 渲染 <TableRow>(6 列:name / persona / cron / 状态 badge / last run(ok·error badge + 时间 + qzone 链接 + last_error)/ 动作),需置于现有表格的 <TableBody> 内。
  • 动作列 4 个 sprite 图标按钮:Play(立即跑) / Pencil(编辑) / Pause↔Play(启停) / Trash2(删除)。
  • source === "config" 行:编辑/启停/删除禁用 + title 提示(TOML 只读);立即跑始终可用;source === "runtime" 全开。
  • testid 约定:qzone-job-{trigger|edit|toggle|delete}-{name}qzone-job-row-{name}

i18n 新键(en + zh-CN 双份,LocaleBundle satisfies 强制同形)

  • schedulerQzone.schedule.*:modeDaily / modeWeekly / modeAdvanced / timeLabel / weekdaysLabel / dowMon..dowSun / rawLabel
  • schedulerQzone.refs.*:title / help / pickPersonaFirst / empty / upload / uploadOk / uploadFail / selectedCount / capHint / missing / deleteTitle / deleteBody / deleted / deleteFail
  • schedulerQzone.row.* 追加:edit / pause / resume / delete / configReadonly

验证

  • pnpm test:160 文件全过,1244 passed / 2 skipped(既有 skip)。已知 dev-mode/sidebar flake 本轮未出现。
  • pnpm typecheck:0 错误。
  • pnpm lint:新文件零告警(现存告警均在未触碰文件)。
  • 守卫测试(sprite 图标/无 lucide、无 backdrop-filter)全绿;三组件图标全部来自 @/components/icons

规格偏差说明

  • 任务行未渲染 next-fire 列:以现有 page.tsx 行渲染为准(现有行无此列);nextFireTime helper 仍在 API 层可供 PR-F4 使用。
  • 上传按钮在 personaId="" 时隐藏(避免无人格上传 404),规格未明确此分支,PR-F4 接线时表单必然先选人格。

PR-F3 of the QZone scheduler page rework. Components + tests only —
page wiring lands in PR-F4.

- qzone-schedule-picker: controlled daily/weekly/advanced trigger-time
  picker over lib/cron-schedule's ScheduleState; mode switches never
  drop time/weekdays/raw; weekday chips render Monday-first but keep
  canonical 0=Sun..6=Sat values.
- qzone-ref-image-picker: reference-asset (立绘) grid with select
  toggle, upload (slugified label + -2/-3 dedupe, client MIME/size
  gate), ConfirmDialog-gated delete, dashed "missing" chips for
  labels whose asset was deleted, and a >8 hint aligned with the
  backend _MAX_REFS. Shares the persona studio's asset queryKey for
  cache coherence.
- qzone-job-row: table row factored out of the qzone page and
  extended to the full action cluster (run now / edit / pause·resume
  / delete); config-sourced rows are read-only with a tooltip.
- en + zh-CN locale keys under schedulerQzone.{schedule,refs,row.*}.
- 17 new vitest cases; icons from the sprite barrel only.
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@github-actions github-actions Bot added codex:needs-review A Codex review is needed for the current PR head. codex:review-requested A Codex review was requested or should be running automatically. status: 🔁 re-review loop A fresh Codex review was requested after the latest change or comment. codex:reviewed Codex posted a review result or thumbs-up after the latest request. status: 👀 ready for maintainer look No automation blocker is known; a maintainer should inspect the current result. and removed codex:review-requested A Codex review was requested or should be running automatically. codex:needs-review A Codex review is needed for the current PR head. status: 🔁 re-review loop A fresh Codex review was requested after the latest change or comment. labels Jul 18, 2026
@sweetcornna
sweetcornna merged commit 3f8ca93 into main Jul 18, 2026
8 of 9 checks passed
@sweetcornna
sweetcornna deleted the feat/ui-qzone-scheduler-components branch July 18, 2026 17:52
@github-actions github-actions Bot added the status: ✅ merge-ready Evidence and review are clear; normal merge gates may proceed. label Jul 18, 2026
sweetcornna added a commit that referenced this pull request Jul 18, 2026
接入 #149/#151/#154 落地的库与组件:
- 表格行换用 <QzoneJobRow>(run/edit/pause·resume/delete),删除旧内联行
- cron 手填换成 <QzoneSchedulePicker>(composeCron/parseCron)
- 选中人格后显示 <QzoneRefImagePicker> 选参考图(image_ref_labels)
- 新增发送抖动 jitter_minutes(0–120)输入
- 选中行就地回填编辑:parseCron 回填 picker、锁定人格、Save→Update、取消编辑
- saveMutation 按 editingName 分流 patch/create;enabled 交由行内 pause/resume
- 删除走页面级 ConfirmDialog;启停按 enabled 分流 pause/resume
- 保留一键启用每日说说 + next-fire 预览
- 新增 en+zh-CN 双份文案;新增页面测试 6 例

Co-authored-by: Cornna <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

codex:reviewed Codex posted a review result or thumbs-up after the latest request. status: ✅ merge-ready Evidence and review are clear; normal merge gates may proceed. status: 👀 ready for maintainer look No automation blocker is known; a maintainer should inspect the current result.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant