Skip to content

feat(showcase): 演示作用于选中记录的批量 action - #4201

Merged
os-zhuang merged 2 commits into
mainfrom
feat/showcase-bulk-actions
Jul 30, 2026
Merged

feat(showcase): 演示作用于选中记录的批量 action#4201
os-zhuang merged 2 commits into
mainfrom
feat/showcase-bulk-actions

Conversation

@os-zhuang

Copy link
Copy Markdown
Contributor

showcase 里一直没有 bulkActions 的例子 —— 而它恰恰是声明批量 action 的唯一方式action.bulkEnabled 在 spec 17 的 #3896 收尾里被退役(#4054),正因为从来没有消费方,它的墓碑给的处方就是这个 key。

改动

showcase_task 上加一个 bulk_actions 命名视图 —— 既有 legacy_row_actions fixture 的选择栏孪生。两个名字都是对象上已声明的 action,故意各取一种形态:

action type 走的路
showcase_mark_done script 沙箱 body 经平台 action 路由,逐条翻 done/progress
showcase_recalc_estimate api POST showcase 自己的 /api/v1/showcase/recalc,靠已声明的 recordIdParam 带上每条记录的 id

两者都不是字段 patch —— 这正是它和 project.view.tsbulkActionDefs 的分工:那边是经数据 API 批量改字段operation: 'update' + patch),这边是把选中记录逐条派发给 action runner,于是「不是字段赋值」的 action(脚本、自定义端点)也能作用于一批记录。

顺带在 UI 导览里写清这两种 bulk 词汇的分工,并点明 bulkEnabled 不是第三条路。

验证

在本 app 的真实后端 + console 里点完整流程:

  • Bulk Actions 视图出现在视图切换器,列(预计工时 / 进度 / 已完成)正常渲染。
  • 全选 10 条 → 两个按钮都带 action 自己的标签和图标。
  • Mark Done → 10 个 POST /api/v1/actions/showcase_task/showcase_mark_done,全 200;10 条记录 已完成 = ✓、进度 = 100。
  • Recalculate Estimate → 10 个 POST /api/v1/showcase/recalc,全 200(recordIdParam 确实带上了 id,没有 400);预计工时逐条重算并刷新。
  • 运行全程 0 控制台错误(页面早期引导阶段有既存噪声,与本视图无关)。

pnpm validate / pnpm typecheck / pnpm test(10 文件 60 测试)全绿。

纯示例 + 文档,不动任何运行时代码。

🤖 Generated with Claude Code

`bulkActions` — naming declared object actions so each SELECTED record is fanned
out through the action runner — had no example in the showcase. It is also the
only way to declare a bulk action: `action.bulkEnabled` was retired in spec 17
(#3896 close-out, #4054) precisely because nothing consumed it, and its
tombstone prescribes this key.

Adds a `bulk_actions` named view on showcase_task — the selection-bar twin of
the existing `legacy_row_actions` fixture — naming both an action whose work is
a sandboxed script (showcase_mark_done, via the platform action route) and one
that is a custom endpoint (showcase_recalc_estimate, whose already-declared
`recordIdParam` carries each record's id). Neither is a field patch, which is
what distinguishes this from project.view.ts's `bulkActionDefs`: those mass-EDIT
through the data API, this dispatches a real action per record.

Verified in a browser against this app: selecting all 10 tasks and running each
button issues 10 POSTs (one per record, all 200) to
/api/v1/actions/showcase_task/showcase_mark_done and /api/v1/showcase/recalc
respectively, and the records change server-side. No console errors.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Jul 30, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
objectstack Ignored Ignored Jul 30, 2026 3:17pm

Request Review

@github-actions github-actions Bot added size/s documentation Improvements or additions to documentation and removed size/s labels Jul 30, 2026
…changeset

The zh-CN bundle must carry every declared label — the i18n coverage ratchet
counts untranslated declared strings per example and refused the 456 → 457
growth. And objectstack requires a changeset per PR; an empty one is the
sanctioned declaration for a change that releases nothing (the showcase package
is private).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@os-zhuang
os-zhuang merged commit 4e9fdfa into main Jul 30, 2026
16 checks passed
@os-zhuang
os-zhuang deleted the feat/showcase-bulk-actions branch July 30, 2026 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/s tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant