Skip to content

fix(app-shell): allowed-visualization chips read the view-type select's words in zh-CN - #30433

Merged
objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/project-thread-tsiu11
Nov 5, 2026
Merged

objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/project-thread-tsiu11

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Bill · project thread
domain:ui#2 · os-bill · session_01Utp6Cb5R6JDdfyvtj3dPR2

Fixes #30358

Clause-②: no
Metadata-protocol: none

维护者速读

  • 改了什么:中文界面下,视图设置「外观」里的「允许的可视化」选项(chip)改读视图类型下拉框的同一套中文词:表格 / 列表、看板、画廊、日历、时间线、甘特图、地图、图表、树形。两处共用一个取词函数,不会再说两套话。
  • 为什么改:中文管理员在 Studio 编辑列表视图时,同一面板上的视图类型下拉已是中文,这排要他勾选的选项却是 Grid、Kanban、Gallery 等英文。
  • 风险与回滚:只动 ui 的 metadata-admin 三个文件,不动 spec、服务端、元数据、i18n 词条。英文界面的 9 个 chip 词保持原样(仍是 Grid,不跟下拉的 Table / List),其它非视图类型的多选不变。回滚即 revert 本 PR。
  • 先看:ui/packages/app-shell/src/views/metadata-admin/widgets.tsx 的 enumOptionLabel → viewTypeLabels.ts(从 ViewVariantInspector.tsx 挪出的取词函数)→ 新测试 MultiSelectWidget.viewTypeLabels-30358.test.tsx。
  • 两分钟验证:pnpm --dir ui exec vitest run packages/app-shell/src/views/metadata-admin/MultiSelectWidget.viewTypeLabels-30358.test.tsx,预期 3/3 通过(main 源码上 zh-CN 一条失败,读到 Grid…Tree)。
  • 需要你做的:无,席位落地。

What changes

The 允许的可视化 chips (appearance.allowedVisualizations) are the multiselect widget in widgets.tsx. With no fieldSpec.options, it named each enum value with humanizeOption(v) (grid → Grid) in every locale. The view-type select a few rows up names the same values through typeLabel in ViewVariantInspector.tsx (the engine.inspector.view.type.* keys, then an English fallback map).

  • typeLabel and its fallback map move to a shared module, metadata-admin/viewTypeLabels.ts (viewTypeLabel, isKnownViewType). ViewVariantInspector imports it, so the select is unchanged. The fallback map gains tree, the one view type it lacked (the catalog already has engine.inspector.view.type.tree in en and zh).
  • The widget names a bare enum's values through enumOptionLabel: when every value is a view type and the console is not en-US, a chip reads viewTypeLabel(v, locale), the select's own word. Otherwise it keeps humanizeOption.
  • en-US keeps its chip names (the seat's ruling on the card's "en unchanged"). I kept humanizeOption for en-US rather than routing en through the shared helper with a grid override: the en catalog word for grid is "Table / List", so routing en through the helper would need a per-value exception to keep "Grid". Keeping en on its existing path is the smaller change and leaves all nine en names byte-identical by construction. The console's locale is zh-CN or en-US (useMetadataLocale), so "not en-US" is zh-CN today.
  • The widget is told nothing about which field it draws (no field path in WidgetProps), so it recognises the view-type enum by its values, not by the field's name. A mixed enum (['grid', 'start_date']) keeps the humanised names in zh-CN too, so a list is never half translated.
  • No i18n key is added. fieldSpec.options labels still win when a form supplies them.

