Repository navigation
Commit 13d85bb
feat(studio): the list-view panel edits a chart view's dataset binding (dataset, measures, dimensions) (#28025)
<!-- claude-projects-attribution: {"github_login":"os-bill"} -->
_Requested by **Bill** · [project
thread](https://claude.ai/code/project/chan_016iMXWSZDzqWRWvWzdNo8wg?thread=cmsg_016iMXWSZDzqWRWvWzdNo8wg4i9JiKjEjwtuVzd4gKy9hB)_
## 维护者速读
- 改了什么:Studio › 界面 ›
列表视图面板,图表视图多了一个「图表数据」区块:按名称列出以本对象为基础的数据集,选定后按名称列出它的度量和维度,每次选择都自动保存到该视图的
`chart`(`dataset` / `values` / `dimensions`),图表类型也可在规范列出的五种里切换。
- 为什么改:图表视图的数据集绑定此前只能在「添加视图」对话框里设一次,建好后在 Studio 里无处可改。
- 风险与回滚:只动 Studio 面板、与「添加视图」对话框共用的一个读取 hook 和新增 i18n
键;换数据集时只保留新数据集也声明的度量/维度,度量清空则像其它必填项一样暂扣不发;整个 PR 回滚即恢复原状,无数据迁移。
- 先看:`ListViewChartSection.tsx` 的 `pickDataset` 与
`MemberList`、`ListViewTypeSection.tsx` 里 `listViewTypeHeldEdit` 新增的
chart 分支、`objectDatasets.ts`(对话框改为经它读取)。
- 两分钟验证:`pnpm --dir ui exec vitest run
packages/app-shell/src/views/studio-design/ObjectListViewInspector.chartBinding-27933.test.tsx`,预期
9 passed。
- 需要你做的:无,席位落地。
Fixes #27933
Clause-②: no
Metadata-protocol: none
## What changes
- **A "Chart data" section in the list-view panel of a chart view**
(`studio-design/ListViewChartSection.tsx`, wired in
`ObjectListViewInspector` beside the kanban card and type-settings
sections). It edits the list body's `chart` block
(`ListChartConfigSchema`):
- **Dataset**: the datasets whose base `object` is this object, by label
(`LABEL (name)`), never another object's. The draft-overlaid catalog is
read inside the Studio's draft world (`useStudioDatasetAuthoring`, as
the report and dashboard inspectors do).
- **Measures** (`values`) and **Dimensions** (`dimensions`): the bound
dataset's own members, picked by label, stored by name, each removable.
- **Chart type**: the spec's `chartType` enum, read from the spec's
JSONSchema for the block; no option beyond it.
- Every pick goes through the same `useObjectListViewDraft` buffer and
pillar autosave as every other list-view setting.
- **Switching dataset**: the measures and dimensions the new dataset
also declares are kept; the rest are dropped, since a name the dataset
does not declare binds nothing. A catalog entry that lists no member at
all (a name-only summary) keeps none.
- **No measure left**: the `values` key is removed rather than written
as `[]`. `objectHeldInput` counts only an absent or empty-string input
as unset, so `[]` would be sent and refused with a 422; an absent key is
held. `listViewTypeHeldEdit` now asks `ListViewSchema` about the `chart`
block too, naming the input by the section's own label, so "Show me"
focuses it.
- **Stale names**: a stored measure or dimension the bound dataset does
not declare is shown with a "Not in this dataset" mark and its remove
button. A stored dataset that is not one of this object's is shown in
the picker, marked.
- **Read failures**: the catalog read fails ⇒ the stored dataset,
measures and dimensions are shown as saved with the reason, and no
picker is offered; the bound dataset's member read fails ⇒ the same for
its members. The rest of the panel is unaffected.
- **No dataset on the object**: the section says so and draws no picker.
- **Shared reading** (`studio-design/objectDatasets.ts`,
`useObjectDatasetBinding` + `datasetOptionLabel`): the Create View
dialog's own filter-and-resolve code moved here unchanged and the dialog
now calls it. The dialog's pickers are single-choice rows in its generic
required-pick loop, so the pickers themselves are not shared; the
panel's measure and dimension lists are multi-valued.
- i18n: new `engine.studio.inspector.listView.chart.*` keys in the
studio en and zh packs only; no existing en string changed.
## Tests
- New `ObjectListViewInspector.chartBinding-27933.test.tsx`: the real
`useObjectListViewDraft` and panel over a real `MetadataClient` whose
transport serves the dataset catalog and judges each view PUT with the
installed spec's `view` schema.
- `CreateViewDialog.chartBinding-11576` and the other dialog suites stay
green on the shared hook.
## Acceptance notes
- **Shared, not copied — the reading only.** The Create View dialog's
filter-and-resolve code is what moved into `useObjectDatasetBinding`;
its pickers stay its own (single-choice rows of its generic
required-pick loop, where the panel's measures and dimensions are
ordered multi-valued lists). Its six suites,
`CreateViewDialog.chartBinding-11576` included, and
`ObjectView.createChartView-11576` are green on the shared hook.
- **Why `values` is removed rather than emptied.** `objectHeldInput`
treats only an absent or empty-string input as unset; `values: []` would
be judged finished-but-wrong and sent, then refused with a 422 (the
spec's `.min(1)`). Removing the key makes the pillar hold the edit with
"Measures in the view's Chart settings needs a value", and "Show me"
lands on the measure picker (its `label` names the add trigger).
- **Name-only catalog entries.** If a dataset list ever answers names
without members, switching to such a dataset keeps no measure or
dimension (nothing is known to carry over); the members then load
through `useDatasetSemantics` as before.
- **Draft world.** Inside the Interfaces pillar the section reads
`?preview=draft` (the `StudioDatasetAuthoringContext` signal the report
and dashboard inspectors use), so a dataset drafted in the package is
offered. Outside it, the published list.
- **Not changed.** No endpoint, client or reader; no chart rendering;
`chartType` offers exactly the spec enum (`bar`, `line`, `pie`, `area`,
`scatter`), labelled with the existing widget-type strings. The generic
type-settings section still excludes `chart`, and the #27895 control pin
for that is unchanged (its docblock now names the new section).
`content/docs/frontend/` is not touched, as on the two predecessor panel
PRs.
## Verification
Head `bab6d6ec`.
<details><summary>New suite: 9/9</summary>
`pnpm --dir ui exec vitest run
packages/app-shell/src/views/studio-design/ObjectListViewInspector.chartBinding-27933.test.tsx`
→ Test Files 1 passed (1), Tests 9 passed (9).
</details>
<details><summary>Neighbouring suites: 35 files, 428 tests</summary>
Under `os-verify-lock.sh` (VERDICT command-exit 0): the six
`CreateViewDialog*` suites, `ObjectView.createChartView-11576`, all
twelve `ObjectListViewInspector*` suites, the three
`StudioDesignSurface.listView*` suites,
`StudioDesignSurface.kanbanCardSelection-12725`, `datasetCreate`, every
`metadataError*` suite, i18n `studio-namespace`, `block-config-i18n` and
`product-neutral-renderer.ratchet` → Test Files 35 passed (35), Tests
428 passed (428).
</details>
<details><summary>Ablations (each restored, blob equal to HEAD, `git
diff HEAD` empty)</summary>
Through `scripts/ablation-replace.mjs`, anchor 1 → 0 on disk each time;
app-shell tests import `src`, so no dist rebuild is involved.
1. `pickDataset` keeps every stored name (the keep filter replaced by
`names`) → 2 failed / 7 passed: "another dataset keeps the shared
measure, drops what it does not declare…" and "a dataset that shares no
measure leaves none…".
2. `listViewTypeHeldEdit`'s chart arm disabled (`type === 'chart' &&
false`) → 1 failed / 8 passed: "a dataset that shares no measure leaves
none: the edit is held…".
</details>
<details><summary>Type-check and lint</summary>
- `pnpm --filter @object-ui/app-shell --filter @object-ui/i18n run
type-check` (both `tsc --noEmit` and `tsc -p tsconfig.test.json`) →
VERDICT command-exit 0.
- `eslint --no-inline-config` over the eight changed source files → 0
errors (warnings are the files' existing ones).
- `pnpm --dir ui check:new-line-citations` → 0 new citations; `pnpm
--dir ui check:i18n-drift` → 0 en values changed (16 keys added).
</details>
<details><summary>Derived gates: 34/34 exit 0</summary>
`node scripts/pm/dispatch-gates.mjs --commands --repo
objectstack-ai/objectstack` derived 34 commands on this change set
(`check-sdui-manifest` among them); every one ran and exited 0, and
`--ran` reconciles: "34 derived famil(ies) accounted for — 34 run, 0
NOT-MEASURED". Repo-wide lint, Test UI and the type-check lanes are
CI's.
</details>
---
_Generated by [Claude
Code](https://claude.ai/code/session_01Utp6CXJbywVb2s7U66hkac)_
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent fb3fe52 commit 13d85bb
10 files changed
Lines changed: 927 additions & 41 deletions
File tree
- .changeset
- ui/packages
- app-shell/src/views
- studio-design
- i18n/src/namespaces/studio
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| |||
48 | 49 | | |
49 | 50 | | |
50 | 51 | | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
| 52 | + | |
56 | 53 | | |
57 | 54 | | |
58 | 55 | | |
| |||
247 | 244 | | |
248 | 245 | | |
249 | 246 | | |
250 | | - | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | 247 | | |
259 | 248 | | |
260 | 249 | | |
| |||
325 | 314 | | |
326 | 315 | | |
327 | 316 | | |
328 | | - | |
329 | | - | |
330 | | - | |
331 | | - | |
332 | | - | |
333 | 317 | | |
334 | 318 | | |
335 | 319 | | |
| |||
546 | 530 | | |
547 | 531 | | |
548 | 532 | | |
549 | | - | |
550 | | - | |
551 | | - | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
552 | 537 | | |
553 | | - | |
554 | | - | |
555 | | - | |
556 | | - | |
557 | | - | |
558 | 538 | | |
559 | | - | |
560 | | - | |
561 | | - | |
562 | | - | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
563 | 545 | | |
564 | 546 | | |
565 | 547 | | |
| |||
0 commit comments