Skip to content

feat(studio): pick an object list view from the Interfaces header title, and keep it in the address - #30175

Merged
objectstack-fleet[bot] merged 8 commits into
mainfrom
claude/issue-30046-studio-view-dropdown
Nov 5, 2026
Merged

objectstack-fleet[bot] merged 8 commits into
mainfrom
claude/issue-30046-studio-view-dropdown

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Part of #30046 — this PR ships Scope 1–5. Scope 6–8 (fold the surface=view: page into this one, the 不在导航中 → 视图 filter, readable form-view names and their 视图类型) are left for a decision: see the size reading in Acceptance notes.

Clause-②: no
Metadata-protocol: none

维护者速读

  • 改了什么:Studio「界面」里对象入口的标题变成「对象 / 视图 ▾」,用运行态列表同一个下拉切换视图、搜索、新建视图;右侧面板的视图选择器、「添加视图」和「返回…」去掉了;当前视图写进地址栏 ?view=。
  • 为什么改:维护者要求「在预览区域顶部下拉选择视图。在对象的位置」,与前端运行态一致;原来切换视图后标题、地址都不变,刷新就回到默认视图,无法分享链接。
  • 风险与回滚:只动 Studio 界面支柱(ui/packages/app-shell)与 studio 文案;不改 spec、不改服务端、不改元数据。运行态列表的下拉只多了「📌 可省略」一项,运行态照传,行为不变。回滚即 revert 本 PR。
  • 先看:ObjectListViewTitle.tsx(新标题与新建视图)、ObjectListViewInspector.tsx 中 useObjectListViewDraft 的 initialView 一段(链接带来的视图何时生效、何时失效)、StudioItemHeader.tsx 的 readableTitleWidth(组合标题声明可读宽度)。
  • 两分钟验证:pnpm --dir ui exec vitest run packages/app-shell/src/views/studio-design/StudioDesignSurface.listViewSwitch-27896.test.tsx,预期 10 passed;或在 Studio 打开 CRM 的「商机」,标题下拉选「商机看板」,地址出现 &view=crm_opportunity.pipeline,刷新后仍是看板。
  • 需要你做的:无,席位落地。

What changes

  • The view switcher is the header's title. An Interfaces object entry's header reads object / view ▾. The view part is the running list's own ObjectViewTitleSwitcher, fed the object's list views (the merged listViews plus this package's drafts, as the panel picker listed them): rows by label, a search box, and New view, which opens the existing Create View dialog. Studio hands it no ☆, no 📌, no recent views and no Save as my view. It shows when the object has one list view too, so New view stays reachable. On a read-only package it switches views and offers no New view (canCreate = !readOnly, as the panel's Add view was gated). New file ObjectListViewTitle.tsx; the create path (createView, the taken-name toast) moved there unchanged.
  • The panel's picker, Add view and "Back to …" are gone. The panel keeps the open view's settings. Its title is the view's name exactly as the switcher gives it (listViewNameOf: the served listViews label first, else the item's own), so the CRM kanban's panel reads 商机看板 like the switcher, not the raw Pipeline (Kanban). A label-less view is "Default view" or its key; the object's name moved to the header's prefix.
  • The open view is in the address. ?surface=object:OBJECT&nav=NAV&view=OBJECT.KEY, written only while a view other than the entry's own is open. useSurfaceDeepLink is split into its capture and mirror halves (the composed hook is unchanged for the other pillars), so the Interfaces pillar writes the leaf and its view in one replace. useObjectListViewDraft takes initialView: shown once the linked leaf opens, dropped as soon as another leaf opens or the author picks a view, and taken only for a view of the open object. A pending edit is still sent before the switch (switchListView, unchanged), and a held edit still asks.
  • ObjectViewTitleSwitcher: the pin is optional. pinnedViewId, onPinnedViewChange and recentViewIds may be left out; without onPinnedViewChange no row draws 📌 and no Pinned section shows. The running list passes all three, so its behaviour is unchanged (its existing pins stay green, and a new pin holds both directions).
  • The title keeps its view name on a narrow row (measured, see Verification). A composed title shrinks inside its box instead of overflowing, so Studio: an item header keeps the item name readable; chips and tools collapse first #29693's fold never saw it as cut: at 1280 on the read-only CRM it showed Op… / Pipeline (K… with room to spare in the labelled actions. The title now declares its whole width (data-studio-title-readable, read by readableTitleWidth) and carries a zero-height sizer whose text is a pseudo-element (no reader or tooltip reads it twice), and "Open in Data" folds to its glyph like the other labelled actions. Order on a narrow row: chips and tools fold, then the object prefix truncates (down to 1.5em), then the view name, with its whole text in the trigger's tooltip.
  • Strings (@object-ui/i18n studio namespace): adds engine.studio.inspector.listView.defaultView; removes defaultTitle, namedTitle, addView, backToEntry, switchView, switchViewDraft, which only the removed panel controls read. The switcher's own words (搜索视图, 新建视图) are the console's existing view.* keys.