Tests

  • New MultiSelectWidget.viewTypeLabels-30358.test.tsx, over the spec's real appearance.allowedVisualizations JSONSchema (from getListVariantSchema(), not a copied enum) and the shipped studio catalogue:
    • zh-CN: the chips equal t('engine.inspector.view.type.' + v, 'zh-CN') for every enum value, in enum order, and none of them is Latin text.
    • en-US: the nine chips read Grid, Kanban, Gallery, Calendar, Timeline, Gantt, Map, Chart, Tree.
    • zh-CN, mixed enum: ['Grid', 'Start Date'].
  • Red first on main's source (test file only): Tests 1 failed | 2 passed (3). The zh-CN case failed with expected [ 'Grid', 'Kanban', 'Gallery', …(6) ] to deeply equal [ '表格 / 列表', '看板', '画廊', '日历', …(5) ]. Both en and mixed passed on main, which pins that they are unchanged. Green after the fix: Tests 3 passed (3). The red run on main's source is the ablation leg; the fix is the only source change and the tests import src.
  • The changed test plus the files that render the touched code, on the merged head 6daec651: the existing MultiSelectWidget.test.tsx, four ViewVariantInspector.*.test.tsx, unknownValueFlag.i18n-9652.test.tsx (the select's unknown-type label), and four SchemaForm/ResourceEditPage suites that render the multiselect. Test Files 11 passed (11), Tests 170 passed (170).
  • pnpm exec turbo run type-check --filter=@object-ui/app-shell --concurrency=2: Tasks: 68 successful, 68 total.
  • eslint on the four changed ui files: 0 errors (42 warnings, all on lines this PR does not touch in widgets.tsx).

Live probe

Example CRM (examples/app-crm, objectstack dev --seed-admin --fresh) with the branch's console (vite dev). Studio → crm_activity.all → 终端用户控制 → 外观 → 允许的可视化, read from the DOM ([role=group] [role=checkbox]):

  • zh-CN, main's widget source: Grid, Kanban, Gallery, Calendar, Timeline, Gantt, Map, Chart, Tree.
  • zh-CN, this branch: 表格 / 列表, 看板, 画廊, 日历, 时间线, 甘特图, 地图, 图表, 树形. The view-type select on the same page reads 表格 / 列表.
  • en-US, this branch: Grid, Kanban, Gallery, Calendar, Timeline, Gantt, Map, Chart, Tree.

The card's before-shot path is not in this project's folder, so the before leg was taken here, on main's widget source.

Acceptance notes

Verification

Derived gates (dispatch-gates --commands, final tree `6daec651`)
  • node scripts/check-adr-0087-registration.mjs --base origin/main :: exit 0
  • node scripts/check-adr-0087-registration.mjs --self-test :: exit 0
  • node scripts/check-changeset-no-major.mjs --base origin/main :: exit 0
  • node scripts/check-closing-keyword-parity.mjs :: exit 0
  • node scripts/check-closing-keyword-parity.mjs --self-test :: exit 0
  • node scripts/check-comment-mask-corpus.mjs :: exit 0
  • node scripts/check-empty-changeset.mjs --base origin/main :: exit 0
  • node scripts/check-empty-changeset.mjs --self-test :: exit 0
  • node scripts/check-sdui-manifest.mjs :: exit 0
  • node scripts/check-sdui-manifest.mjs --self-test :: exit 0
  • node scripts/pm/release-rehearsal-clone.mjs --self-test :: exit 0
  • node scripts/release-pending-publish.mjs --self-test :: exit 0
  • pnpm --dir ui exec vitest run scripts/ :: exit 0
  • pnpm --filter @objectstack/spec run check:duration-unit-keys :: exit 0
  • pnpm check:changeset-gate-self-tests :: exit 0
  • pnpm check:closed-ceremony-text :: exit 0
  • pnpm check:cross-package-test-inputs :: exit 0
  • pnpm check:dispatcher-error-vocabulary :: exit 0
  • pnpm check:driver-memory-census :: exit 0
  • pnpm check:engine-double-contract :: exit 0
  • pnpm check:gitlink-declared :: exit 0
  • pnpm check:nul-bytes :: exit 0
  • pnpm check:published-files :: exit 0
  • pnpm check:query-options-erasure :: exit 0
  • pnpm check:refd-timer-probe :: exit 0
  • pnpm check:registry-log-declared :: exit 0
  • pnpm check:rest-log-spy-declared :: exit 0
  • pnpm check:skill-identifier-liveness :: exit 0
  • pnpm check:test-source-alias :: exit 0
  • pnpm check:tier-file-adoption :: exit 0
  • pnpm check:type-check-coverage :: exit 0
  • pnpm check:type-check-debt :: exit 0
  • pnpm check:undeclared-dep-imports :: exit 0
  • pnpm check:watch-hint-literal :: exit 0
  • pnpm check:where-matcher :: exit 0

node scripts/pm/dispatch-gates.mjs --ran: 35 derived, 35 run, 0 NOT-MEASURED, 0 UNRUN. check:type-check-debt ran under the verify lock (VERDICT command-exit 0). check:sdui-manifest (standing ui gate) is in the list.


Generated by Claude Code

@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 5, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:ui#2 · os-bill · session_01Utp6Cb5R6JDdfyvtj3dPR2

维护者速读

  • 改了什么: 中文控制台里,视图设置的「允许的可视化」选项改为显示中文,用词和上方的视图类型选择器一致:表格 / 列表、看板、画廊、日历、时间线、甘特图、地图、图表、树形。英文界面不变。
  • 为什么改: 这一组选项是列表视图「终端用户控制」分节里唯一还显示英文的地方(On a zh-CN console the view panel's 允许的可视化 chips still read Grid / Kanban / Gallery …: metadata-forms catalogs carry no option labels #30358)。
  • 风险与回滚: 只改了 metadata-admin 的多选控件,另外把视图类型的标签函数抽到 viewTypeLabels.ts,选择器和多选控件共用。没有新增 i18n 键,不涉及 spec 和服务端。回滚即撤销本 PR。
  • 先看: widgets.tsx 里的 enumOptionLabel → viewTypeLabels.ts。
  • 两分钟验证: pnpm --dir ui exec vitest run packages/app-shell/src/views/metadata-admin/MultiSelectWidget.viewTypeLabels-30358.test.tsx,预期全部通过。
  • 需要您做的: 无。本 PR 不在受管面,共 188 行,由席位经合并队列落地。
  • 席位意见: ACCEPT。

席位核对 — ACCEPT · domain:ui#2 · head 6daec6519f703881138e51e58bb6b7413cc4b6da

  • 形态:
    • draft PR,作者 objectstack-fleet[bot](经中继 pr_create),无 assignee,无 review request。
    • 改动 5 个文件,+162 −26。
    • check-governed-merges --pr 30433 结果:NOT governed,188 行,未超过 3000。
  • 前提实测:
    • 多选 chip 原来对裸枚举直接用 humanizeOption,没有翻译通道。
    • 修复只在「枚举值全是视图类型」时,才改用选择器的同一个 viewTypeLabel。
    • useMetadataLocale 只会返回 en-US 或 zh-CN,所以 locale !== 'en-US' 的判断等同于只命中 zh。en 的 chip 逐字不变,这是席位裁定的:卡上写了「en unchanged」,grid 仍显示 Grid。
    • 兜底表补上了 tree。
    • 在 main 上 zh 用例收到的是 Grid…Tree;修复后测试 3/3 通过,最终树上 11 个文件共 170 例全绿。
    • 实机 zh-CN 截图在 ui-seat2/30358-shots/。
  • 门禁 check-runs: 6daec651 上共 55 个 run:44 success,11 skipped,0 失败。
  • 申报: Clause-②: no,Metadata-protocol: none;changeset 为 @object-ui/app-shell patch。没有新键,也没有触及任何契约面。
  • 接受的偏差: 无。
  • 范围外去向: 同一面板里 appearance / userActions 嵌套键的标签仍是英文,归 zh-CN metadata forms served by the platform still say 仪表板 where the Console now says 仪表盘 #30164 的目录通道处理,不另立卡。
  • 落地条款: Fixes On a zh-CN console the view panel's 允许的可视化 chips still read Grid / Kanban / Gallery …: metadata-forms catalogs carry no option labels #30358。由本席位按普通队列落地:在这个 head 上执行 pr_ready + automerge_enable,但要先等维护者在席位线程里同意。

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/m tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

On a zh-CN console the view panel's 允许的可视化 chips still read Grid / Kanban / Gallery …: metadata-forms catalogs carry no option labels

1 participant