Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .changeset/37201-studio-menu-tiers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
'@object-ui/app-shell': patch
'@object-ui/i18n': patch
---

feat(studio): the left menu shows the 常用 Common types first and folds everything else under one 「高级」 Advanced section

Clause-②: no
Metadata-protocol: none

Studio's left menu on a package now lists the ten Common types first, in building order: Objects · Apps, Pages, Dashboards, Reports · Flows · Permission sets · Agents, Tools, Skills. Every other type, and the four entries that are not a type (Organization flows, Diagnostics, Default sharing, Positions and permissions), sit under one **Advanced** (高级) button below a divider, still under their group names.

- The Advanced section is closed by default. Opening or closing it is remembered per browser in the `studio_menu_advanced` cookie, apart from the menu's own collapse cookie.
- Opening a page that is one of its entries (a bookmark to the hooks list, the default sharing overview) shows the section open, with that entry marked current; this does not change the remembered state.
- The menu search lists matches from both tiers, whether the section is open or not.
- Group names are small muted headings with no number. The muted number beside an entry is its item count.
- A Common type the package holds nothing of is listed anyway, dimmed and with no number, and still opens its list, so a new package shows where to make its first app, page, dashboard or report. Before the item counts have loaded, no type is dimmed.
- The organization's flows (`~org`) and the cross-package catalog (`~all`) have no Advanced section: their entries are listed flat, in the same order.

