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
9 changes: 9 additions & 0 deletions .changeset/37456-studio-top-left-rows.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
'@object-ui/app-shell': patch
'@object-ui/i18n': patch
---

feat(studio): Studio's left column opens with two rows — App Studio with its collapse control, then the way back and a package switcher that ends with New package; a read-only package shows a lock; collapsed, the column is a rail that keeps the app's logo and the way back. Studio no longer has a top bar: Changes and Publish are on 概览's Pending tab (the package-less scope, now named Organization metadata in the switcher, keeps its Changes in the left column), the "Create app" button is gone, and below 768 px a strip at the top opens the menu

Clause-②: no
Metadata-protocol: none
17 changes: 14 additions & 3 deletions ui/e2e/live/studio-customize-journey.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,16 +123,27 @@ async function threeReads(request: APIRequestContext) {
};
}

/** Publish the pair's drafts through the surface's Publish / Pending changes dialog. */
/**
* Publish the pair's drafts through 概览's Pending tab, which the menu's 概览
* badge opens (objectstack#37456: Studio has no top bar, so its Publish lives
* there), then come back to the item the step was on.
*/
async function publishPair(page: Page) {
await page.getByRole('button', { name: /^Publish/ }).first().click();
const item = page.url();
await page.getByTestId('studio-menu-overview-pending').click();
const panel = page.getByTestId('draft-changes-panel');
await expect(panel).toBeVisible();
const published = page.waitForResponse(
(r) => r.request().method() === 'POST' && r.url().includes(`/api/v1/packages/${PAIR}/publish-drafts`),
);
await page.getByTestId('draft-changes-publish').click();
await panel.getByTestId('draft-changes-publish').click();
const res = await published;
expect(res.status(), await res.text()).toBe(200);
expect((await res.json()).data.outcome).toBe('published');
// Back on the item, its header is drawn (the chip in the row, or the ⋯ it
// folds into) before anything is read from it.
await page.goto(item);
await expect(page.getByTestId('studio-override-chip').or(page.getByTestId(ITEM_MORE)).first()).toBeVisible({ timeout: 15_000 });
}