Tests

All on head ba9af0941.

Affected suites: 140 files, 1843 passed

pnpm --dir ui exec vitest run --maxWorkers=2 over every studio-design test that reads the Interfaces header, the list-view panel or the deep link (40 files), the switcher's own tests and the running list's switcher pins (objectViewTitleSwitcher.test.tsx, objectViewTitleSwitcher.phoneWidth-29074, ObjectView.titleViewSwitcher-27594, ObjectView.starredView-27594, ObjectView.personalViews-29635) and packages/i18n/: Test Files 140 passed (140) · Tests 1843 passed | 13 skipped. Typecheck: pnpm --filter @object-ui/app-shell type-check exit 0 (both programs).

New and rewritten pins
  • StudioDesignSurface.listViewSwitch-27896.test.tsx (rewritten onto the header switcher, 10 tests): the switcher lists all three views by label, the panel title is the same name, no ☆ / 📌 / recent / Save as my view, New view and search present; the panel holds no picker, Add view or Back; a drafted view's edit saves to that view; a pending edit is sent before the switch with no prompt; a held edit asks, declined stays, accepted switches; one list view still shows the switcher with New view; a read-only package switches and offers no New view; a pick writes ?view= and the entry's view writes none; a link carrying view opens that view (a drafted one); CONTROL: a link naming another object's view is not taken.
  • ObjectListViewInspector.addView-27836.test.tsx: New view from the switcher creates the kanban and the calendar, refuses a taken name; the switcher lists the new view and picking the entry's view shows it again.
  • objectViewTitleSwitcher.test.tsx: new top-level describe — without the pin door no row draws 📌 and a handed pinned id draws no Pinned section; a row still switches.
  • useSurfaceDeepLink.test.ts: view parses beside surface and nav, back-compat without it, view alone names nothing.
  • ObjectListViewInspector.displayTitle-13151, StudioDesignSurface.listViewInspector-11823, InterfacesPillar.customize-28562: expectations moved to the view-only title and to the switcher's New view.
Ablations (one per changed behaviour, restored and proven by blob hash)

Through scripts/ablation-replace.mjs; the suites import src directly, so no build sits in the path.

  • Mirror passes null for the view: a pick writes ?view= and a link carrying the view go red (2 failed / 8 passed); restored blob b26a265eff49 == HEAD, git diff HEAD empty, 10/10 again.
  • initialView: null: a link carrying the view goes red (1 failed / 9 passed); restored == HEAD.
  • Pin always drawn: no row draws 📌 goes red (1 failed / 14 passed); restored == HEAD.

The first run of the mirror ablation turned only one pin red: the link pin read the address before the mirror's write landed. The pin now waits for the writes to land, and the re-run turned both red.