No address changes: every entry opens the same page as before, bookmarks keep working, and the ⌘K palette lists the same entries in the new order. Two new strings: "Advanced" (高级) and the dimmed entry's tooltip.
44 changes: 41 additions & 3 deletions ui/e2e/studio-left-menu-36899.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ import { uiRoot } from '../scripts/ui-root.mjs';
* full width, still collapsed after a reload (Studio's own cookie, on a real
* http origin), and a drawer over the page at phone width.
*
* objectstack#37201 — the 「高级」 fold laid out: closed by default with its
* groups out of sight, opened by a click, and still open after a reload under
* its own cookie (`studio_menu_advanced`), the collapse cookie untouched.
*
* REAL: `StudioMenuProvider`, `StudioMenuTrigger`, `StudioMenu` and everything
* they import (the sidebar primitive, the menu model, the i18n), bundled by
* Vite from source, and the real Tailwind theme compiled for the classes on
Expand Down Expand Up @@ -65,7 +69,7 @@ const ENTRIES = [
];
export const useMetadataClient = () => ({});
export const useMetadataTypes = () => ({ loading: false, error: null, entries: ENTRIES });
export const useGlobalDiagnostics = () => ({ countsByType: { object: 12 }, packagesByType: {}, reload: () => {} });
export const useGlobalDiagnostics = () => ({ loading: false, error: null, countsByType: { object: 12 }, packagesByType: {}, reload: () => {} });
`;
},
};
Expand Down Expand Up @@ -175,8 +179,11 @@ test.beforeAll(async ({ browser }) => {
)).forEach((c) => c && seen.add(c));
await open(page, 1280);
await collect();
await page.getByTestId('studio-menu-advanced-toggle').click();
await collect();
await page.getByTestId('studio-menu-toggle').click();
await collect();
await page.context().clearCookies();
await open(page, 390);
await page.getByTestId('studio-menu-toggle').click();
await page.waitForSelector('[role="dialog"]');
Expand All @@ -186,7 +193,7 @@ test.beforeAll(async ({ browser }) => {
});

test.describe('Studio left menu (objectstack#36899)', () => {
test('wide: docked at the left, six groups, the content beside it', async ({ page }, testInfo) => {
test('wide: docked at the left, the 常用 groups shown, the content beside it', async ({ page }, testInfo) => {
await open(page, 1280);
const panel = await rect(page, PANEL);
const content = await rect(page, '#content');
Expand All @@ -195,12 +202,43 @@ test.describe('Studio left menu (objectstack#36899)', () => {
expect(panel.width).toBeGreaterThanOrEqual(255);
expect(panel.width).toBeLessThanOrEqual(256);
expect(content.left).toBeGreaterThanOrEqual(panel.right - 1);
for (const g of ['data', 'ui', 'automation', 'system', 'security', 'ai']) {
// objectstack#37201 — the served 常用 types' groups; 平台 Platform holds only 高级 entries.
for (const g of ['data', 'automation', 'security']) {
await expect(page.getByTestId(`studio-menu-group-${g}`)).toBeVisible();
}
await expect(page.getByTestId('studio-menu-group-system')).toHaveCount(0);
await testInfo.attach('wide', { body: await page.screenshot(), contentType: 'image/png' });
});

test('the 高级 fold: closed, then opened by a click, and a reload keeps it open (objectstack#37201)', async ({ page }, testInfo) => {
await open(page, 1280);
const fold = page.getByTestId('studio-menu-advanced-toggle');
await expect(fold).toBeVisible();
await expect(fold).toHaveAttribute('aria-expanded', 'false');
await expect(page.getByTestId('studio-menu-advanced-group-system')).toBeHidden();
await expect(page.getByTestId('studio-menu-entry-diagnostics')).toBeHidden();
await testInfo.attach('advanced-closed', { body: await page.screenshot(), contentType: 'image/png' });

await fold.click();
await expect(fold).toHaveAttribute('aria-expanded', 'true');
for (const g of ['automation', 'system', 'security']) {
await expect(page.getByTestId(`studio-menu-advanced-group-${g}`)).toBeVisible();
}
await expect(page.getByTestId('studio-menu-entry-diagnostics')).toBeVisible();
// Below the 常用 entries, inside the docked panel.
const below = await page.getByTestId('studio-menu-entry-diagnostics').evaluate((el) => el.getBoundingClientRect().top);
const above = await page.getByTestId('studio-menu-entry-type:permission').evaluate((el) => el.getBoundingClientRect().top);
expect(below).toBeGreaterThan(above);
const cookies = await page.context().cookies(ORIGIN);
expect(cookies.find((c) => c.name === 'studio_menu_advanced')?.value).toBe('true');
expect(cookies.find((c) => c.name === 'studio_menu_state')).toBeUndefined();
await testInfo.attach('advanced-open', { body: await page.screenshot(), contentType: 'image/png' });

await page.reload();
await page.waitForSelector('[data-testid="studio-menu-advanced-toggle"]');
await expect(page.getByTestId('studio-menu-advanced-toggle')).toHaveAttribute('aria-expanded', 'true');
});

test('collapsed: off the canvas, the content takes the full width, and a reload keeps it', async ({ page }, testInfo) => {
await open(page, 1280);
await page.getByTestId('studio-menu-toggle').click();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,14 @@ describe('Studio: a package id no package has renders "package not found" (objec
renderAt(`/studio/${PACKAGE_ID}/data`);
await listAnswered(fetchMock);
expect(screen.queryByTestId('studio-package-not-found')).toBeNull();
// objectstack#36899 — the left menu, its six groups drawn.
for (const group of ['data', 'ui', 'automation', 'system', 'security', 'ai']) {
// objectstack#36899 — the left menu drawn. objectstack#37201 — the 常用 groups of the served
// types (object, flow, permission), and the 「高级」 fold holding the four entries that are not a type.
for (const group of ['data', 'automation', 'security']) {
expect(within(menu()).getByTestId(`studio-menu-group-${group}`)).toBeInTheDocument();
}
for (const group of ['automation', 'system', 'security']) {
expect(within(menu()).getByTestId(`studio-menu-advanced-group-${group}`)).toBeInTheDocument();
}
});

it('CONTROL — a kernel package the Studio landing hides is installed, never "not found"', async () => {
Expand Down
Loading
Loading