Skip to content

feat(studio): a dashboard list's New opens the app's design mode on its dashboards - #37368

Draft
objectstack-fleet[bot] wants to merge 1 commit into
mainfrom
claude/issue-36907-studio-new-dashboard-design-mode
Draft

objectstack-fleet[bot] wants to merge 1 commit into
mainfrom
claude/issue-36907-studio-new-dashboard-design-mode

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Fixes #36907

Clause-②: no
Metadata-protocol: none

维护者速读

  • 管理员在 Studio 的仪表盘列表点「新建」,会直接打开对应应用,「设计布局」已开、「添加菜单项」停在仪表盘一栏;建好的仪表盘挂在菜单上并进入编辑,点 × 回到 Studio 列表;手机宽度不出现「新建」,包里没有可打开的应用时也不出现,并写明原因。
  • 属于「Studio 重构」专题,落实你定的「新建跳到设计模式加菜单」,让新仪表盘不会游离在所有菜单之外。
  • 出错时管理员在 Studio 里可能新建不了仪表盘,或进不了设计模式;已有仪表盘、报表和菜单不受影响,纯前端改动,可直接撤回。
  • 无

What changes

The Studio dashboard list's New now uses design mode's existing 「Add menu item → New dashboard…」 flow (#36364), the maintainer's 「新建跳到设计模式加菜单」 (dashboard half). The report half (decision 13) is unchanged.

The arrival (layout/designModeArrival.ts, layout/useDesignModeArrival.ts). A second navigation-state arrival, designModeAddDashboard, sits beside designModeNewDashboard and carries the Studio list it came from. ConsoleLayout reads it once per history entry through useDesignModeArrival. It first replaces the entry without the arrival, so a reload or Back enters nothing. Then it asks the mode to enterOpening({ column: 'dashboard', studioReturn }).

  • ⛔ No URL enters design mode. The arrival rides navigation state only; the landing address carries no ?studio= and no mode.
  • enterOpening is enter plus a one-shot "opening" held in the mode store. Where enter refuses (an editor holds the mode out, PR fix(console): report editing is its own entry, mutually exclusive with design mode #36848), nothing is held and the mode's own designMode.editorOpen toast says why. On a phone the arrival is cleared and nothing more happens.
  • The held-out count moved from state to a ref. An editor that opens in the same commit the arrival lands in is then still judged (pinned; ablation A5c below). enter() keeps its zero-argument contract: a click event is never an opening.

DesignModeMenu takes the opening once (useDesignModeOpening). It opens the picker on 「Dashboards」 for an entry at the end of the top level, as that level's 「Add menu item」 would. A dashboard created from that picker navigates with withStudioReturn(href, studioReturn), so the dashboard page's existing × goes back to the Studio list (?studio=). Closing that picker drops the return, and later adds are plain.

Studio (StudioAreaAppOpen.tsx, studioAppEdit.ts, StudioMetadataArea.tsx). StudioAreaAppTarget gains { kind: 'new-dashboard' }. AreaCreate sends dashboard/new through it, under the same condition the report leg uses (!readOnly || pairCreate). It replaces the Studio address with /apps/SEGMENT (appHomePath) and the arrival.

The list (ResourceListPage.tsx). useStudioDashboardNew gates the area's dashboard 新建 by the same reads. It never shows at phone width, and it is not drawn while the apps are being read. With no target app the header shows no 新建 and shows a role="note" reason instead (engine.list.dashboardNewNoApp); the empty state says the same.

Riders from seat 4's L1 on PR #37348.

Additive en and zh keys: engine.list.dashboardNewNoApp in the studio namespace (it is en/zh only). No server, spec or route change.

Read first

  1. ui/packages/app-shell/src/layout/useDesignModeArrival.ts: the consume-then-enter order. Risk: it navigates (replace) in the same commit AppRootLanding's redirect may navigate. Child effects run first, so the landing redirect re-applies on the next render; see Acceptance notes.
  2. ui/packages/app-shell/src/layout/designMode.tsx: enterWith / enterOpening / takeOpening, and heldOut moving to a ref.
  3. ui/packages/app-shell/src/views/studio-design/StudioAreaAppOpen.tsx: the new-dashboard leg and useStudioDashboardNew.

Tests

Pins, each with an ablation that turned it red (and restored hash-verified through scripts/ablation-replace.mjs). Every file below imports the subject from source, so no build or dist preflight applies:

Pin File (new top-level describe) Ablation → red
Studio 新建 lands in the target app, design mode open, dashboard column open StudioAreaAppOpen-36906 (dashboard list's New…), DesignModeMenu-36363 (the arrival…) A6 AreaCreate dashboard branch off → 5 red; A1 enterOpening call removed → 6 red; A2 picker kind null → 2 red
A created dashboard is in the menu and opens for editing, × back to the list DesignModeMenu-36363 A3 withStudioReturn dropped → 1 red
CONTROL: the report 新建 is unchanged existing 36906 report-New tests and pair report-New control; list control CONTROL — the report list (control: green under every ablation)
No 新建 at phone width ResourceListPage.pairCreate-36897 (dashboard list's 「新建」…) A8 phone read as false → 1 red
No 新建 without a target app, reason shown same A9 gate ignores no-app → 3 red; A10 reason not drawn → 2 red
A refused enter() does nothing DesignModeMenu-36363 A5 hold ignored → 2 red; A5c render-time snapshot of the hold → the same-commit pin red, the prior-editor pin green
The pair leg StudioAreaAppOpen-36906, ResourceListPage.pairCreate-36897 A7 pair leg off (Studio) → 2 red; A7b (list) → 1 red
The arrival is consumed (reload / Back enter nothing) DesignModeMenu-36363 A4 replace removed → 4 red

Moved by this change, and re-pinned rather than deleted:

  • 36906's "a dashboard New is not this card" half is now the new describe.
  • 36906's "a dashboard made by the area's create … Back lands on the list" runs at phone width, the one place the area's own dashboard create is still reached from a list.
Local runs on the final head 6fbbdd9 (rebased on d5ae7a4)
  • cd ui && npx vitest run --maxWorkers=2 over the 4 pinned files (DesignModeMenu-36363, designMode-36362, StudioAreaAppOpen-36906, ResourceListPage.pairCreate-36897) gives Test Files 4 passed (4) · Tests 114 passed (114).
  • pnpm --filter @object-ui/app-shell type-check (both tsconfig.json and tsconfig.test.json) gives lock VERDICT command-exit 0.
  • The 156 app-shell/i18n test files that name a touched surface (ResourceListPage, designMode, DesignModeMenu, StudioAreaAppOpen, StudioMetadataArea, ConsoleLayout, studioAppEdit) were run on the pre-rebase head b0fc2e64, giving Test Files 156 passed (156) · Tests 1743 passed (1743). The rebase brought in one commit, fix(studio): a permission set's review link opens the draft review on its matrix page #37347, which touches none of this PR's files. The full app-shell suite (2,431 files) is left to CI's Test UI (a declared narrowing).
  • Gates derived by node scripts/pm/dispatch-gates.mjs --commands: all 38 commands exit 0, run on b0fc2e64.
  • Pre-push gates on 6fbbdd9b: pnpm check:test-source-alias exit 0, pnpm --dir ui check:i18n-keys exit 0, node scripts/pm/overlap-check.mjs gives VERDICT clean exit 0. It reports one open PR, feat(console): a 「⋯」 package menu in Studio's top bar; Import on Setup → Packages #37362, that shares the studio en/zh namespace files and merges cleanly.
  • In-flight branches, by git merge-tree:
    • claude/issue-37139-studio-package-menu merges clean.
    • claude/issue-36909-studio-pillar-dead-code merges clean. It shares StudioMetadataArea.tsx with this PR, in different hunks.
Ablations (each through scripts/ablation-replace.mjs, restored, git diff HEAD empty)
  • A1: drop the enterOpening call in useDesignModeArrival → DesignModeMenu-36363: 6 failed | 50 passed.
  • A2: setPickerKind(null) → 2 failed.
  • A3: navigate without withStudioReturn → 1 failed.
  • A4: drop the consuming navigate(..., { replace: true }) → 4 failed.
  • A5: if (false) in place of the held-out check → 2 failed.
  • A5b: a held-out getter that always reads 0 → 2 failed.
  • A5c: judge the hold at render time (heldOutAtRender) → only "the same refusal when the editor opens in the very commit the arrival lands in" fails among this card's pins. The prior-editor pin stays green.
  • A6: AreaCreate's dashboard branch never taken → StudioAreaAppOpen-36906: 5 failed | 22 passed.
  • A7: pair leg off in readNewDashboardSegment → 2 failed. A7b (list) → ResourceListPage.pairCreate-36897: 1 failed.
  • A8: useStudioDashboardNew reads no phone → 1 failed.
  • A9: canCreate ignores dashboardNew → 3 failed.
  • A10: reason note not drawn → 2 failed.

Acceptance notes

  • Double replace at the app root. useDesignModeArrival replaces the history entry it read, in the same commit AppRootLanding may redirect to the app's landing. Child effects run first, so the landing redirect re-applies on the next render. In the browser, the showcase landed on its first page (/page/showcase_capability_map) with the mode on and history.state.usr === null. A self-built app whose menu holds only links stays on /apps/ID, with the same result.
  • An app whose menu is split into areas keeps its plain menu under design mode, because UnifiedSidebar draws the editor only when areas.length === 0. That predates this PR. There the arrival enters the mode but no picker opens. No example app uses areas. See the report's open question.
  • The arrival does not repeat the 「Design layout」 door's own gate (useStudioEntryGate and the customization wall). The Studio list's 新建 is already gated by canCreate (walled, pairCreate), and the server judges every write again.
  • The held-out count moved from state to a ref (designMode.tsx). Nothing rendered from it; enter is the only reader. The existing 36692 pins pass unchanged.
  • The pair leg is applied to the dashboard New only. A pair's report New still falls back to the area's own create, pinned as CONTROL per the dispatch's "report 新建 unchanged". Whether it should gain the leg is in the report's open questions.
  • While the package's apps are being read, the list draws no 新建, so a no-app package never flashes one.

Verification

  • Browser walk on the showcase stack: pnpm dev -- --fresh -p 38461 (seeded admin), and the Console from ui/ sources via pnpm --filter @object-ui/console dev on :5180 pointed at it. Driven with Playwright from a scratch script, not committed.
    • Showcase (com.example.showcase, a read-only code package; the HotCRM shape): Studio › dashboard list › 新建 lands on /apps/com.example.showcase/page/showcase_capability_map with the Design layout bar and the 「Add menu item」 picker on Dashboards (「New dashboard…」 first). The history entry's state was cleared.
      • Create lands on /apps/com.example.showcase/dashboard/walk_showcase?studio=/studio/com.example.showcase/metadata/dashboard?package=com.example.showcase in its edit state, with the × drawn. The entry is in the menu, and the dashboard was saved to com.example.showcase.custom.
      • A reload of that page shows no design bar. × returns to the Studio list.
    • Self-built (com.walk.selfbuilt, created through POST /api/v1/packages with one app walk_app): 新建 lands on /apps/com.walk.selfbuilt with the bar and picker. Create opens /apps/com.walk.selfbuilt/dashboard/walk_selfbuilt?studio=…, and the dashboard was saved to com.walk.selfbuilt. × returns to the list.
    • No app (com.walk.noapp): no 新建, and the note reads "A new dashboard is made in an app's design mode, so that it hangs in a menu. This package has no app to make it in."
    • Phone (390 px): no 新建 and no note.
  • Two-minute check: in Studio, open any package's Dashboards list and press 新建. Expect the app with the purple Design layout bar and the 「Add menu item」 dialog already on Dashboards.

Generated by Claude Code

…ts dashboards

Studio's dashboard list New now opens the package's app (decision 6, the
.custom pair leg included) with a one-time navigation-state arrival:
ConsoleLayout reads it once, clears it from the history entry, and asks the
design mode to enter with the Add menu item picker open on its dashboards.
A refused entry does nothing more and says why; a phone does nothing. The
dashboard created there opens for editing with ?studio= back to the list.

The list offers no New at phone width, and none without a target app,
saying why. The report New is unchanged.

Claude-Session: https://claude.ai/code/session_01QSeKYoLfUxK6MRhuSp7nAt
Co-authored-by: Claude <noreply@anthropic.com>

This branch has not been deployed

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

Projects

None yet

2 participants