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
10 changes: 10 additions & 0 deletions .changeset/38392-studio-doors-overview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
'@object-ui/app-shell': patch
---

fix(app-shell): every door into a package's Studio opens its 概览 Overview

Clause-②: no
Metadata-protocol: none

Opening a package's Studio now lands on its 概览 Overview page from every door, the way the bare package address and Studio's own entry already did. The doors that still opened the object list now open the Overview: the command palette's (⌘K) package entries, an app's Design in Studio (the app header's bridge where the page is the app's root, a system page or an interface list with none chosen), the "Open in App Studio" of an app whose menu is empty, and in Setup → Packages the detail sheet's "Open in Studio", the landing after New Package and the customizations section's "Customize in Studio". The object list keeps its address, `/studio/<package>/data`, for anyone who wants it.
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,11 @@ describe('the palette in the `studio` scope lists the Studio, not an app (object
expect(shown('studio-flow')).toEqual(['Onboard AccountAcme CRM', 'Nightly Cleanup']);
});

it('opens a package on its Data pillar', async () => {
it('opens a package on its 概览 Overview (objectstack#38392)', async () => {
mountStudio();
await studioListed();
pick('studio-package People ');
await waitFor(() => expect(locationNow()).toBe('/studio/com.acme.hr/data'));
await waitFor(() => expect(locationNow()).toBe('/studio/com.acme.hr/overview'));
});

it("opens an object in its package's Data pillar, on that object", async () => {
Expand Down
8 changes: 5 additions & 3 deletions ui/packages/app-shell/src/chrome/CommandPalette.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ import { useAuth } from '@object-ui/auth';
import { matchesPaletteQuery } from './paletteMatch.js';
import { fetchPackages, type PkgEntry } from '../views/studio-design/packages-io.js';
import { isPackageLessItem, studioOrgScopePath } from '../views/studio-design/studioScope.js';
import { studioHomePath, studioItemPath } from '../views/studio-design/studioAddress.js';
import { studioItemPath } from '../views/studio-design/studioAddress.js';
import { studioPackageOverviewPath } from '../views/studio-design/studioOverviewAddress.js';
import { flattenNavigation, useAppReportEntries } from '../views/appReportIndex.js';
import { useServedApps } from '../hooks/useLauncherApps.js';
import { servedObjectLabel } from '../hooks/servedObjectLabel.js';
Expand Down Expand Up @@ -1093,7 +1094,8 @@ const NO_STUDIO_ENTRIES: StudioPaletteEntries = { packages: [], objects: [], flo
*
* - **Packages** come from `fetchPackages`, the list the Studio landing and its
* package switcher read; kernel packages are already left out there. Each
* opens its Data pillar, as a landing card does.
* opens its 概览 Overview, where every door into a package lands
* (objectstack#38392).
* - **Objects** come from the metadata cache (`useMetadata().objects`), each
* listed under the package it declares (`_packageId`) and opened in that
* package's Data pillar. One whose package is not in the list has no Studio
Expand Down Expand Up @@ -1196,7 +1198,7 @@ function useStudioPaletteEntries(enabled: boolean, crossPackageItems = true): St
key: pkg.id,
label: pkg.name,
name: pkg.id,
href: studioHomePath(pkg.id),
href: studioPackageOverviewPath(pkg.id),
})),
objects,
flows,
Expand Down
7 changes: 4 additions & 3 deletions ui/packages/app-shell/src/console/AppNoAccessEmptyState.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
* (the only one who can also fill the menu), the no-navigation answer first
* reads the app's stored menu (`/layers`, the read the design mode's menu
* editor makes); when it is empty too, the screen says the menu is empty and
* opens the app's package in Studio. Everyone else, and a stored menu that
* opens the app's package in Studio, on its 概览 Overview, where every door
* into a package lands (objectstack#38392). Everyone else, and a stored menu that
* holds entries this caller is not shown, keep the access answer.
*/

Expand All @@ -54,7 +55,7 @@ import { Button, DataEmptyState } from '@object-ui/components';
import { useObjectTranslation } from '@object-ui/i18n';
import { useServedAppLabel } from '../hooks/useServedAppLabel.js';
import { useCanAuthorMetadata } from '../hooks/useCanAuthorMetadata.js';
import { studioHomePath } from '../views/studio-design/studioAddress.js';
import { studioPackageOverviewPath } from '../views/studio-design/studioOverviewAddress.js';
import { createAuthenticatedFetch } from '@object-ui/auth';

/** The console's authenticated fetch: the stored bearer token beside the session cookie. */
Expand Down Expand Up @@ -154,7 +155,7 @@ export function AppNoAccessEmptyState({ app, setupPath, reason = 'no-navigation'
})}
action={
<Button asChild variant="outline">
<Link to={studioHomePath(packageId)} data-testid="app-empty-menu-open-studio">
<Link to={studioPackageOverviewPath(packageId)} data-testid="app-empty-menu-open-studio">
{t('empty.openInStudio', { defaultValue: 'Open in App Studio' })}
</Link>
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ describe('an empty stored menu is said as such, not as missing access (objectsta
expect(status).toHaveAttribute('data-reason', 'empty-menu');
expect(status).toHaveTextContent('has nothing in its menu yet');
expect(status).not.toHaveTextContent(/grant access/i);
expect(screen.getByTestId('app-empty-menu-open-studio')).toHaveAttribute('href', `/studio/${PKG}/data`);
expect(screen.getByTestId('app-empty-menu-open-studio')).toHaveAttribute('href', `/studio/${PKG}/overview`);
expect(screen.queryByTestId('app-no-access-open-setup')).toBeNull();
expect(String(fetchMock.mock.calls[0]?.[0])).toBe(`/api/v1/meta/app/visits/layers?package=${encodeURIComponent(PKG)}`);
});
Expand Down
18 changes: 9 additions & 9 deletions ui/packages/app-shell/src/utils/__tests__/appRoute.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,12 +259,12 @@ describe('isApprovalsInboxLink (objectstack#35505)', () => {
describe('appStudioDesignPath', () => {
const crm = { name: 'crm', _packageId: 'com.acme.crm' };

it('resolves an admin viewing a packaged app to its design surface', () => {
expect(appStudioDesignPath(crm, true)).toBe('/studio/com.acme.crm/data');
it("resolves an admin viewing a packaged app to its package's 概览 Overview (objectstack#38392)", () => {
expect(appStudioDesignPath(crm, true)).toBe('/studio/com.acme.crm/overview');
});
it('URL-encodes the package id', () => {
expect(appStudioDesignPath({ _packageId: 'com.acme/crm' }, true)).toBe(
'/studio/com.acme%2Fcrm/data',
'/studio/com.acme%2Fcrm/overview',
);
});
it('returns null for non-admins', () => {
Expand Down Expand Up @@ -377,16 +377,16 @@ describe('appStudioRoutePath', () => {
);
});

it('falls back to the plain Data tab for the app root and the system area', () => {
// No route type at all (bare /apps/:pkg) → Data tab.
expect(appStudioRoutePath(crm, true, { type: undefined, name: undefined })).toBe('/studio/com.acme.crm/data');
it("falls back to the package's 概览 Overview for the app root and the system area (objectstack#38392)", () => {
// No route type at all (bare /apps/:pkg) → 概览.
expect(appStudioRoutePath(crm, true, { type: undefined, name: undefined })).toBe('/studio/com.acme.crm/overview');
// The system settings area is not an object.
expect(appStudioRoutePath(crm, true, { type: 'system', name: 'members' })).toBe('/studio/com.acme.crm/data');
expect(appStudioRoutePath(crm, true, { type: 'system', name: 'members' })).toBe('/studio/com.acme.crm/overview');
});

it('falls back to the Data tab for an interface list route (no surface name)', () => {
it("falls back to the package's 概览 Overview for an interface list route (no surface name)", () => {
// e.g. /apps/:pkg/page with no specific page selected.
expect(appStudioRoutePath(crm, true, { type: 'page', name: undefined })).toBe('/studio/com.acme.crm/data');
expect(appStudioRoutePath(crm, true, { type: 'page', name: undefined })).toBe('/studio/com.acme.crm/overview');
});

it('returns null for non-admins (bridge hidden), for both surface and Data targets', () => {
Expand Down
17 changes: 9 additions & 8 deletions ui/packages/app-shell/src/utils/appRoute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
* framework-owned, app-independent page for this user (see below).
*/

import { studioHomePath, studioItemPath, studioMetadataItemAddress } from '../views/studio-design/studioAddress.js';
import { studioItemPath, studioMetadataItemAddress } from '../views/studio-design/studioAddress.js';
import { studioPackageOverviewPath } from '../views/studio-design/studioOverviewAddress.js';

/**
* The minimal app shape THESE ROUTE HELPERS read.
Expand Down Expand Up @@ -243,8 +244,8 @@ export function isApprovalsInboxLink(actionUrl: string | null | undefined): bool

/**
* App → Studio reverse bridge (ADR-0080). Resolves a running app to its owning
* package's design surface (`/studio/:packageId/data`), or `null` when there is
* nothing to open:
* package's 概览 Overview (`/studio/:packageId/overview`, where every door into
* a package lands, objectstack#38392), or `null` when there is nothing to open:
* - the viewer is not a workspace admin (designing mutates shared package
* metadata, so the entry point is admin-only — mirrors the runtime editors);
* - the app has no owning package (runtime/DB apps), or its container is the
Expand All @@ -262,7 +263,7 @@ export function appStudioDesignPath(
if (!isWorkspaceAdmin) return null;
const packageId = studioPackageId(app);
if (!packageId) return null;
return studioHomePath(packageId);
return studioPackageOverviewPath(packageId);
}

/**
Expand Down Expand Up @@ -322,8 +323,8 @@ const INTERFACE_SURFACE_ROUTE_TYPES = new Set(['dashboard', 'page', 'report']);
* Console `/apps/:pkg/<type>` route types that are NOT object records — the
* interface surfaces (handled above) plus the `system` settings area. Any other
* route type IS the object name (see `AppHeader`'s breadcrumb switch: the
* `else if (routeType)` branch treats it as an object), so it deep-links the
* Data pillar to that object.
* `else if (routeType)` branch treats it as an object), so it deep-links that
* object's designer ({@link appStudioObjectPath}).
*/
const NON_OBJECT_ROUTE_TYPES = new Set([...INTERFACE_SURFACE_ROUTE_TYPES, 'system']);

Expand All @@ -333,9 +334,9 @@ const NON_OBJECT_ROUTE_TYPES = new Set([...INTERFACE_SURFACE_ROUTE_TYPES, 'syste
* {@link INTERFACE_SURFACE_ROUTE_TYPES}), deep-link straight to THAT item in
* Studio's "All metadata" area via {@link appStudioSurfacePath}. When it names an
* object record page (the route type IS the object name), deep-link that object
* in the Data pillar via {@link appStudioObjectPath}. Otherwise (bare app root,
* in its designer via {@link appStudioObjectPath}. Otherwise (bare app root,
* a `system` route, or an interface list route with no surface name) fall back
* to the package's generic Data tab via {@link appStudioDesignPath}. Returns
* to the package's 概览 Overview via {@link appStudioDesignPath}. Returns
* null when the bridge should not render (non-admin / no owning package).
* Centralizes the route-type → surface-type mapping so `AppHeader` stays
* declarative and the decision is unit-tested here.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ import { CreatePackageDialog } from './PackagesPage';
import { useMetadataClient } from './useMetadata';
import { t, useMetadataLocale } from './i18n';
import { newAppStep } from '../studio-design/newAppDoor';
import { studioHomePath } from '../studio-design/studioAddress';
import { studioPackageOverviewPath } from '../studio-design/studioOverviewAddress';
import { StudioDesignSurface } from '../studio-design/StudioDesignSurface';
import { StudioPillarRedirect } from '../studio-design/StudioPillarRedirect';

Expand Down Expand Up @@ -189,7 +189,7 @@ function NewAppHost() {
open={open}
onOpenChange={setOpen}
newApp={step}
onSaved={(r) => navigate(studioHomePath(r.id))}
onSaved={(r) => navigate(studioPackageOverviewPath(r.id))}
/>
</>
);
Expand Down Expand Up @@ -306,7 +306,7 @@ describe('PackageFormDialog with a new-app step: one confirm creates the package
// (`CreatePackageDialog`) offers 「同时创建应用」, ticked by default.
// ---------------------------------------------------------------------------

/** `CreatePackageDialog` as Setup → Packages mounts it: Studio on the new package after create. */
/** `CreatePackageDialog` as Setup → Packages mounts it: Studio on the new package's 概览 Overview after create (objectstack#38392). */
function CreatePackageHost() {
const navigate = useNavigate();
const [open, setOpen] = React.useState(false);
Expand All @@ -315,7 +315,7 @@ function CreatePackageHost() {
<button type="button" data-testid="open-new-app" onClick={() => setOpen(true)}>
new package
</button>
<CreatePackageDialog open={open} onOpenChange={setOpen} onCreated={(id) => navigate(studioHomePath(id))} />
<CreatePackageDialog open={open} onOpenChange={setOpen} onCreated={(id) => navigate(studioPackageOverviewPath(id))} />
</>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ describe('Setup → Packages: the administration face (objectstack#36834)', () =
// are authoring: not on this face, though the package has a draft.
expect(within(sheet).queryByText(row('engine.packages.detail.pendingChanges'))).toBeNull();
expect(within(sheet).queryByText(row('engine.packages.detail.browseMetadata'))).toBeNull();
expect(within(sheet).getByTestId('pkg-detail-open-in-studio')).toHaveAttribute('href', '/studio/app.b2r4/data');
expect(within(sheet).getByTestId('pkg-detail-open-in-studio')).toHaveAttribute('href', '/studio/app.b2r4/overview');
});

it('CONTROL: the same package on the development surface keeps every authoring action', async () => {
Expand Down Expand Up @@ -737,7 +737,7 @@ describe('Setup → Packages: the administration face (objectstack#36834)', () =
fireEvent.click(screen.getByRole('button', { name: row('engine.packages.new') }));
fireEvent.click(await screen.findByTestId('stub-create-save'));

expect(await screen.findByTestId('where')).toHaveTextContent('/studio/app.fresh/data');
expect(await screen.findByTestId('where')).toHaveTextContent('/studio/app.fresh/overview');
});

it('CONTROL: New Package on the development surface stays on the list', async () => {
Expand Down Expand Up @@ -786,7 +786,7 @@ describe('Setup → Packages: the new-package deep link (objectstack#36908)', ()

// The create lands in Studio on the new package, as New Package does.
fireEvent.click(screen.getByTestId('stub-create-save'));
expect(await screen.findByTestId('where')).toHaveTextContent('/studio/app.fresh/data');
expect(await screen.findByTestId('where')).toHaveTextContent('/studio/app.fresh/overview');
});

it('CONTROL: the face without the param opens no dialog', async () => {
Expand Down Expand Up @@ -821,7 +821,7 @@ describe('Setup → Packages: New Package offers 「同时创建应用」 (objec
const save = await screen.findByTestId('stub-create-save');
expect(save).toHaveAttribute('data-new-app', 'step');
fireEvent.click(save);
expect(await screen.findByTestId('where')).toHaveTextContent('/studio/app.fresh/data');
expect(await screen.findByTestId('where')).toHaveTextContent('/studio/app.fresh/overview');
});

it('the `?new=package` door opens the dialog with the app step', async () => {
Expand Down Expand Up @@ -882,7 +882,7 @@ describe('Setup → Packages: a read-only base’s customizations in its detail
await waitFor(() =>
expect(within(section).getByTestId('pkg-detail-customizations-summary')).toHaveTextContent('0 customized, 1 rearranged, 0 switched off'),
);
expect(within(section).getByTestId('pkg-detail-customize')).toHaveAttribute('href', '/studio/com.acme.code/data');
expect(within(section).getByTestId('pkg-detail-customize')).toHaveAttribute('href', '/studio/com.acme.code/overview');
});

it('an authored package’s detail draws no customizations section: it is changed in place', async () => {
Expand Down
16 changes: 5 additions & 11 deletions ui/packages/app-shell/src/views/metadata-admin/PackagesPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ import { useProtocolCheckSkippedText } from '../../console/marketplace/protocolC
import { ProtocolCheckSkippedNote } from '../../console/marketplace/ProtocolCheckSkippedNote.js';
import type { InstalledPackageAtEitherStage } from '@objectstack/spec/api-assembled';
import type { PackagePublishResult } from '@objectstack/spec/system';
import { studioHomePath } from '../studio-design/studioAddress.js';
import { studioPackageOverviewPath } from '../studio-design/studioOverviewAddress.js';
import { LooseItemsBanner } from './LooseItemsBanner.js';
import { PackageCustomizationsPanel } from '../studio-design/PackageCustomizationsPanel.js';
import { isCustomizationPackage } from '@objectstack/spec/kernel';
Expand Down Expand Up @@ -591,13 +591,6 @@ function InstalledAppUpdateCell({ rowId, read }: { rowId: string; read: UpdateRe
);
}

/**
* A package's Studio address: the builder on the package's Data pillar. The
* administration face's create lands here, and its "Open in Studio" link
* points here (objectstack#36834).
*/
const studioPackagePath = (packageId: string) => studioHomePath(packageId);

/* -------------------------------------------------------------------------- */
/* Create-package dialog */
/* -------------------------------------------------------------------------- */
Expand Down Expand Up @@ -1175,7 +1168,7 @@ export function PackageDetailSheet({
<>
<Separator className="my-4" />
<Link
to={studioPackagePath(id)}
to={studioPackageOverviewPath(id)}
className="inline-flex items-center gap-1.5 text-sm text-primary hover:underline"
onClick={() => onOpenChange(false)}
data-testid="pkg-detail-open-in-studio"
Expand Down Expand Up @@ -2372,12 +2365,13 @@ export function PackagesPage() {
onOpenChange={setCreateOpen}
onCreated={async (id) => {
// objectstack#36834 — created from Setup, the empty package is
// designed next: straight into Studio on it, on its Data pillar.
// designed next: straight into Studio on it, on its 概览 Overview,
// where every door into a package lands (objectstack#38392).
// The development surface stays
// where it is and shows the new row.
if (adminFace) {
forgetPackageListReads();
navigate(studioPackagePath(id));
navigate(studioPackageOverviewPath(id));
return;
}
await load();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ describe('Setup → Packages: an installed app’s customizations (objectstack#3
stubWire(200, served({ extensions: [{ object: 'account', kind: 'field', name: 'region' }] }));
const { onNavigate } = renderPanel();

expect(screen.getByTestId('pkg-detail-customize')).toHaveAttribute('href', `/studio/${APP}/data`);
expect(screen.getByTestId('pkg-detail-customize')).toHaveAttribute('href', `/studio/${APP}/overview`);
await waitFor(() => expect(rows()).toHaveLength(1));
fireEvent.click(within(rows()[0]).getByRole('link'));
expect(await screen.findByTestId('where')).toHaveTextContent(`/studio/${APP}/metadata/object/account`);
Expand Down
Loading
Loading