Repository navigation
Commit c48f06c
feat(app-shell): every metadata list on ObjectGrid; 新建 on a read-only base lands in its .custom pair (#36978)
<!-- claude-projects-attribution: {"github_login":"os-support-ai"} -->
_Requested by **Yibo Wang** · [project
thread](https://claude.ai/code/project/chan_01BVUyyPie8gHwoPM18iABwB?thread=cmsg_01BVUyyPie8gHwoPM18iABwB2BRcLs2zJH6mZWG94VVuew)_
Fixes #36897
Part of #36890
Clause-②: yes (widening)
Metadata-protocol: none
The widening: `ObjectGridComponentProps`, exported from
`@object-ui/plugin-grid`'s entry, gains two optional members,
`hostCells` and `rowTint`. Nothing existing is narrowed, and no metadata
an author writes changes.
## 维护者速读
-
用户能看到什么变化:设置和工作室「全部元数据」里每种元数据的列表都换成同一张表格(排序、分页跟着地址走,「修改时间」列也在其中);在只读的安装应用(如
HotCRM)上点「新建」,对象和流程会建到它配套的定制包里。
- 为什么做:这是「工作室统一列表」专题的列表一侧,让所有类型的列表长一个样,并让只读应用也能直接新建定制内容。
- 出错会怎样:管理员可能看到列表排序或分页不对、或在只读应用上新建失败并看到原因;改动只在界面层,撤回本次合并即可恢复原表格。
- 要你做什么:无。
## What changes
- **`@object-ui/plugin-grid`** — two generic host props on
`ObjectGrid`'s table view: `hostCells` (a host draws a column's cells,
keyed by the column's field) and `rowTint` (a palette name per row; it
wins over `rowColor`, and only palette names tint — `rowTintClass` in
`useRowColor.ts`). No product-named component.
- **The metadata list is an `ObjectGrid`** (`ResourceListPage.tsx`,
adapter `metadataListGrid.ts`):
- the grid gets a schema DECLARED from the list's columns
(`MetadataListSource` answers it; nothing is guessed from the first
row), and each row is only its key plus its column values — the item,
its package, lock and diagnostics are looked up by that key, never
selected through the grid;
- rows reach the grid already filtered and sorted by `applyListState`
(the one implementation `orderedListNames` reads), in host mode (`data`
+ `manualPagination` + `rowCount` + `onPageChange`), so the grid never
re-sorts and its visible order IS the detail's ‹ › order (pinned);
- header sort → the list's `sort` param (only the API-name/label column
sorts; a label-first identity column sorts by label), page → a `page`
param, cleared on every list-state write;
- diagnostics tint (`rowTint` red/amber), the lock, identity cell,
served/console-rendered columns, the Active switch (with its holder
confirmation, `CatalogActiveCell` unchanged) and sharing-rule Clone are
the page's host cells. Active and Clone share ONE right-pinned controls
column, because the grid gives every right-pinned column `sticky
right-0`;
- the grid's search box, selection, inline edit, column resize/reorder
(so no personal column layout) and export are off for this list.
- **List 「新建」 on a read-only base lands in the paired `.custom`
package** (ADR-0146 D3):
- new module `MetadataListCreateDialog.tsx`: object (with the
organization-wide sharing default; joins its package's app menu only
when NOT in a pair, as the Data pillar does) and flow (starting-point
presets, Advanced trigger list, born off). On a read-only base both ask
`ensureCustomizationPackage` and write to the answered
package/namespace; a quick submit reads the namespace first instead of
writing unprefixed;
- `StudioMetadataArea`: `AreaCreate` on a read-only base with a
customization opens the pair's create (ensure once, then
`/studio/PAIR/metadata/TYPE/new`; a refusal is shown in place); the area
tells the list `host.pairCreate` exactly where it does that, so the list
never offers a dead 「新建」. A walled door offers none, as today;
- `StudioDesignSurface.tsx` and the pillar files split out of it are
untouched (helpers imported from standalone studio-design modules only).
Dashboard/report 「新建」 is not here.
- `builtinComponents.tsx`, `anchors.ts`, `servedListColumns.tsx` are
read only.
### Since the first version of this body (head `1137895` → `f1f10706`)
- **Kernel packages get no list create.** A kernel package (manifest
scope `system` or `cloud`) has no pair: the ensure door refuses it (409,
ADR-0146 D3). The area now reads that scope from the listed manifests.
It sets `host.pairCreate` only for a read-only, non-kernel base whose
door is not walled. `AreaCreate` opens the pair's create only under that
same flag, so a kernel package's `/new` lands on the list. Pinned in
`StudioMetadataArea.routes-28561.test.tsx`; it was CI's red on `Test UI
(7/16)`, `StudioDesignSurface.metadataArea-28561`.
- **The create-dialog enumeration test.**
`CreateItemDialog.oneLabel-11787.test.ts` enumerates every
`CreateItemDialog` site from source. An object and a flow are now
created from their pillar AND from the list, so its CONTROL now asks
that each live title is reached by one site or more, instead of exactly
once. This was CI's red on `Test UI (2/16)`.
- **Merge of #36977** (one detail header and tool tabs). It conflicted
in `StudioMetadataArea.tsx`; the resolution keeps its
`AreaHistoryRedirect` and this PR's `AreaCreate` side by side.
- **#36898 re-hosted on the grid table.** After #36983 merged, its
「修改时间」 cell (`ListChangedCell`, `listChangedAt`, `listDraftMarks`) is a
page column (`__changed`) drawn by a host cell. It sits before Source,
keeps the item's change time and its 「有未发布的改动」 mark (person vs AI), and
looks up the bundle member by row key.
- The page's own columns are now drawn under their place in the column
list, not by index arithmetic.
- The Modified header sorts by the list's `changed` key. A new pin in
`ResourceListPage.changedColumn-36898.test.tsx` checks that a header
click orders oldest first with the code-shipped item last. Its existing
cases read the grid's DOM, reaching the row by `closest('tr')`.
- The ‹ › order pin is unchanged: the rows still come from
`applyListState`, which now also sorts by `changed`.
- **`metadataAreaHost.customizations-28568`** waited for the "only
customizations" filter and then read rows synchronously. The grid draws
its rows once its table is ready ("Loading grid…" first), so the test
now awaits the row before reading its marks (3 cases).
## Tests
Final local run at `00e524f13`. `f1f10706` after it changes only the
changeset's `Clause-②` line.
<details><summary>Every suite naming ResourceListPage + the #36898
helpers + adapter + create + area + grid + the enumeration test — 43
files / 508 tests pass; type-check green</summary>
```
pnpm --dir ui exec vitest run --maxWorkers=2 FILES (the 36 test files `git grep -l ResourceListPage` names, plus listChangedAt-36898, listDraftMarks-36898, metadataListGrid, MetadataListCreateDialog.pairCreate-36897, rowAdornment-13330, CreateItemDialog.oneLabel-11787)
Test Files 43 passed (43)
Tests 508 passed (508)
pnpm --filter @object-ui/app-shell --filter @object-ui/plugin-grid type-check
ui/packages/plugin-grid type-check: Done
ui/packages/app-shell type-check: Done
os-verify-lock: VERDICT command-exit 0
```
</details>
The earlier runs on this branch, kept for the record. Run at
`490aad241`:
<details><summary>ResourceListPage family + adapter + create + area +
grid — 72 files / 544 tests pass</summary>
```
pnpm --dir ui exec vitest run --maxWorkers=2 packages/app-shell/src/views/metadata-admin/ResourceListPage packages/app-shell/src/views/metadata-admin/metadataListGrid packages/app-shell/src/views/metadata-admin/MetadataListCreateDialog packages/app-shell/src/views/metadata-admin/metadataAreaHost packages/app-shell/src/views/studio-design/StudioMetadataArea packages/plugin-grid/src/__tests__/rowAdornment packages/plugin-grid/src/__tests__/ObjectGrid
Test Files 72 passed (72)
Tests 544 passed (544)
os-verify-lock: VERDICT command-exit 0
```
Earlier on this branch the whole `plugin-grid/src` tree ran green with
the metadata-admin suites (329 files).
</details>
<details><summary>type-check — app-shell + plugin-grid green</summary>
```
pnpm --filter @object-ui/app-shell --filter @object-ui/plugin-grid type-check
ui/packages/plugin-grid type-check: Done
ui/packages/app-shell type-check: Done
os-verify-lock: VERDICT command-exit 0
```
</details>
New pins:
- `metadataListGrid.test.ts` — the declared schema (a stray first-row
key is not a field), the grid flags off, sortable only where the list
sorts, sort round-trip, page clamp.
- `ResourceListPage.listStateInUrl-36896.test.tsx` (new describe) — the
rows the table draws, in order, equal the detail's ‹ › names; a Label
header click writes `sort=label` and the detail follows; `page=2` of 53
rows shows the last 3, a new search returns to page 1.
- `MetadataListCreateDialog.pairCreate-36897.test.tsx` — read-only base:
ensure asked, pair package + pair namespace written, OWD carried, no
menu join; CONTROL writable package: no ensure, menu join; flow preset
into the pair, born off; a preset needing an object writes nothing.
- `ResourceListPage.pairCreate-36897.test.tsx` — 新建 offered on a
read-only base (object/flow dialog, other type → area create), none
without `pairCreate`; CONTROL Setup unchanged.
- `StudioMetadataArea.routes-28561.test.tsx` (new describe) — the pair's
create opens from the ensure answer, a refusal shows in place, a walled
door never asks, `pairCreate` set exactly then.
- `rowAdornment-13330.test.tsx` (new describe) — a host cell replaces
its column only; `rowTint` tints palette names only; CONTROL without
either prop.
- Changed only where a test pinned the old table's DOM: the row test id
now sits on the identity cell (`closest('tr')` reaches the row) in 5
suites; the declared-sharing-rules pins read the one shared controls
cell; the nightly live spec `declared-sharing-rules-reach-13091` reads
the grid's `data-table-scroll-box` and its seam shadow (measured on the
booted app below: Clone and Active inside the 1440 px viewport and box,
overflow 1588/1390, shadow drawn).
## Acceptance notes
- **Size** (against `origin/main`, at `00e524f13`): 2195 changed lines
(1771+, 424-):
- src 1509, tests 673, changeset 13, generated 0;
- merging #36898 and re-hosting it on the grid added 68 of them (2127
before);
- this is the card's only PR, under the 2500 stop line.
- **Largest type under `~all`** (HotCRM booted, `GET /api/v1/meta/TYPE`
for all 34 types): `object` **136** rows (then `email_template` 128,
`view` 125, `hook` 88, `flow` 54). The grid holds them in memory and
pages 50 at a time — `/studio/~all/metadata/object?page=3` shows 36
rows, "Page 3 of 3".
- On the booted HotCRM the list showed "Couldn't read customizations: …
answered a body its declaration refuses" — the server is the published
`@objectstack/cli` 18.6.0 HotCRM pins, the console is this tree's `ui/`
(version skew between a released server and `main`'s reader); the create
path itself does not read it.
- `ObjectGrid` gives every `pinned: 'right'` column `sticky right-0`, so
two right-pinned columns overlap; this list pins one. Noted, not filed
(no second producer measured).
- The live HotCRM run made no approvals/lock API calls (network log of
both creates: ensure → PUT draft → POST publish → user-preference PATCH
only).
**Declared deviations.**
- The screenshots live on a no-PR, images-only branch,
`claude/issue-36897-list-objectgrid-shots` (`3c488ba2`), and are
embedded below by raw URL. The relay has no attachment upload.
- HotCRM was verified with its pinned published server
(`@objectstack/cli` 18.6.0) and this tree's console on Vite, the dogfood
skill's authoritative-console route. The screenshots predate the #36898
re-host, so they show no 「修改时间」 column.
- Most of the 39 locally derived gate families ran at `2c60bdf3a`. The
ratchet subset re-ran later (`test-source-alias`, `type-check-debt`,
`type-check-coverage`, `undeclared-dep-imports`,
`cross-package-test-inputs`, `published-files`, `nul-bytes`), and CI
runs the farm on the head.
- One push went out while `overlap-check` reported conflicts with the
then-open PRs #36983 and #36977, not with main. Both have since merged
into this branch.
## Verification
Booted HotCRM (`objectstack dev --seed-admin -p 4517`, its own DB) with
this tree's console on Vite (`VITE_SERVER_URL`), Chromium at
deviceScaleFactor 2:
| | |
|---|---|
| Object list on HotCRM (read-only base) — grid, 新建 offered | 
|
| New object on HotCRM — saved as `crm_custom_site_visit`, OWD picker |

|
| Landed: "In app.objectstack.hotcrm.custom" (`POST
…/hotcrm/ensure-customization 201`, `PUT
/meta/object/crm_custom_site_visit?package=app.objectstack.hotcrm.custom`)
| 
|
| New flow on HotCRM — presets | 
|
| Landed: flow in `app.objectstack.hotcrm.custom`, switched off, Start =
manual | 
|
| Sharing rules under `~all`: Active switch + Clone in the pinned
controls column | 
|
| `~all` objects, page 3 of 3 (136 rows) | 
|
| Self-built package `com.acme.fieldops`: object `fops_work_order` and
flow `dispatch_tech` written to it (no ensure call) | 

|
Read first (by risk): `ResourceListPage.tsx` (the host cells +
`cellDrawsRef` — the table keeps columns as state, so cells must be
stable and read the latest draw through a ref), `ObjectGrid.tsx`
(`hostCelledColumns`, `rowClassName`), `MetadataListCreateDialog.tsx`
(`createTarget`).
Two-minute check: `pnpm --dir ui exec vitest run --maxWorkers=2
packages/app-shell/src/views/metadata-admin/ResourceListPage.listStateInUrl-36896.test.tsx`
— expect 11 passed, including "the rows the table draws, in order, are
the names the detail steps through".
CI on `00e524f13`: 40 success, 13 skipped, mergeable `clean`. Local
gates: the 39 families `dispatch-gates --commands` derives all exit 0
(`--ran`: 39 derived, 39 run, 0 NOT-MEASURED, derived zero);
`check:test-source-alias` was red once on this branch and fixed by
paying the `@objectstack/lint` / `@object-ui/plugin-detail` loads at
collection in 6 suites; the vitest `scripts/` family was OOM-killed once
beside the booted app and re-ran green (172 files). CI runs the farm.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01WGufzgNtKtppbRbXmHGH8x
<!-- signed: repo:objectstack#3 · os-support-ai ·
session_01WGufzgNtKtppbRbXmHGH8x -->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 30778f3 commit c48f06c
23 files changed
Lines changed: 1771 additions & 424 deletions
File tree
- .changeset
- ui
- e2e/live
- packages
- app-shell/src/views
- metadata-admin
- studio-design
- plugin-grid/src
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
14 | | - | |
| 13 | + | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
34 | | - | |
35 | | - | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
| |||
50 | 51 | | |
51 | 52 | | |
52 | 53 | | |
53 | | - | |
| 54 | + | |
54 | 55 | | |
55 | 56 | | |
56 | | - | |
| 57 | + | |
57 | 58 | | |
58 | 59 | | |
| 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 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
0 commit comments