/**
Expand Down
19 changes: 14 additions & 5 deletions ui/e2e/studio-left-menu-36899.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import { uiRoot } from '../scripts/ui-root.mjs';
* jsdom has no layout engine. The unit tests (`StudioMenu.test.tsx`) pin what
* the menu lists, its current entry, its search and its cookie; this page
* proves where it is drawn: docked at the left of a wide window with the
* content beside it, off the canvas once collapsed with the content taking the
* full width, still collapsed after a reload (Studio's own cookie, on a real
* content beside it, a rail of icons once collapsed with the content beside it
* (objectstack#37456), 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
Expand Down Expand Up @@ -239,12 +239,21 @@ test.describe('Studio left menu (objectstack#36899)', () => {
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) => {
// objectstack#37456 (ADR-0084, amended 2026-11-26, `#amendment-2026-11-26-frame`): collapsed, the
// column is a rail of icons (the sidebar's 3rem icon width), no longer off the canvas; the content
// starts where the rail ends.
test('collapsed: a rail of icons, the content beside it, and a reload keeps it', async ({ page }, testInfo) => {
await open(page, 1280);
await page.getByTestId('studio-menu-toggle').click();
await expect(page.locator('[data-side="left"][data-state="collapsed"]')).toHaveCount(1);
await expect.poll(async () => (await rect(page, PANEL)).right).toBeLessThanOrEqual(0);
await expect.poll(async () => (await rect(page, '#content')).left).toBe(0);
// Read once the width transition has finished.
await expect.poll(async () => (await rect(page, PANEL)).right).toBeLessThanOrEqual(49);
const rail = await rect(page, PANEL);
expect(rail.left).toBe(0);
expect(rail.right).toBeGreaterThan(40);
await expect(page.getByTestId('studio-menu-toggle')).toBeVisible();
await expect.poll(async () => (await rect(page, '#content')).left).toBeGreaterThanOrEqual(rail.right - 1);
expect((await rect(page, '#content')).left).toBeLessThanOrEqual(rail.right + 1);
const cookies = await page.context().cookies(ORIGIN);
expect(cookies.find((c) => c.name === 'studio_menu_state')?.value).toBe('false');
expect(cookies.find((c) => c.name === 'sidebar_state')).toBeUndefined();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* 2. One confirm creates the package AND its app: the package `POST`, the
* app's draft under the first-write pin, then that one app's publish
* (objectstack#36511: a human-created item is live at once). The author
* lands in the new package's Studio, whose header names the app, and
* lands in the new package's Studio, whose way back names the app, and
* 「‹ Back to app」 opens it.
* 3. A taken app name refuses the whole confirm and writes nothing.
*
Expand Down Expand Up @@ -240,7 +240,7 @@ describe('PackageFormDialog with a new-app step: offered as 「同时创建应
});

describe('PackageFormDialog with a new-app step: one confirm creates the package and its app, and the app opens (objectstack#36748)', () => {
it('package, app draft, app publish — then the header names the app and 「‹ Back to app」 opens it', async () => {
it('package, app draft, app publish — then the way back names the app and opens it', async () => {
renderDoor();
const dialog = await openNewAppDialog();
fireEvent.change(nameInput(dialog), { target: { value: 'Visits' } });
Expand All @@ -267,16 +267,18 @@ describe('PackageFormDialog with a new-app step: one confirm creates the package
expect(toast.success).toHaveBeenCalledWith('Created package “Visits” and its app.');
expect(toast.error).not.toHaveBeenCalled();

// The author lands in the new package's Studio; the header names the app.
const header = await screen.findByTestId('studio-shell-header', undefined, { timeout: 8000 });
// The author lands in the new package's Studio; the way back names the app
// (objectstack#37456: the package row's first control, beside the switcher).
const row = await screen.findByTestId('studio-package-row', undefined, { timeout: 8000 });
await waitFor(
() => expect(within(header).getByTestId('studio-back-app-name')).toHaveAttribute('data-names', 'app'),
() => expect(within(row).getByTestId('studio-package-back')).toHaveAccessibleName('Leave Studio and go back to Visits'),
{ timeout: 8000 },
);
expect(within(header).getByTestId('studio-back')).toHaveTextContent(/^Back to app·Visits·App Studio$/);
// The app is live: no Create app is offered, and the back link opens it.
expect(within(header).queryByRole('button', { name: /Create app/ })).toBeNull();
fireEvent.click(within(header).getByTestId('studio-back-to-app'));
expect(within(row).getByTestId('studio-pkg-switcher-name')).toHaveTextContent('Visits');
expect(screen.getByTestId('studio-brand-name')).toHaveTextContent(/^App Studio$/);
// The app is live: no Create app is offered, and the way back opens it.
expect(screen.queryByRole('button', { name: /Create app/ })).toBeNull();
fireEvent.click(within(row).getByTestId('studio-package-back'));
expect(await screen.findByTestId('running-app')).toHaveTextContent(`/apps/${packageId}`);
});

Expand Down Expand Up @@ -358,7 +360,7 @@ describe('CreatePackageDialog: 「同时创建应用」 is offered, ticked by de
});

describe('CreatePackageDialog: ticked creates the package and its app; unticked only the package (objectstack#37134)', () => {
it('ticked: package, app draft, app publish — then the Studio header names the app', async () => {
it('ticked: package, app draft, app publish — then Studio’s way back names the app', async () => {
renderCreatePackage();
const dialog = await openNewAppDialog();
await nameAndWait(dialog, 'Visits');
Expand All @@ -379,13 +381,14 @@ describe('CreatePackageDialog: ticked creates the package and its app; unticked
expect(toast.error).not.toHaveBeenCalled();

// Where the wrapper lands does not change (Studio on the new package),
// and with an app the header names it.
const header = await screen.findByTestId('studio-shell-header', undefined, { timeout: 8000 });
// and with an app the way back names it (objectstack#37456).
const row = await screen.findByTestId('studio-package-row', undefined, { timeout: 8000 });
await waitFor(
() => expect(within(header).getByTestId('studio-back-app-name')).toHaveAttribute('data-names', 'app'),
() => expect(within(row).getByTestId('studio-package-back')).toHaveAccessibleName('Leave Studio and go back to Visits'),
{ timeout: 8000 },
);
expect(within(header).getByTestId('studio-back')).toHaveTextContent(/^Back to app·Visits·App Studio$/);
expect(within(row).getByTestId('studio-pkg-switcher-name')).toHaveTextContent('Visits');
expect(screen.getByTestId('studio-brand-name')).toHaveTextContent(/^App Studio$/);
});

it('unticked: only the package is created, as before', async () => {
Expand All @@ -401,13 +404,10 @@ describe('CreatePackageDialog: ticked creates the package and its app; unticked
expect(srv.apps).toEqual([]);
expect(srv.appDrafts).toEqual([]);
// The same landing: Studio on the new package, which has no app to name.
const header = await screen.findByTestId('studio-shell-header', undefined, { timeout: 8000 });
const row = await screen.findByTestId('studio-package-row', undefined, { timeout: 8000 });
const packageId = String((srv.writes[0].body?.manifest as Record<string, unknown>).id);
expect(await screen.findByTestId('studio-back-app-name', undefined, { timeout: 8000 })).toHaveAttribute(
'data-names',
'package',
);
expect(header).toBeInTheDocument();
await waitFor(() => expect(within(row).getByTestId('studio-pkg-switcher-name')).toHaveTextContent('Shared parts'), { timeout: 8000 });
expect(within(row).getByTestId('studio-package-back')).toHaveAccessibleName('Leave Studio and go back to your apps');
expect(packageId).toMatch(/shared-parts$/);
});

Expand Down Expand Up @@ -466,9 +466,13 @@ function mounts(component: string): string[] {
}

describe('every create-package door offers 「同时创建应用」 (objectstack#37134)', () => {
it('Setup → Packages (its button and the `?new=package` door) and the resource list mount CreatePackageDialog', () => {
it('Setup → Packages (its button and the `?new=package` door), the resource list and Studio’s package switcher (objectstack#37456) mount CreatePackageDialog', () => {
const doors = mounts('CreatePackageDialog').map((m) => m.split(':')[0]);
expect(doors.sort()).toEqual(['views/metadata-admin/PackagesPage.tsx', 'views/metadata-admin/ResourceListPage.tsx']);
expect(doors.sort()).toEqual([
'views/metadata-admin/PackagesPage.tsx',
'views/metadata-admin/ResourceListPage.tsx',
'views/studio-design/StudioPackageSwitcher.tsx',
]);
});

it('no create-mode PackageFormDialog is mounted outside CreatePackageDialog, and that one passes the step', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
* screen reader announced two unlabeled edit fields and `getByLabelText`
* found nothing. The component is shared by every Studio create dialog
* (package, app, object, flow, permission set), so the fix is there and this
* suite drives two real openers: the Data pillar's New object, and the
* toolbar's Create app.
* suite drives a real opener: the object list's New object. (The toolbar's
* Create app, the second, went with Studio's top bar: objectstack#37456.)
*
* Label strings are read by their catalog key, so the pin is on the binding,
* not on the copy.
Expand All @@ -20,8 +20,8 @@ import '@objectstack/lint';
import '@object-ui/plugin-detail';
import '@testing-library/jest-dom/vitest';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import { cleanup, fireEvent, render, screen, waitFor, within } from '@testing-library/react';
import { MemoryRouter, Route, Routes } from 'react-router-dom';
import { cleanup, fireEvent, render, screen, within } from '@testing-library/react';
import { MemoryRouter } from 'react-router-dom';

let clientImpl: any;

Expand All @@ -47,8 +47,6 @@ vi.mock('./packages-io', async (importOriginal) => {
vi.mock('./StudioAiCopilot', () => ({ StudioChatDock: () => null }));
vi.mock('../../preview/DraftChangesPanel', () => ({ DraftChangesPanel: () => null }));

import { StudioDesignSurface } from './StudioDesignSurface';
import { StudioPillarRedirect } from './StudioPillarRedirect';
import { MetadataListCreateDialog } from '../metadata-admin/MetadataListCreateDialog';
import { t } from '../metadata-admin/i18n';

Expand Down Expand Up @@ -115,24 +113,4 @@ describe('Studio create dialogs bind each label to its input (objectui#13128)',
expect(idInput.value).toBe('repair_ticket');
});

it('Create app (a sibling dialog on the same component): "App name" and "Identifier" each find their input', async () => {
// objectstack#36903 — the Automations pillar is retired; the sharing overview's page hosts the toolbar.
render(
<MemoryRouter initialEntries={['/studio/app.a/owd']}>
<Routes>
<Route path="/studio/:packageId/:tab" element={<StudioPillarRedirect><StudioDesignSurface /></StudioPillarRedirect>} />
</Routes>
</MemoryRouter>,
);
const toolbar = await screen.findByTestId('studio-shell-header');
await waitFor(() =>
expect(within(toolbar).getByRole('button', { name: 'Create app' })).toBeInTheDocument(),
);
fireEvent.click(within(toolbar).getByRole('button', { name: 'Create app' }));
const dialog = await screen.findByRole('dialog');

const nameInput = expectBound(dialog, t('engine.studio.app.nameLabel', 'en'));
const idInput = expectBound(dialog, t('engine.studio.app.idLabel', 'en'));
expect(nameInput).not.toBe(idInput);
});
});
Loading
Loading