Repository navigation
Commit c75453e
feat(studio): one detail header and tool tabs for a metadata item (#36977)
<!-- claude-projects-attribution: {"github_login":"os-support-ai"} -->
_Requested by **Yibo Wang** · [project
thread](https://claude.ai/code/project/chan_01BVUyyPie8gHwoPM18iABwB?thread=cmsg_01BVUyyPie8gHwoPM18iABwBTuMGhLAZx29zwDrayDGZZF)_
repo:objectstack#3 · os-support-ai · session_01WGufziBCAytAzzCu3iPBFR
Fixes #36901
Part of #36890
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 在 Studio
里打开任意一个元数据条目(以及邮件模板、翻译的表单编辑器),顶部换成统一的详情头:关闭回到列表、上一条/下一条翻阅、类型与来源包标签;原来右侧弹出的六个抽屉改成页面里的标签页(详情、预览、相关、被引用、历史、源码),草稿审阅变成头部的状态标签。
- 属于 Studio
重构总计划的第二阶段第一步,替维护者和搭建者解决"抽屉层层叠、找不到工具、刷新后丢失位置"的问题;共享标签组件留给后续三个设计器卡直接挂载。
- 出错时最可能是某个标签打不开或地址里的标签没生效,数据不会丢,保存逻辑未改;本 PR 可整体撤回,旧的抽屉地址仍能打开对应标签。
- 无。
## What changes
Studio's generic item page (`ResourceEditPage`) and the area's form
editor (`StudioBundleItemEditor`: email templates, translations) now
draw the shared `StudioDetailHeader` (#36892), and the six side sheets
are tabs of the page.
- **Header** (`metadata-admin/ResourceDetailHeader.tsx`, new): × opens
the type's list with the list context (`q`, `source`, `customized`,
`status`, `sort`) and the scope (`package`, `scope`) the item's address
carries; ‹ › walk `useListOrderedNames(type)` and keep the open tab.
Item-only params (`tab`, `review`, `open`, `sel`, `member`) never
travel. Both go through `confirmUnsavedLeave`; browser Back is not
intercepted. The parent path is read from the address, not the route, so
the header works wherever a host mounts the page.
- **Tabs** (`item-tools/ItemToolTabs.tsx`, new — the ONE shared
component for #36903 / #36904 / #36905): `offeredItemToolTabs`,
`defaultItemToolTab`, `useItemToolTab` (`?tab=` in the address,
replace-only), `ItemToolTabStrip`, and `ItemToolTabPanel` wrapping the
existing References, History (+ Audit as its second view) and Source (+
the layered diff as its second view) panels unchanged. Legacy
`?tab=layers` opens Source → Layers; `?tab=audit` opens History → Audit.
- **Review** is the header's amber status chip while a draft is pending;
`?review=1` still opens the review sheet and is consumed.
- **History route**: `/studio/PKG/metadata/TYPE/NAME/history` redirects
(replace) to the item with `?tab=history`, query kept. It keeps the
standalone page for a type with its own `EditPage` (the permission
matrix links `./history`) and for an item a pillar's designer opens (no
tab row there yet).
- **Kept**: the `embedded` branch (PageShell, no tabs; review chip +
actions in its actions slot), canvas-owned keys, diagnostics, the draft
conflict guard, every write gate (rollback still on Save's gate,
objectui#12183).
- Strings: `engine.studio.itemTabs.*` (en, zh) added;
`engine.edit.related` removed (its last reader was the retired Related
sheet; `check:i18n-dead-keys` flagged it).
### Decision 4 — canvas types
A canvas type opens on **Preview**. **Details** shows the whole-item
form with the canvas-owned keys hidden as before. Both edit **one
draft**, and **one Save** (header button, ⌘S, autosave) saves it
whichever tab is open. Consequence: a tab switch keeps every unsaved
edit, so the generic page does not prompt on a tab switch.
`ItemToolTabStrip` has a `confirmSwitch` prop for a host whose tabs
would drop a buffer (the designers may need it).
### Decision 15 — the "from Studio" marker
Not added. This page is Studio's own address, so × always returns to
Studio's list; the marker governs pages that open inside an app.
### Carrier notes from #36896
- Same-name rows (bundle members, two-holder permission sets) are one ‹
› step; the step opens the canonical member (`member` is dropped).
- On `~all`, a row link carries `?package=X` and `areaLocationRedirect`
re-roots onto X's leg, so ‹ › and × follow X's list. Rows of a `.custom`
pair keep `?package=BASE`; rows with no package carry no package param.
### Deviations from the dispatch wording
- Tab switches on the generic page do not go through
`confirmUnsavedLeave` (one shared buffer, nothing is lost — see decision
4); × and ‹ › do.
- The form editor has no Preview tab: its preview is a live rendering
beside the form, not a canvas.
- Test files outside the claim's literal surface were edited because
this change turned them red (they opened the retired sheets):
`metadataAreaHost.gates-28561`, `trailDoorsGate-12475`,
`walledCatalogReadOnly-12183`, `StudioBundleItemEditor.customize-28569`,
`StudioDesignSurface.itemTools-28239` (test only —
`StudioDesignSurface.tsx` untouched), `StudioMetadataArea.routes-28561`.
`ResourceDetailHeader.tsx` is a new file beside the page.
## Tests
<details><summary>New and updated suites</summary>
- `item-tools/ItemToolTabs.test.tsx` (new): offered tabs and order,
decision-4 default, address round-trip incl. legacy values, hook + strip
(seed, write, default drops `?tab=`, unknown dropped, counts,
`confirmSwitch`), the three panels.
- `metadata-admin/ResourceDetailHeader.test.tsx` (new): pure hrefs, ‹ ›
with and without list context, ×, leave guard declines and accepts,
create page has no pager.
- `metadata-admin/ResourceEditPage.detailTabs-36901.test.tsx` (new):
plain type opens on Details; canvas type opens on Preview and a canvas
edit is in the draft Source reads; `?review=1` opens the review through
the chip (and CONTROL with no draft); **N2** — Esc during the non-Radix
canvas fullscreen leaves fullscreen and the page stays, the next Esc is
the header ×.
- `ResourceEditPage.tabDeepLink-12496.test.tsx` rewritten for the tabs;
`StudioBundleItemEditor.customize-28569` adds the shared-buffer + ×
case; `StudioMetadataArea.routes-28561` pins the redirect and both
CONTROLs.
</details>
<details><summary>Ablation (N2)</summary>
`node scripts/ablation-replace.mjs --anchor
"closeOnEscape={!isFullscreen}" --replacement "closeOnEscape={true}"` on
`ResourceEditPage.tsx` at 4de0ca7: mutation landed (anchor 1 → 0, blob
0aa6c36 → ad96efcc), the N2 case went red (1 failed | 4 passed),
restore proven (blob == HEAD, `git diff HEAD` empty). A first attempt
with replacement `closeOnEscape` was refused by the tool as a no-op
(replacement count did not rise) and ran nothing. The suite imports the
page from `src` (no `dist` hop).
</details>
## Acceptance notes
- Walked in tests: a plain type, a canvas type (registered canvas stub),
the form editor (email template), `?review=1`, the old `/history`
address.
- Out of scope, noted only: the area's `/history` address for a
designer-opened item still shows the standalone page until #36903–#36905
mount the tabs.
## Verification
All readings at head `be293d754` (branch merged with `origin/main`
0212714; 2,198 changed lines, under the 3,000 Tier H line).
<details><summary>Local readings</summary>
- Affected set (156 files, ui vitest, `--maxWorkers=2`, under the verify
lock): `Test Files 156 passed (156)`, `Tests 1407 passed (1407)`.
- `pnpm --dir ui exec vitest run scripts/`: `Test Files 172 passed | 2
skipped (174)`, `Tests 5126 passed | 2 skipped (5128)`.
- `pnpm --filter @object-ui/app-shell run type-check` (src +
`tsconfig.test.json`): exit 0, after `@objectstack/spec` rebuilt on the
merged tree.
- `dispatch-gates.mjs --commands`: 39 families, all run, all exit 0
(`check:test-source-alias` was red on the first pass — new and edited
suites reached a dynamic `@objectstack/lint` / editor import inside a
case clock — fixed in be293d7, then exit 0). `--ran`: 39 derived, 39
run, 0 NOT-MEASURED, 0 UNRUN.
- ui i18n: `check:i18n-keys` 0, `check:i18n-drift` 0,
`check:i18n-dead-keys` 0 (it reported `engine.edit.related` dead after
this change; removed). `check:new-line-citations`: 0 new, exit 0.
</details>
<details><summary>Browser walk (showcase, Chromium, private
port)</summary>
Built the showcase closure and the console from this branch, booted
`objectstack dev --ui --seed-admin` on a private port, signed in as the
seeded admin, and walked:
- hook item: header (title, api name, type, package, `6 / 8`), Details
pressed, no Preview tab; History writes `tab=history`, Audit view;
Source → Layers writes `tab=layers`; References; › opened the next hook
with `tab=references` kept; × returned to `…/metadata/hook?package=…`.
- old address `…/hook/NAME/history?package=…` opened the item on the
History tab (`…?package=…&tab=history`).
- email template: the form editor under the header, tabs Details /
Referenced by / History / Source; Source opens.
- a page (canvas type) in the environment scope: the generic page opened
on Preview.
- 0 page errors. Translation: NOT MEASURED in the browser — the showcase
ships no translation item; the bundle path is covered by
`StudioBundleItemEditor.customize-28569`.
</details>
Two-minute check: open `/studio/PKG/metadata/hook/NAME/history` — expect
the item page with the History tab pressed and the address rewritten to
`…/hook/NAME?package=PKG&tab=history`.
Read first (by risk): `ResourceEditPage.tsx` (the `renderFrame` /
`toolTabBody` hunks and `closeOnEscape`), `item-tools/ItemToolTabs.tsx`
(`useItemToolTab` address writes),
`studio-design/StudioMetadataArea.tsx` (`AreaHistoryRedirect`).
Session: https://claude.ai/code/session_01WGufziBCAytAzzCu3iPBFR
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- signed: repo:objectstack#3 · os-support-ai ·
session_01WGufziBCAytAzzCu3iPBFR -->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 586c3a2 commit c75453e
21 files changed
Lines changed: 1701 additions & 497 deletions
File tree
- .changeset
- ui/packages
- app-shell/src/views
- item-tools
- metadata-admin
- 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 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 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 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
0 commit comments