Repository navigation
Commit 2a0f0b7
feat(studio): draw the nav entries, fields and flows other packages contribute to a base greyed, with the package (#29847)
Fixes #29786
Clause-②: no
Metadata-protocol: none
## 维护者速读
- **改了什么**:在只读的基础包上,Studio 现在会画出其他已安装包贡献给它的导航项、字段和流程:灰色、只读,并标注"来自
某包"。导航项放在它声明的分组下,分组未声明时放在顶层;字段在表单布局中原位标记(不再画第二份);流程放进其对象的分组。
- **为什么改**:此前 Studio
一项都不画,而运行中的应用全部显示;一个只被其他包填充的分组会显示"此包中没有项目",管理员在定制或卸载被扩展的基础包时看不到谁依赖它。
- **风险与回滚**:只改 Studio 绘制,不改 spec、服务端或任何请求(仍是同一个 customizations
读取)。可写包、没有贡献的基础包、贡献方自身的页面画法不变。回滚即还原本 PR。
-
**先看**:`ui/packages/app-shell/src/views/studio-design/contributionRows.ts`(放置规则,纯函数),再看
`StudioDesignSurface.tsx` 三个 pillar 的接入。
- **两分钟验证**:`pnpm --dir ui exec vitest run
packages/app-shell/src/views/studio-design/contributionRows.test.ts
packages/app-shell/src/views/studio-design/StudioDesignSurface.oneSurface-28572.test.tsx`(27
项全绿);对照截图见下方 Verification。
- **需要你做的**:看一眼 Acceptance notes 里的三条后续候选(导航项只显示 id、Automations
计数、贡献方一侧文案),决定是否另开卡。
## What changes
On a read-only base, Studio draws the items other installed packages
contribute to it, from the `contributions` of the base's one
customization read (`GET /api/v1/packages/:id/customizations`). That is
the read the rails' marks already make, so no request is added and
nothing is joined on names in the browser. Each item is greyed,
read-only, labelled "from PACKAGE", and a click opens the contributing
package (through the shell's unsaved-edits seam).
- **One reader.** `usePackageCustomizations` now also names each
contributing package from the package list, by id, as it already names
the base. `contributionRows.ts` (new, pure) splits the read by kind and
holds the placement rules.
- **Interfaces.** A `nav` entry for the open app draws under the group
it names when the app declares a `type: 'group'` item of that id at any
depth (the question the server's navigation fold asks), and at the top
level otherwise. An entry naming an undeclared group says so in its
tooltip. A declared group holding only contributed rows no longer says
"No items in this package". The row reads the item's id (the served
entry carries no label). The row is never in the nav edit buffer, so it
cannot be dragged, renamed or deleted.
- **Data.** A contributed field is already served on the base's object
(the engine merges every extension), so it was drawn before, unmarked.
The Form layout now marks that same card ("from PACKAGE", greyed, title)
instead of drawing a second copy. It takes no drag listener and opens
read-only in the inspector, even where the pair could write a base
field's display properties.
- **Automations.** A contributed `flow` draws in its object's rail
group. An object with no flow of the base's gets a group of its own,
before "No object".
- **Strings.** Five keys in the studio namespace, `en` and `zh`
(`engine.studio.contributed.*`).
## Tests
- `contributionRows.test.ts` (new, 9): split by kind and package naming,
declared group at depth, top level and undeclared group, other app left
out, a non-group item sharing the id is no container, fields per object,
flow groups joined or added before "No object".
- `StudioDesignSurface.oneSurface-28572.test.tsx` (+6): Interfaces
group, top-level and undeclared placement; a nav row opens the
contributor; CONTROL: an empty declared group still says "No items" when
nothing is contributed; Data card marked once, not `aria-disabled`,
inspector read-only while the base's own field is not; Automations group
placement, a new group, no empty message, opens the contributor; no
request to the contributing package.
- Ablations, each red then restored (blob equals HEAD): group rows,
top-level rows, `findDeclaredNavGroup`, the `contributedFields` prop,
the rail read-only, flow rows, and `useSortable` `disabled` on a
contributed card.
## Acceptance notes
- **Nav rows show the id, not a label** (seat ruling). The customization
read's `nav` entry carries no label. Measured: the app list read the
pillar already makes (`GET /meta/app?package=`) carries the folded
navigation with labels. Using it would need a ruling on reading the
fold, so no label is joined here.
- **Automations heading count** stays the base's own (0 on the fixture),
and the main pane still says "No automations in this package yet." A
contributed flow is not the base's.
- **Contributor side**: the contributing package's Interfaces pillar
still reads "This package has no app yet." Its package-list row carries
the raw `manifest.navigationContributions` (a declaration, not the
fold). Left as is and reported (seat ruling).
- **Grid column headers** on the Records tab are not marked: that grid
is `plugin-grid`, outside this surface.
- **Strings** are `en` and `zh` only. The studio namespace lives in
`ui/packages/i18n/src/namespaces/studio/`, not in the ten locale packs
the claim names; other languages fall back to `en` as the whole
namespace does.
- **Screenshots** came from `examples/app-multi-package` plus a
temporary third package (a nav entry under an undeclared group, a field
and a flow on `crm_account`). That package was never committed; the pins
carry their own fixtures.
## Verification
- Pins: 27/27 on the final head. Type-check (`turbo type-check`
app-shell + i18n), eslint on touched files: 0 errors.
- Derived gates (`dispatch-gates --commands`): all exit 0; see the
os-dev-report on the card.
- Live, `objectstack dev` on `app-multi-package` plus the temporary
package, Console via Vite. The base read lists 4 contributions (field
`acme_score`, flow `crm_acme_account_sync`, nav `nav_acme_portal` under
undeclared `ghost_group`, nav `nav_orders` under `sales_group` from the
orders package). After: `nav_orders` under SALES and `nav_acme_portal`
at the top level with the undeclared-group tooltip; the Acme score card
marked once with the inspector read-only; `crm_acme_account_sync` in the
ACCOUNT group. Before (601832b): none of the nav or flow rows, and the
field card unmarked.
- Before/after screenshots (Interfaces, Data form, Automations, plus
rail crops, the field inspector and a phone-width Automations, and three
side-by-side comparisons) are handed to the seat with this PR for
attaching to the card.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01QsR2jQkUExPHsEsPoX99Uf
---
_Generated by [Claude
Code](https://claude.ai/code/session_01QsR2jQkUExPHsEsPoX99Uf)_
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent a932270 commit 2a0f0b7
10 files changed
Lines changed: 905 additions & 35 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 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
121 | 127 | | |
122 | 128 | | |
123 | 129 | | |
124 | 130 | | |
125 | 131 | | |
126 | 132 | | |
127 | 133 | | |
128 | | - | |
129 | | - | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
130 | 137 | | |
131 | 138 | | |
132 | 139 | | |
| |||
138 | 145 | | |
139 | 146 | | |
140 | 147 | | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
147 | 151 | | |
148 | 152 | | |
149 | | - | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
150 | 165 | | |
151 | 166 | | |
152 | 167 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
| 62 | + | |
| 63 | + | |
62 | 64 | | |
63 | 65 | | |
64 | 66 | | |
| |||
311 | 313 | | |
312 | 314 | | |
313 | 315 | | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
314 | 323 | | |
315 | 324 | | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
316 | 328 | | |
317 | 329 | | |
318 | 330 | | |
| |||
415 | 427 | | |
416 | 428 | | |
417 | 429 | | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
418 | 434 | | |
419 | 435 | | |
420 | 436 | | |
421 | 437 | | |
422 | 438 | | |
423 | 439 | | |
424 | | - | |
| 440 | + | |
425 | 441 | | |
426 | 442 | | |
427 | 443 | | |
| |||
441 | 457 | | |
442 | 458 | | |
443 | 459 | | |
444 | | - | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
445 | 464 | | |
446 | 465 | | |
447 | 466 | | |
448 | 467 | | |
449 | | - | |
| 468 | + | |
450 | 469 | | |
451 | | - | |
| 470 | + | |
452 | 471 | | |
453 | 472 | | |
454 | 473 | | |
455 | 474 | | |
456 | 475 | | |
457 | | - | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
458 | 485 | | |
459 | 486 | | |
460 | 487 | | |
461 | 488 | | |
462 | 489 | | |
463 | | - | |
| 490 | + | |
464 | 491 | | |
| 492 | + | |
465 | 493 | | |
466 | 494 | | |
467 | 495 | | |
| |||
471 | 499 | | |
472 | 500 | | |
473 | 501 | | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
474 | 505 | | |
475 | 506 | | |
476 | 507 | | |
| |||
672 | 703 | | |
673 | 704 | | |
674 | 705 | | |
| 706 | + | |
675 | 707 | | |
676 | 708 | | |
677 | 709 | | |
| |||
893 | 925 | | |
894 | 926 | | |
895 | 927 | | |
| 928 | + | |
896 | 929 | | |
897 | 930 | | |
898 | 931 | | |
| |||
991 | 1024 | | |
992 | 1025 | | |
993 | 1026 | | |
| 1027 | + | |
994 | 1028 | | |
995 | 1029 | | |
0 commit comments