Acceptance notes

  • Scope 6–8 are not in this PR. The size reading: this PR is 1059 changed lines (712 + / 347 −, 16 files) for Scope 1–5. Scope 6 means folding 条件格式化 (with its CEL verdict wired into the list buffer's autosave hold) and the spec-form sections into the list panel, and sending surface=view: for a list view to the object page, including for an object no nav entry opens. Scope 7 is the 不在导航中 filter (a draft header carries no body, so the view's kind and object are known only from published rows or the name). Scope 8 is readable form-view names, a heading that says what remains, and the form 视图类型. Together they are an estimated 600–800 more lines with their pins. Also, the 视图类型 fix lives in metadata-admin/inspectors/ViewVariantInspector.tsx (its type options come from the list-variant enum, so a form's simple reads 未找到), which is outside this claim's file surface.
  • The header-width table on the card does not hold on the read-only CRM. With Customize, 只读 and Open in Data in the row, the title's room at 1280 is about 208 px, not ≥ 222 px. Before the fold fix the title clipped at 1280 too. After it, 1280 shows both names whole, and 1024 folds the tools and keeps the view name (Pipeline (Kanban) / 商机看板) whole with the object prefix cut.
  • Seen, not fixed (pre-existing, not changed here): on a draft-only object, an entry with no viewName opens OBJECT.default even when the package drafts an isDefault view, because the entry's view is resolved from the shell's merged listViews only. The switcher therefore lists "Default view" beside the drafted default, and Create View seeds no columns there. Both behaved the same with the old panel picker. Reported to the seat.
  • No spec, server or metadata change, and no new metadata key.

Verification

Browser, latest main + this branch, isolated stack (CRM --fresh backend on its own port, Console dev server pointed at it, Chromium from /opt/pw-browsers). The screenshots are in the session's scratchpad. They are not attached here because the relay carries no uploads.

Read-only package (com.example.crm), en and zh, 1280 and 1024
  • 1280, 商机: title 商机 / 全部商机 ▾; the dropdown lists 全部商机, 商机看板; picking 商机看板 writes &view=crm_opportunity.pipeline; reload keeps it; the panel title reads 商机看板.
  • 1280, en: Opportunities / Pipeline (Kanban) ▾, both whole (title 315 px).
  • 1024, en: tools folded to glyphs, Op… / Pipeline (Kanban) ▾, view name whole (label 151 px, not cut).
  • 1024, zh: 商机 / 商机看板 ▾, both whole.
  • No New view in the dropdown; the panel's controls stay disabled.
Writable package (a fresh package with one object entry)
  • New view from the dropdown, named "Open opportunities this quarter": saved to the package draft, the URL gains &view=…open_opportunities_this_quarter, the panel and the title show it.
  • Switch to another view and back: the dropdown lists the new view.
  • Reload: the same view opens. A shared link opened in a second tab at 1024 opens the same view: chips folded, the long name truncated with its whole text in the trigger's tooltip.
  • The pending-edit-before-switch path was not driven in the browser (the drafted object's new view had no column to remove). It is pinned by a pending edit is sent to its own view before the switch, and nothing asks.
Local gates (on ba9af09)

node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack derived 35 families; each was run and exited 0, pnpm check:type-check-debt included (0 raw tsc error(s) total) and pnpm --dir ui exec vitest run scripts/ (172 files, 4985 passed). --ran reconciliation: 35 derived, 35 run, 0 NOT-MEASURED, 0 UNRUN. node scripts/check-sdui-manifest.mjs exit 0; pnpm --dir ui run check:new-line-citations: 0 new citation(s); node scripts/check-platform-checklist.mjs --changed-from origin/main exit 0; eslint over the changed files: 0 errors. Repo-wide scans and the full UI test battery are CI's.


Generated by Claude Code

…bjectstack#30046)

Claude-Session: https://claude.ai/code/session_01QSeKYnE9YNkSZen7sijLA3
Co-authored-by: Claude <noreply@anthropic.com>
… in the address (objectstack#30046)

Claude-Session: https://claude.ai/code/session_01QSeKYnE9YNkSZen7sijLA3
Co-authored-by: Claude <noreply@anthropic.com>
… Data folds to its glyph (objectstack#30046)

Claude-Session: https://claude.ai/code/session_01QSeKYnE9YNkSZen7sijLA3
Co-authored-by: Claude <noreply@anthropic.com>
…jectstack#30046)

Claude-Session: https://claude.ai/code/session_01QSeKYnE9YNkSZen7sijLA3
Co-authored-by: Claude <noreply@anthropic.com>
…ad (objectstack#30046)

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

Copy link
Copy Markdown
Contributor Author

domain:ui#2 · os-justin · session_01QSeKYnE9YNkSZen7sijLA3

维护者速读

  • 改了什么:Studio「界面」里对象的预览标题改成「对象 / 视图 ▾」下拉(与运行时列表同一个组件),可搜索、可新建视图;打开的视图写进地址(?view=),刷新和分享链接都回到它;右侧面板里原来的视图选择、添加视图、返回默认视图去掉。卡上第 1–5 项。
  • 为什么改:你的原话「在预览区域顶部下拉选择视图。在对象的位置」。
  • 风险与回滚:只动 Studio 前端,运行时列表的下拉行为不变(双向有测试);回滚即撤本 PR。
  • 先看:studio-design/ObjectListViewTitle.tsx(新标题)、useSurfaceDeepLink.ts(地址)、objectViewTitleSwitcher.tsx(钉选按钮改为可选)。
  • 两分钟验证:示例 CRM → Studio → 界面 → 商机,标题下拉切到「商机看板」,刷新仍是看板。
  • 需要你做的:无,席位落地;第 6–8 项另等你裁(Studio Interfaces: choose an object's view from a dropdown at the top of the preview, in the object's title, the way the running list does #30046 评论 6641701158)。

席位意见:ACCEPT(Part of #30046,不关卡)。席位亲看截图 zh-1280-dropdown。

席位核对

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant