From 366c86328e5a95e14104c950b3ffe5cbfd975948 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 17 Nov 2026 08:35:09 +0000 Subject: [PATCH 1/8] wip(ui): Studio landing ordered by task (#34715) Claude-Session: https://claude.ai/code/session_01WGufzivEnnozveqZfr4fDx Co-authored-by: Claude --- ...lderLanding.accessibleNames-12510.test.tsx | 20 +- ...Landing.customizationCounts-28566.test.tsx | 23 +- ...uilderLanding.customizeCopy-29489.test.tsx | 27 +- ...nding.environmentOverlayCopy-12171.test.ts | 48 +-- .../BuilderLanding.orgScope-11553.test.tsx | 58 +++- ...ilderLanding.recentPackages-11863.test.tsx | 6 +- .../BuilderLanding.taskOrder-34715.test.tsx | 180 +++++++++++ .../views/studio-design/BuilderLanding.tsx | 299 +++++++++++------- ui/packages/i18n/src/namespaces/studio/en.ts | 16 + ui/packages/i18n/src/namespaces/studio/zh.ts | 15 + 10 files changed, 509 insertions(+), 183 deletions(-) create mode 100644 ui/packages/app-shell/src/views/studio-design/BuilderLanding.taskOrder-34715.test.tsx diff --git a/ui/packages/app-shell/src/views/studio-design/BuilderLanding.accessibleNames-12510.test.tsx b/ui/packages/app-shell/src/views/studio-design/BuilderLanding.accessibleNames-12510.test.tsx index cf8807a7daa..b2956be5dbb 100644 --- a/ui/packages/app-shell/src/views/studio-design/BuilderLanding.accessibleNames-12510.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/BuilderLanding.accessibleNames-12510.test.tsx @@ -5,8 +5,8 @@ * author sees on it (objectui#11862: label first). * * The 2026-10-15 test pass read the recent-package links, the writable and - * installed package cards, and the "Organization flows" card as controls with - * no name. The browser's computed tree names each one from its visible text; + * installed package cards, and the package-less flows card (now "Flows in no + * app", objectstack#34715) as controls with no name. The browser's computed tree names each one from its visible text; * these cases pin that by querying each card by role and name, so a later * restyle that hides the text from the tree (an `aria-hidden` on the label, an * icon-only card) turns them red. @@ -40,6 +40,11 @@ vi.mock('../metadata-admin/PackageFormDialog', () => ({ PackageFormDialog: () => vi.mock('./packageCustomizations-io', () => ({ fetchPackageCustomizationCounts: vi.fn(() => new Promise(() => {})), })); +// One flow belongs to no package, so the landing draws that entry (objectstack#34715). +vi.mock('./packageSurfaces', async (importOriginal) => { + const mod = await importOriginal(); + return { ...mod, loadPackageLessSurfaces: vi.fn(async () => [{ type: 'flow', name: 'org_flow', label: 'Org flow' }]) }; +}); import { BuilderLanding } from './BuilderLanding'; import { RecentItemsProvider } from '../../context/RecentItemsProvider'; @@ -90,11 +95,12 @@ describe('Studio home cards carry their visible label as their name (objectui#12 // The writable card: its label leads the name; the api name follows it. expect(screen.getByRole('button', { name: /^Acme CRM\b/ })).toBeInTheDocument(); - // The installed (read-only) card. - expect(screen.getByRole('button', { name: /^HotCRM\b.*Read-only/ })).toBeInTheDocument(); - // The organization's flows. - expect(screen.getByTestId('studio-landing-org-scope')).toHaveAccessibleName(/^Organization flows/); - expect(screen.getByRole('button', { name: /^New package/ })).toBeInTheDocument(); + // The installed (read-only) card: its label, and its Customize button named for it. + expect(screen.getByRole('button', { name: 'HotCRM' })).toBeInTheDocument(); + expect(screen.getByRole('button', { name: 'Customize HotCRM' })).toBeInTheDocument(); + // The flows that belong to no package. + expect(await screen.findByTestId('studio-landing-org-scope')).toHaveAccessibleName(/^Flows in no app/); + expect(screen.getByRole('button', { name: /^New app of your own/ })).toBeInTheDocument(); // No button or link on the page is left without a name. const unnamed = [...screen.getAllByRole('button'), ...screen.getAllByRole('link')].filter( diff --git a/ui/packages/app-shell/src/views/studio-design/BuilderLanding.customizationCounts-28566.test.tsx b/ui/packages/app-shell/src/views/studio-design/BuilderLanding.customizationCounts-28566.test.tsx index 046171f047d..23b438e9bd7 100644 --- a/ui/packages/app-shell/src/views/studio-design/BuilderLanding.customizationCounts-28566.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/BuilderLanding.customizationCounts-28566.test.tsx @@ -138,14 +138,27 @@ describe('Studio landing: a read-only base says "n customized, m switched off" ( expect(customizationRequests(requested)).toEqual(['/api/v1/packages/hotcrm/customizations']); }); - it('reads a base with no pair as "0 customized, 0 switched off", with no pair link', async () => { + it('reads a base with nothing changed as "No changes yet", with no number and no link (objectstack#34715)', async () => { packages.list = [SHOWCASE]; stubWire({ 'com.example.showcase': served('com.example.showcase', 0, 0, 0) }); renderLanding(); const line = await within(await waitFor(() => cardOf('Showcase'))).findByTestId('studio-landing-customizations'); await waitFor(() => expect(line).toHaveAttribute('data-state', 'read')); - expect(line).toHaveTextContent('0 customized, 0 switched off'); + expect(line).toHaveAttribute('data-changes', 'none'); + expect(line).toHaveTextContent(t('engine.studio.landing.customizations.none', 'en-US')); + expect(line.textContent).not.toMatch(/\d/); + expect(within(line).queryByRole('link')).not.toBeInTheDocument(); + }); + + it('reads a base with no pair and one switched-off item as "0 customized, 1 switched off", with no pair link', async () => { + packages.list = [SHOWCASE]; + stubWire({ 'com.example.showcase': served('com.example.showcase', 0, 0, 1) }); + renderLanding(); + + const line = await within(await waitFor(() => cardOf('Showcase'))).findByTestId('studio-landing-customizations'); + await waitFor(() => expect(line).toHaveAttribute('data-state', 'read')); + expect(line).toHaveTextContent('0 customized, 1 switched off'); expect(within(line).queryByTestId('studio-landing-customizations-pair')).not.toBeInTheDocument(); expect(within(line).getByText(customizedText(0))).not.toHaveAttribute('href'); expect(within(line).getByTestId('studio-landing-customizations-switched-off')).toHaveAttribute( @@ -220,9 +233,9 @@ describe('Studio landing: a read-only base says "n customized, m switched off" ( * line and link. The pair's export and delete stay on the Packages page. */ describe('Studio landing: a base’s .custom pair has no card of its own (ADR-0146 D3)', () => { - /** Every package card the landing draws, by the id line each card shows. */ + /** Every package card the landing draws, by the package id each card carries. */ const cardIds = () => - Array.from(document.querySelectorAll('.rounded-lg.border .font-mono')).map((el) => el.textContent); + Array.from(document.querySelectorAll('[data-package-id]')).map((el) => el.getAttribute('data-package-id')); it('draws one card for a base and its writable pair: the base’s, with its customized count and the pair link', async () => { packages.list = [HOTCRM, HOTCRM_PAIR, WRITABLE]; @@ -238,7 +251,7 @@ describe('Studio landing: a base’s .custom pair has no card of its own (ADR-01 expect(screen.queryByText('HotCRM customizations')).not.toBeInTheDocument(); expect(cardIds()).not.toContain('hotcrm.custom'); // CONTROL: a writable package that is no pair keeps its card. - expect(cardIds()).toEqual(['com.acme.app', 'hotcrm']); + expect(cardIds()).toEqual(['hotcrm', 'com.acme.app']); }); it('folds a read-only pair under its listed base too', async () => { diff --git a/ui/packages/app-shell/src/views/studio-design/BuilderLanding.customizeCopy-29489.test.tsx b/ui/packages/app-shell/src/views/studio-design/BuilderLanding.customizeCopy-29489.test.tsx index 717e4569a6d..13021aebf95 100644 --- a/ui/packages/app-shell/src/views/studio-design/BuilderLanding.customizeCopy-29489.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/BuilderLanding.customizeCopy-29489.test.tsx @@ -7,12 +7,13 @@ * A package-less write onto an item a read-only package ships answers 403 * NOT_OVERRIDABLE and names the base's `.custom` pair. The landing's page * description and its read-only section hint used to send the user there - * ("customize them with an environment overlay"). They now name Customize and - * New similar, saved in the package's `.custom` customization package. + * ("customize them with an environment overlay"). objectstack#34715 then + * reworded both to say what the author can do, naming no mechanism: the open + * route is the Customize button each installed app's card carries. * * Read off the real `BuilderLanding`, rendered in English and in Chinese with a * read-only package listed, so both strings are on the page. The expected - * words are the tables' own: the Customize and New similar action labels. + * words are the tables' own: the Customize action label. */ import '@testing-library/jest-dom/vitest'; @@ -96,30 +97,20 @@ function descriptionElement(): HTMLElement { return description; } -describe('Studio landing: a read-only package is customized in its .custom package (objectstack#29489)', () => { +describe('Studio landing: a read-only package is customized through its Customize button, never an overlay (objectstack#29489)', () => { for (const [locale, lang] of LOCALES) { - it(`${locale}: the description and the read-only hint name Customize, New similar and the .custom package, never an overlay`, async () => { + it(`${locale}: the description and the installed-apps hint offer no overlay, and the card carries Customize`, async () => { await renderLanding(lang); await screen.findByText('Showcase'); - const customize = row('engine.studio.customize.action', locale); - const newSimilar = row('engine.studio.auto.newSimilar.action', locale); const shown = [ descriptionElement().textContent ?? '', screen.getByTestId('studio-landing-readonly-hint').textContent ?? '', ]; + expect(shown).toEqual([row('engine.studio.landing.lead', locale), row('engine.studio.landing.appsHint', locale)]); + for (const text of shown) expect(text).not.toMatch(ENVIRONMENT_OVERLAY); - // The rendered text is the table's row, so the landing reads these keys. - expect(shown).toEqual([ - row('engine.studio.landing.description', locale), - row('engine.studio.landing.readonlyHint', locale), - ]); - for (const text of shown) { - expect(text).not.toMatch(ENVIRONMENT_OVERLAY); - expect(text).toContain('.custom'); - expect(text).toContain(customize); - expect(text).toContain(newSimilar); - } + expect(screen.getByTestId('studio-landing-customize')).toHaveTextContent(row('engine.studio.customize.action', locale)); }); } }); diff --git a/ui/packages/app-shell/src/views/studio-design/BuilderLanding.environmentOverlayCopy-12171.test.ts b/ui/packages/app-shell/src/views/studio-design/BuilderLanding.environmentOverlayCopy-12171.test.ts index 4f95d75ba2e..e68f2b79120 100644 --- a/ui/packages/app-shell/src/views/studio-design/BuilderLanding.environmentOverlayCopy-12171.test.ts +++ b/ui/packages/app-shell/src/views/studio-design/BuilderLanding.environmentOverlayCopy-12171.test.ts @@ -16,8 +16,11 @@ * objectstack ADR-0146 D11 then closed the package-less write onto a packaged * item (403 NOT_OVERRIDABLE, naming the base's `.custom` pair). The landing's * two strings now teach the route that is open: Customize or New similar, - * saved in the package's `.custom` customization package. The permission hint - * still names the environment overlay, because it says that overlay is refused. + * saved in the package's `.custom` customization package. objectstack#34715 + * then replaced the two strings the landing renders with ones that say what + * the author can do and name no mechanism, the `.custom` package included. + * The permission hint still names the environment overlay, because it says + * that overlay is refused. * * ## The population * @@ -30,10 +33,8 @@ * * 1. No value of these keys, in any table that carries them, names the * organization axis. - * 2. No landing value names the environment overlay, and every landing value - * names the route that exists: the `.custom` package and the table's own - * Customize label, read from the same table, so the check speaks every - * language a table is written in. + * 2. No landing value names the environment overlay or the `.custom` + * package. * 3. Lit control on the matchers: the permission hint names the environment * overlay in every table. A table in a language neither pattern speaks * fails here, so pins 1 and 2 cannot pass on it by matching nothing. @@ -60,20 +61,18 @@ const readTables: (root: string) => Map> = readDesig const REPO_ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../../../..'); /** - * The two strings `BuilderLanding` renders about a read-only package. The third - * landing string, the overlay link's tooltip, retired with the link: the - * landing no longer links into Setup (objectstack ADR-0146 D1, N-28). + * The two strings `BuilderLanding` renders about installed apps: the page's + * lead and the installed-apps hint (objectstack#34715). The overlay link's + * tooltip retired with the link: the landing no longer links into Setup + * (objectstack ADR-0146 D1, N-28). */ -const LANDING_KEYS = ['engine.studio.landing.description', 'engine.studio.landing.readonlyHint'] as const; +const LANDING_KEYS = ['engine.studio.landing.lead', 'engine.studio.landing.appsHint'] as const; /** The hint `PermissionMatrixEditor` shows on a set a code package ships: it names the overlay it refuses. */ const PERMISSION_HINT = 'perm.readOnly.artifact.hint'; const KEYS = [...LANDING_KEYS, PERMISSION_HINT] as const; -/** The Customize action's own label, read from each table beside the landing strings. */ -const CUSTOMIZE_ACTION = 'engine.studio.customize.action'; - /** The customization package a read-only package is paired with (objectstack ADR-0146 D3). */ const CUSTOM_PAIR = /\.custom\b/u; @@ -94,7 +93,7 @@ function tablesCarryingKeys(): Array<[string, Map]> { return [...readTables(REPO_ROOT)].filter(([, table]) => KEYS.some((key) => table.has(key))); } -describe('the read-only copy names no organization axis, and the landing offers no overlay (objectui#12171, objectstack#29489)', () => { +describe('the read-only copy names no organization axis, and the landing offers no overlay (objectui#12171, objectstack#29489, objectstack#34715)', () => { it('reads the tables t() serves', () => { const read = tablesCarryingKeys(); for (const locale of Object.keys(DECLARED_LOCALES)) { @@ -121,24 +120,25 @@ describe('the read-only copy names no organization axis, and the landing offers expect(offenders).toEqual([]); }); - it('no landing value offers the environment overlay; each names Customize and the .custom package', () => { + it('no landing value offers the environment overlay or names the .custom package', () => { const offenders: string[] = []; for (const [name, table] of tablesCarryingKeys()) { - const customize = table.get(CUSTOMIZE_ACTION); - if (!customize) { - offenders.push(`${name} ${CUSTOMIZE_ACTION}: missing`); - continue; - } for (const key of LANDING_KEYS) { - const value = table.get(key) ?? ''; - if (ENVIRONMENT_OVERLAY.test(value)) offenders.push(`${name} ${key} offers the overlay: ${value}`); - if (!CUSTOM_PAIR.test(value)) offenders.push(`${name} ${key} names no .custom package: ${value}`); - if (!value.includes(customize)) offenders.push(`${name} ${key} names no "${customize}": ${value}`); + const value = table.get(key); + if (value === undefined) offenders.push(`${name} ${key}: missing`); + else if (ENVIRONMENT_OVERLAY.test(value)) offenders.push(`${name} ${key} offers the overlay: ${value}`); + else if (CUSTOM_PAIR.test(value)) offenders.push(`${name} ${key} names the .custom package: ${value}`); } } expect(offenders).toEqual([]); }); + it('lit control: the mechanism pattern matches the retired landing copy it now keeps off the page', () => { + const retired = tablesCarryingKeys().map(([, table]) => table.get('engine.studio.landing.readonlyHint')); + expect(retired.filter((value) => value !== undefined).length).toBeGreaterThan(0); + for (const value of retired) if (value !== undefined) expect(value).toMatch(CUSTOM_PAIR); + }); + it('lit control: the permission hint names the environment overlay in every table', () => { const silent: string[] = []; for (const [name, table] of tablesCarryingKeys()) { diff --git a/ui/packages/app-shell/src/views/studio-design/BuilderLanding.orgScope-11553.test.tsx b/ui/packages/app-shell/src/views/studio-design/BuilderLanding.orgScope-11553.test.tsx index cdbaa43e13e..b2780273b68 100644 --- a/ui/packages/app-shell/src/views/studio-design/BuilderLanding.orgScope-11553.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/BuilderLanding.orgScope-11553.test.tsx @@ -7,7 +7,9 @@ * its only entry was the read-only showcase package, whose Automations rail * lists packaged flows and not the clone. A package-less flow matches no * package card, so the home carries an entry of its own for them, and it is - * there whether or not a writable package exists. + * there whether or not a writable package exists. objectstack#34715: it is + * named "Flows in no app", carries how many there are, and is drawn only when + * there is at least one; a failed count still draws it, with no number. */ import '@testing-library/jest-dom/vitest'; @@ -19,6 +21,8 @@ import { cleanup, fireEvent, render, screen, waitFor } from '@testing-library/re import { MemoryRouter, Route, Routes, useLocation } from 'react-router-dom'; const packages = vi.hoisted(() => ({ list: [] as Array> })); +// The package-less flows the landing counts: an answer of N rows, or a failed read. +const packageLess = vi.hoisted(() => ({ answer: 1 as number | 'failed' })); vi.mock('./packages-io', async (importOriginal) => { const mod = await importOriginal(); @@ -39,11 +43,25 @@ vi.mock('./packageCustomizations-io', () => ({ fetchPackageCustomizationCounts: vi.fn(() => new Promise(() => {})), })); +vi.mock('./packageSurfaces', async (importOriginal) => { + const mod = await importOriginal(); + return { + ...mod, + loadPackageLessSurfaces: vi.fn(async () => { + if (packageLess.answer === 'failed') throw new Error('HTTP 503'); + return Array.from({ length: packageLess.answer }, (_, i) => ({ type: 'flow', name: `org_flow_${i}`, label: `Org flow ${i}` })); + }), + }; +}); + import { BuilderLanding } from './BuilderLanding'; +import { loadPackageLessSurfaces } from './packageSurfaces'; afterEach(() => { cleanup(); packages.list = []; + packageLess.answer = 1; + vi.mocked(loadPackageLessSurfaces).mockClear(); }); function LocationProbe() { @@ -64,14 +82,17 @@ function renderLanding() { } describe('Studio home → the package-less scope (objectui#11553)', () => { - it('offers the entry on the measured shape: no writable package, one read-only package', async () => { + it('offers the entry, with its count, on the measured shape: no writable package, one read-only package', async () => { packages.list = [{ id: 'com.example.showcase', name: 'Showcase', writable: false, namespace: 'showcase' }]; + packageLess.answer = 2; renderLanding(); - await screen.findByText('No writable packages yet — create one to start.'); - const entry = screen.getByTestId('studio-landing-org-scope'); - expect(entry).toHaveTextContent('Organization flows'); - expect(screen.getByText('Not in a package')).toBeInTheDocument(); + const entry = await screen.findByTestId('studio-landing-org-scope'); + expect(entry).toHaveTextContent('Flows in no app'); + expect(screen.getByTestId('studio-landing-org-scope-count')).toHaveTextContent('2'); + expect(screen.getByText('Outside any app')).toBeInTheDocument(); + // The count is the scope's own union: one unscoped read of flows. + expect(vi.mocked(loadPackageLessSurfaces)).toHaveBeenCalledWith(expect.anything(), 'flow', expect.any(String)); fireEvent.click(entry); await waitFor(() => expect(screen.getByTestId('location')).toHaveTextContent('/studio/~org/automations')); @@ -83,9 +104,32 @@ describe('Studio home → the package-less scope (objectui#11553)', () => { renderLanding(); await screen.findByText('Acme'); - expect(screen.getByTestId('studio-landing-org-scope')).toBeInTheDocument(); + expect(await screen.findByTestId('studio-landing-org-scope')).toBeInTheDocument(); fireEvent.click(screen.getByText('Acme')); await waitFor(() => expect(screen.getByTestId('location')).toHaveTextContent('/studio/com.acme.app/data')); }); + + it('draws no entry when no flow belongs to no package (objectstack#34715)', async () => { + packages.list = [{ id: 'com.example.showcase', name: 'Showcase', writable: false, namespace: 'showcase' }]; + packageLess.answer = 0; + renderLanding(); + + await screen.findByText('Showcase'); + await waitFor(() => expect(vi.mocked(loadPackageLessSurfaces)).toHaveBeenCalled()); + // CONTROL: the section the entry sits in is drawn, with its other entry. + expect(screen.getByTestId('studio-landing-env-catalog')).toBeInTheDocument(); + expect(screen.queryByTestId('studio-landing-org-scope')).not.toBeInTheDocument(); + expect(screen.queryByText('Flows in no app')).not.toBeInTheDocument(); + }); + + it('a failed count still draws the entry, with no number: unknown is not zero', async () => { + packages.list = []; + packageLess.answer = 'failed'; + renderLanding(); + + const entry = await screen.findByTestId('studio-landing-org-scope'); + expect(entry).toHaveTextContent('Flows in no app'); + expect(screen.queryByTestId('studio-landing-org-scope-count')).not.toBeInTheDocument(); + }); }); diff --git a/ui/packages/app-shell/src/views/studio-design/BuilderLanding.recentPackages-11863.test.tsx b/ui/packages/app-shell/src/views/studio-design/BuilderLanding.recentPackages-11863.test.tsx index fdb8e6044c5..2e58a7d02ad 100644 --- a/ui/packages/app-shell/src/views/studio-design/BuilderLanding.recentPackages-11863.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/BuilderLanding.recentPackages-11863.test.tsx @@ -189,8 +189,8 @@ describe('Studio landing → recent packages (objectui#11863)', () => { await screen.findByText('Acme CRM'); expect(screen.queryByTestId('studio-landing-recent')).not.toBeInTheDocument(); expect(screen.queryByText('Recently viewed')).not.toBeInTheDocument(); - expect(screen.getByText('My packages (writable)')).toBeInTheDocument(); - expect(screen.getByTestId('studio-landing-org-scope')).toBeInTheDocument(); + expect(screen.getByText('Your own apps')).toBeInTheDocument(); + expect(screen.getByTestId('studio-landing-env-catalog')).toBeInTheDocument(); }); it('the package cards stay beside the recent row', async () => { @@ -200,7 +200,7 @@ describe('Studio landing → recent packages (objectui#11863)', () => { await screen.findByText('Recently viewed'); // Once in the recent row, once as its writable card. expect(screen.getAllByText('Acme CRM')).toHaveLength(2); - expect(screen.getByText('My packages (writable)')).toBeInTheDocument(); + expect(screen.getByText('Your own apps')).toBeInTheDocument(); }); }); diff --git a/ui/packages/app-shell/src/views/studio-design/BuilderLanding.taskOrder-34715.test.tsx b/ui/packages/app-shell/src/views/studio-design/BuilderLanding.taskOrder-34715.test.tsx new file mode 100644 index 00000000000..ce2bfd46c6b --- /dev/null +++ b/ui/packages/app-shell/src/views/studio-design/BuilderLanding.taskOrder-34715.test.tsx @@ -0,0 +1,180 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +/** + * objectstack#34715 — the Studio landing is ordered by what the author came to + * do, and its copy names no package mechanism. + * + * The installed apps lead (changing one is the likeliest errand), the + * author's own apps and the create card follow, and the entries that belong + * to no app come last. An installed app's card carries a Customize button that + * opens it the way the card does, says "No changes yet" when nothing is + * changed, and shows no package id on its face. In Chinese the page body + * carries none of 「.custom」「基座」「只读」; in English none of ".custom", + * "read-only", "writable base". + * + * Read off the real `BuilderLanding` under a real router, in English and in + * Chinese; the package list, the customization read and the package-less flow + * count are answered by doubles, so no request leaves the file. + */ + +import '@testing-library/jest-dom/vitest'; +// The source under test reaches `import('@objectstack/lint')`: paid here, at collection, never inside a test's clock. +import '@objectstack/lint'; +import * as React from 'react'; +import { afterEach, describe, expect, it, vi } from 'vitest'; +import { cleanup, fireEvent, render, screen, waitFor, within } from '@testing-library/react'; +import { MemoryRouter, Route, Routes, useLocation } from 'react-router-dom'; +import { I18nProvider, createI18n } from '@object-ui/i18n'; +import { loadStudioCatalogue } from '@object-ui/i18n/namespaces/studio'; +await loadStudioCatalogue('zh'); + +const packages = vi.hoisted(() => ({ list: [] as Array> })); +const counts = vi.hoisted(() => ({ byId: {} as Record })); + +vi.mock('./packages-io', async (importOriginal) => { + const mod = await importOriginal(); + return { + ...mod, + fetchPackages: vi.fn(async () => packages.list), + fetchListedPackageIds: vi.fn(async () => new Set(packages.list.map((p) => String(p.id)))), + }; +}); +vi.mock('../metadata-admin/PackageFormDialog', () => ({ PackageFormDialog: () => null })); +vi.mock('./packageCustomizations-io', () => ({ + fetchPackageCustomizationCounts: vi.fn(async (id: string) => counts.byId[id] ?? { customized: 0, switchedOff: 0 }), +})); +vi.mock('./packageSurfaces', async (importOriginal) => { + const mod = await importOriginal(); + return { + ...mod, + loadPackageLessSurfaces: vi.fn(async () => [ + { type: 'flow', name: 'org_flow_a', label: 'Org flow A' }, + { type: 'flow', name: 'org_flow_b', label: 'Org flow B' }, + ]), + }; +}); + +import { BuilderLanding } from './BuilderLanding'; + +const HOTCRM = { id: 'app.objectstack.hotcrm', name: 'HotCRM', writable: false, namespace: 'crm' }; +const SERVICE = { id: 'app.objectstack.service', name: 'HotCRM Service', writable: false, namespace: 'svc' }; +const OWN = { id: 'com.acme.app', name: 'Acme', writable: true, namespace: 'acme' }; + +afterEach(() => { + cleanup(); + packages.list = []; + counts.byId = {}; +}); + +function LocationProbe() { + const { pathname } = useLocation(); + return
{pathname}
; +} + +function renderLanding(lang: 'en' | 'zh' = 'en') { + const landing = ( + + + + } /> + } /> + + + ); + if (lang === 'en') return render(landing); + const zh = createI18n({ defaultLanguage: 'zh', detectBrowserLanguage: false, resources: { zh: {} } }); + return render({landing}); +} + +/** The landing's body: every rendered word, the location probe left out. */ +function bodyText(): string { + const probe = screen.getByTestId('location'); + return (document.body.textContent ?? '').replace(probe.textContent ?? '', ''); +} + +/** Section headings in page order. */ +const headings = () => screen.getAllByRole('heading', { level: 2 }).map((h) => h.textContent); + +describe('Studio landing: ordered by what the author came to do (objectstack#34715)', () => { + it('installed apps come first, then the author’s own apps, then the entries outside any app', async () => { + packages.list = [OWN, HOTCRM, SERVICE]; + renderLanding(); + + await screen.findByText('HotCRM'); + expect(headings()).toEqual(['Installed apps', 'Your own apps', 'Outside any app']); + const installed = screen.getByTestId('studio-landing-installed'); + // DOM order: each installed card precedes the author's own card. + const own = screen.getByTestId('studio-landing-own'); + expect(installed.compareDocumentPosition(own) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy(); + expect(within(own).getByText('Acme')).toBeInTheDocument(); + expect(within(own).getByTestId('studio-landing-new-app')).toHaveTextContent('New app of your own'); + }); + + it('every installed card carries Customize, which opens the app the way the card does', async () => { + packages.list = [HOTCRM, SERVICE]; + renderLanding(); + + await screen.findByText('HotCRM'); + expect(screen.getAllByTestId('studio-landing-customize')).toHaveLength(2); + + fireEvent.click(screen.getByRole('button', { name: 'Customize HotCRM' })); + await waitFor(() => expect(screen.getByTestId('location')).toHaveTextContent('/studio/app.objectstack.hotcrm/data')); + expect(screen.getByTestId('pillar-builder')).toBeInTheDocument(); + }); + + it('an installed card shows no package id on its face, and says "No changes yet" when nothing is changed', async () => { + packages.list = [HOTCRM, SERVICE]; + counts.byId = { 'app.objectstack.hotcrm': { customized: 6, switchedOff: 1 } }; + renderLanding(); + + const installed = await screen.findByTestId('studio-landing-installed'); + await waitFor(() => + expect(within(installed).getAllByTestId('studio-landing-customizations').map((l) => l.textContent)).toEqual([ + '6 customized, 1 switched off', + 'No changes yet', + ]), + ); + expect(installed.textContent).not.toContain('app.objectstack'); + // The id is still there to read, in the card's title. + expect(installed.querySelector('[data-package-id="app.objectstack.hotcrm"]')).toHaveAttribute( + 'title', + 'app.objectstack.hotcrm', + ); + }); + + it('positions and permissions keep their Studio entry under the new name', async () => { + packages.list = [HOTCRM]; + renderLanding(); + + const entry = await screen.findByTestId('studio-landing-env-catalog'); + expect(entry).toHaveTextContent('Positions and permissions'); + fireEvent.click(entry); + await waitFor(() => expect(screen.getByTestId('location')).toHaveTextContent(/^\/studio\/[^/]+\/metadata$/)); + }); + + it('en-US: the body names no mechanism — no ".custom", "read-only" or "writable base"', async () => { + packages.list = [OWN, HOTCRM, SERVICE]; + renderLanding('en'); + + await screen.findByTestId('studio-landing-org-scope'); + const text = bodyText(); + // CONTROL: the body was read after the cards and both entries drew. + expect(text).toContain('HotCRM Service'); + expect(text).toContain('Flows in no app'); + expect(text).not.toMatch(/\.custom|read-only|writable base/iu); + }); + + it('zh-CN: the body carries none of 「.custom」「基座」「只读」, and installed apps lead', async () => { + packages.list = [OWN, HOTCRM, SERVICE]; + renderLanding('zh'); + + await screen.findByTestId('studio-landing-org-scope'); + expect(headings()[0]).toBe('已安装的应用'); + expect(screen.getAllByTestId('studio-landing-customize')[0]).toHaveTextContent('定制'); + expect(screen.getByTestId('studio-landing-org-scope')).toHaveTextContent('未归属的流程2'); + expect(screen.getByTestId('studio-landing-env-catalog')).toHaveTextContent('岗位与权限'); + const text = bodyText(); + expect(text).toContain('HotCRM Service'); + for (const word of ['.custom', '基座', '只读']) expect(text).not.toContain(word); + }); +}); diff --git a/ui/packages/app-shell/src/views/studio-design/BuilderLanding.tsx b/ui/packages/app-shell/src/views/studio-design/BuilderLanding.tsx index f2d50fb5394..c25d2102090 100644 --- a/ui/packages/app-shell/src/views/studio-design/BuilderLanding.tsx +++ b/ui/packages/app-shell/src/views/studio-design/BuilderLanding.tsx @@ -4,25 +4,30 @@ * BuilderLanding — the application builder's front door. * * The journey from login: Home → Studio app → the App Builder landing (this page, embedded - * in the app chrome via the `studio:builder` component ref) → pick or create a - * writable base package → the full-screen pillar builder - * (`/studio/:packageId/:tab`). Also served standalone at bare `/studio` so the + * in the app chrome via the `studio:builder` component ref) → pick an installed app to + * customize, or create or open an app of the author's own → the full-screen pillar + * builder (`/studio/:packageId/:tab`). Also served standalone at bare `/studio` so the * builder is bookmarkable. * - * The packages the author was last in lead, when there are any (objectui#11863). - * Writable bases (where authoring happens) follow; the organization's own - * package-less flows have one entry of their own (objectui#11553); read-only - * code and installed packages are listed last: they open for browsing, and each - * card points at the routes that customize one (objectui#11808). Writability is - * the server's verdict read by packages-io (`PkgEntry.writable`, ADR-0070 D2), - * and the server's write gate stays the authority. Each read-only base's card - * says what this deployment changed on it, "n customized, m switched off" - * (ADR-0146 D3), from the server's per-package customization read. + * The page is ordered by what the author came to do (objectstack#34715). The + * packages the author was last in lead, when there are any (objectui#11863). + * Installed apps come first after them, because changing one is the likeliest + * errand: each card says what this deployment changed on it, "n customized, + * m switched off" (ADR-0146 D3), from the server's per-package customization + * read, and carries a Customize button that opens the app in Studio, where its + * items are customized (objectui#11808). The author's own writable bases, with + * the create card, follow. Last come the entries that belong to no app: the + * environment's positions and permissions (the "All metadata" area's + * cross-package leg, ADR-0146 D1 keeps it in Studio), and the organization's + * package-less flows (objectui#11553), shown only when there are any. + * Writability is the server's verdict read by packages-io (`PkgEntry.writable`, + * ADR-0070 D2), and the server's write gate stays the authority. The page's + * copy says what the author can do; it names no package mechanism. */ import * as React from 'react'; import { Link, useNavigate, useSearchParams } from 'react-router-dom'; -import { Boxes, Building2, Clock, Hammer, Library, Lock, Plus, Loader2, Copy, Store } from 'lucide-react'; +import { Boxes, Building2, Clock, Hammer, Library, Plus, Loader2, Copy, Store } from 'lucide-react'; import { toast } from 'sonner'; import { useRecentItems, type RecentNamedItem } from '../../context/RecentItemsProvider.js'; import { useRecentItemLabel } from '../../hooks/useRecentItemLabel.js'; @@ -37,6 +42,8 @@ import { studioOrgScopePath } from './studioScope.js'; import { STUDIO_ALL_PACKAGES_SEGMENT, studioMetadataAreaPath } from './metadataArea.js'; import { STUDIO_NEW_PARAM, STUDIO_NEW_PACKAGE_VALUE } from './studioNewPackage.js'; import { foldCustomizationPairs } from './StudioRailCustomizations.js'; +import { loadPackageLessSurfaces } from './packageSurfaces.js'; +import { useMetadataClient } from '../metadata-admin/useMetadata.js'; /** * objectui#11808 — where a read-only package's card sends the author beyond @@ -172,6 +179,30 @@ export function BuilderLanding(): React.ReactElement { cancelled = true; }; }, [customizationTargetKey]); + // objectui#11553 — how many flows belong to no package: the same published + // and draft union the package-less scope lists (`loadPackageLessSurfaces`). + // The entry is drawn once the read says there is at least one; a failed read + // draws it with no number, so the scope stays reachable when the count is + // unknown. `null` = not answered yet. + const metadataClient = useMetadataClient(); + const [packageLessFlows, setPackageLessFlows] = React.useState(null); + React.useEffect(() => { + let cancelled = false; + loadPackageLessSurfaces(metadataClient, 'flow', locale).then( + (flows) => { + if (!cancelled) setPackageLessFlows(flows.length); + }, + () => { + if (!cancelled) setPackageLessFlows('failed'); + }, + ); + return () => { + cancelled = true; + }; + // Read once per page visit: the count does not follow the display locale. + // eslint-disable-next-line react-hooks/exhaustive-deps + }, []); + // The pair is linked only when the package list holds it: a base with no // pair has nothing to open, and the read never creates one. const listedIds = new Set(pkgs?.map((p) => p.id) ?? []); @@ -204,6 +235,15 @@ export function BuilderLanding(): React.ReactElement {

); } + if (line.counts.customized === 0 && line.counts.switchedOff === 0) { + // objectstack#34715 — a base this deployment has not changed says so in + // words; the Customize button beside it is the way in. + return ( +

+ {t('engine.studio.landing.customizations.none', locale)} +

+ ); + } const pair = listedPairOf(baseId); const customized = tFormat('engine.studio.landing.customizations.customized', locale, { customized: line.counts.customized, @@ -278,6 +318,10 @@ export function BuilderLanding(): React.ReactElement { } }; + const headingClass = 'mb-2 text-[11px] font-medium uppercase tracking-wide text-muted-foreground'; + const entryCardClass = 'flex items-center gap-2.5 rounded-lg border bg-background px-3 py-2.5 text-left hover:bg-muted/40'; + const entryIconClass = 'flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary'; + return (
@@ -287,7 +331,7 @@ export function BuilderLanding(): React.ReactElement {

{t('engine.studio.landing.title', locale)}

- {t('engine.studio.landing.description', locale)} + {t('engine.studio.landing.lead', locale)}

{error && ( @@ -298,17 +342,11 @@ export function BuilderLanding(): React.ReactElement { {recentPackages.length > 0 && ( <> -

- {t('engine.home.recent', locale)} -

+

{t('engine.home.recent', locale)}

{recentPackages.map((item) => ( - - + + @@ -321,16 +359,81 @@ export function BuilderLanding(): React.ReactElement { )} -

- {t('engine.studio.landing.mineHeading', locale)} -

-
- {pkgs === null &&

{t('engine.studio.loading', locale)}

} - {pkgs !== null && writable.length === 0 && ( -

{t('engine.studio.landing.noneWritable', locale)}

- )} + {pkgs === null &&

{t('engine.studio.loading', locale)}

} + + {/* objectui#11808 — an installed (read-only) app is not a dead end, and + * it leads the page (objectstack#34715). ADR-0070 D2: code and + * installed packages take no new items, and D4's Duplicate clones a + * writable base, not them. The card's Customize button, like the card + * itself, opens the app in Studio, where its items are customized + * (ADR-0146 D2, D3: saved in its paired customization package); the + * card links into no Setup page (ADR-0146 D1). The app's id is not on + * the card's face, only in its title. The marketplace is offered only + * when this runtime serves one (`isMarketplaceEnabled`, objectui#5504): + * elsewhere that route does not exist. */} + {readonly.length > 0 && ( +
+
+

+ {t('engine.studio.landing.appsHeading', locale)} +

+ {isMarketplaceEnabled() && ( + + {t('engine.studio.landing.marketplaceInstall', locale)} + + )} +
+

+ {t('engine.studio.landing.appsHint', locale)} +

+
+ {readonly.map((p) => ( +
+ + + +
+ + {renderCustomizationLine(p.id)} +
+ +
+ ))} +
+
+ )} + +

{t('engine.studio.landing.ownHeading', locale)}

+
{writable.map((p) => ( -
+
@@ -425,107 +532,61 @@ export function BuilderLanding(): React.ReactElement { onSaved={(r) => open(r.id)} /> - {/* objectui#11553 — the organization's own flows, which belong to no - * package (a clone of a packaged flow is one, by ADR-0126 §7.1). They - * match no package card above, so they get their own entry, shown - * whether or not any writable package exists. */} -

- {t('engine.studio.landing.orgHeading', locale)} -

+

{t('engine.studio.landing.outsideHeading', locale)}

- {/* objectstack#28561 — the "All metadata" area's cross-package leg - * (ADR-0146 D1): the environment catalog, whose items have one name - * per deployment and may belong to no package (ADR-0131 D3). */} + * (ADR-0146 D1): the environment's positions, permission sets and + * sharing rules, which have one name per deployment and may belong to + * no package (ADR-0131 D3). Named for what it holds (objectstack#34715). */} -
- - {/* objectui#11808 — a read-only package is not a dead end. ADR-0070 D2: - * code and installed packages take no new items, and D4's Duplicate - * clones a writable base, not them. Each card opens the package in - * Studio, where it is customized (objectstack ADR-0146: Customize, and - * the "All metadata" area's per-type overlays); the card links into no - * Setup page. The marketplace, which Home's "Start with a template" - * opens, is offered only when this runtime serves one - * (`isMarketplaceEnabled`, objectui#5504): elsewhere that route does not - * exist. */} - {readonly.length > 0 && ( - <> -

- {t('engine.studio.landing.installedHeading', locale)} -

-

navigate(studioOrgScopePath())} + className={entryCardClass} > - {t('engine.studio.landing.readonlyHint', locale)} -

- {isMarketplaceEnabled() && ( - - {t('engine.studio.landing.marketplace', locale)} - - )} -
- {readonly.map((p) => ( -
- -
- {renderCustomizationLine(p.id)} -
-
- ))} -
- - )} + )} + + + {t('engine.studio.landing.unassignedFlows.description', locale)} + + + + )} +
); } diff --git a/ui/packages/i18n/src/namespaces/studio/en.ts b/ui/packages/i18n/src/namespaces/studio/en.ts index f43d7ad5d10..2387370b143 100644 --- a/ui/packages/i18n/src/namespaces/studio/en.ts +++ b/ui/packages/i18n/src/namespaces/studio/en.ts @@ -3438,6 +3438,22 @@ const STUDIO_EN: Record = { // environment catalog, entered from the landing. 'engine.studio.landing.envCatalog.name': 'Environment catalog', 'engine.studio.landing.envCatalog.description': 'Positions, capabilities, permission sets and sharing rules, across every package.', + // objectstack#34715 — the landing ordered by what the author came to do, in + // words that name no package mechanism. + 'engine.studio.landing.lead': 'Change an installed app, or build an app of your own. Changes save as drafts and take effect when you publish.', + 'engine.studio.landing.appsHeading': 'Installed apps', + 'engine.studio.landing.appsHint': 'Each app is upgraded by its vendor. Your changes are kept separately, so an upgrade does not overwrite them.', + 'engine.studio.landing.marketplaceInstall': 'Install from the marketplace', + 'engine.studio.landing.customizeTitle': 'Customize {name}', + 'engine.studio.landing.customizations.none': 'No changes yet', + 'engine.studio.landing.ownHeading': 'Your own apps', + 'engine.studio.landing.newApp': 'New app of your own', + 'engine.studio.landing.newAppDescription': 'Start from a blank app.', + 'engine.studio.landing.outsideHeading': 'Outside any app', + 'engine.studio.landing.rolesPermissions.name': 'Positions and permissions', + 'engine.studio.landing.rolesPermissions.description': 'Positions, permission sets and sharing rules, shared by every app.', + 'engine.studio.landing.unassignedFlows.name': 'Flows in no app', + 'engine.studio.landing.unassignedFlows.description': 'Flows that belong to no app, such as a copy of an app’s flow. They open editable.', // objectstack#28561 — assignments are Setup's (ADR-0146 D7): the area links // the Setup page in place of the section. 'engine.studio.area.assignments.position': 'The people who hold this position are assigned in Setup.', diff --git a/ui/packages/i18n/src/namespaces/studio/zh.ts b/ui/packages/i18n/src/namespaces/studio/zh.ts index 4aa83f20d02..ab5164daba9 100644 --- a/ui/packages/i18n/src/namespaces/studio/zh.ts +++ b/ui/packages/i18n/src/namespaces/studio/zh.ts @@ -3031,6 +3031,21 @@ const STUDIO_ZH: Record = { 'engine.studio.org.none': '没有不属于软件包的流程。要修改软件包中的流程,请打开它所在的软件包,使用“新建类似”。', 'engine.studio.landing.envCatalog.name': '环境目录', 'engine.studio.landing.envCatalog.description': '岗位、能力、权限集与共享规则,覆盖所有软件包。', + // objectstack#34715 — the landing ordered by what the author came to do. + 'engine.studio.landing.lead': '改已安装的应用,或者新建自己的应用。改动先存草稿,发布后生效。', + 'engine.studio.landing.appsHeading': '已安装的应用', + 'engine.studio.landing.appsHint': '应用本身由厂商升级;你的改动单独保存,升级不会冲掉。', + 'engine.studio.landing.marketplaceInstall': '从应用市场安装', + 'engine.studio.landing.customizeTitle': '定制 {name}', + 'engine.studio.landing.customizations.none': '还没有改动', + 'engine.studio.landing.ownHeading': '自己的应用', + 'engine.studio.landing.newApp': '新建自己的应用', + 'engine.studio.landing.newAppDescription': '从空白开始。', + 'engine.studio.landing.outsideHeading': '不属于某个应用', + 'engine.studio.landing.rolesPermissions.name': '岗位与权限', + 'engine.studio.landing.rolesPermissions.description': '岗位、权限集、共享规则,所有应用共用。', + 'engine.studio.landing.unassignedFlows.name': '未归属的流程', + 'engine.studio.landing.unassignedFlows.description': '不属于任何应用的流程,例如应用流程的副本。可直接编辑。', 'engine.studio.area.assignments.position': '此岗位的任职人员在设置中分配。', 'engine.studio.area.assignments.permission': '此权限集分配给哪些人,在设置中管理。', 'engine.studio.area.assignments.open': '在设置中打开', From 0f871048a953b2fe9a76e746cdff4d1f5b9a3813 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 17 Nov 2026 08:39:12 +0000 Subject: [PATCH 2/8] feat(ui): Studio landing ordered by what the author came to do (#34715) Installed apps lead with a Customize button and no package id on the card face; the author's own apps and the create card follow; positions and permissions, and flows in no app (drawn only when there is at least one, with the count) come last. New studio-namespace keys in en and zh; the landing names no package mechanism. Claude-Session: https://claude.ai/code/session_01WGufzivEnnozveqZfr4fDx Co-authored-by: Claude --- .changeset/34715-studio-landing-task-order.md | 17 +++++++++++++++++ .../areas/studio-authoring.json | 7 ++++--- ...ckage-restart-acceptance.integration.test.ts | 5 ++--- ...derLanding.newPackageDeepLink-26614.test.tsx | 7 +++++++ ...BuilderLanding.recentPackages-11863.test.tsx | 7 +++++++ .../BuilderLanding.setupExit-12513.test.tsx | 7 +++++++ 6 files changed, 44 insertions(+), 6 deletions(-) create mode 100644 .changeset/34715-studio-landing-task-order.md diff --git a/.changeset/34715-studio-landing-task-order.md b/.changeset/34715-studio-landing-task-order.md new file mode 100644 index 00000000000..afbd48b81df --- /dev/null +++ b/.changeset/34715-studio-landing-task-order.md @@ -0,0 +1,17 @@ +--- +'@object-ui/i18n': patch +--- + +feat(console): the Studio landing is ordered by what the author came to do, and its copy says what they can do + +Clause-②: yes (widening) +Metadata-protocol: none + +The Studio landing (`/studio`, the App Builder) used to open with a paragraph about writable packages and `.custom` customization packages, list the author's writable packages, then two entries named for the architecture ("Organization flows", "Environment catalog"), and put the installed apps, the likeliest thing to change, last, each with a Read-only badge and its package id. Now: + +- **Installed apps come first** (after "Recently viewed", when there are recent packages). The section says in one line that each app is upgraded by its vendor and the author's changes are kept separately. Each card carries a **Customize** button that opens the app in Studio, as clicking the card does; it no longer shows a Read-only badge or the package id (the id is the card's title). A card whose app has nothing changed says "No changes yet" instead of "0 customized, 0 switched off". The marketplace link sits beside the section heading as "Install from the marketplace". +- **The author's own apps follow**, with the create card renamed "New app of your own" (was "New package (writable base)"). +- **Entries outside any app come last.** "Environment catalog" is now **"Positions and permissions"** ("Positions, permission sets and sharing rules, shared by every app."); it still opens the same Studio area (ADR-0146 D1 keeps these editors in Studio). "Organization flows" is now **"Flows in no app"**, shows how many there are, and is drawn only when there is at least one; when the count cannot be read the entry is drawn with no number. +- The page's lead is one sentence about what the author can do. In Chinese the landing body no longer carries 「.custom」「基座」「只读」. + +No route, permission or storage changes. The widening is new keys in the `studio` namespace (`en`, `zh`): `engine.studio.landing.lead`, `.appsHeading`, `.appsHint`, `.marketplaceInstall`, `.customizeTitle`, `.customizations.none`, `.ownHeading`, `.newApp`, `.newAppDescription`, `.outsideHeading`, `.rolesPermissions.name`, `.rolesPermissions.description`, `.unassignedFlows.name`, `.unassignedFlows.description`; no key is removed or renamed. The landing no longer reads `engine.studio.landing.description`, `.mineHeading`, `.noneWritable`, `.installedHeading`, `.readonlyHint`, `.marketplace`, `.orgHeading`, `.envCatalog.name`, `.envCatalog.description` and `engine.studio.org.description`; they stay in the namespace. `engine.studio.org.name` and `engine.studio.pkg.new` are still read by the package switcher, unchanged. diff --git a/docs/qa/platform-checklist/areas/studio-authoring.json b/docs/qa/platform-checklist/areas/studio-authoring.json index 044a95e27a7..19a496c8eb3 100644 --- a/docs/qa/platform-checklist/areas/studio-authoring.json +++ b/docs/qa/platform-checklist/areas/studio-authoring.json @@ -2697,7 +2697,7 @@ "title": "Flows outside any package have their own Studio scope: /studio/~org offers only the Automations pillar, lists only package-less flows, opens them editable, saves drafts bound to no package and publishes each by reference", "since": "v18", "status": "active", - "revision": 3, + "revision": 4, "priority": "P2", "surface": "mixed", "personas": [ @@ -2711,7 +2711,7 @@ ] }, "steps": [ - "with no package-less flow yet, open the Studio landing's 'Organization flows' entry: it lands on /_console/studio/~org/automations, offers one pillar only, no Create app, and an empty state that names the way to change a packaged flow ('No flows outside a package. To change a packaged flow, open its package and use New similar.', engine.studio.org.none) with no action and no link out of Studio (StudioDesignSurface.tsx, the auto-empty state: since ADR-0146 D11 no Setup page copies into this scope)", + "with no package-less flow yet, open /_console/studio: the landing draws no 'Flows in no app' entry (it is drawn only when there is at least one such flow, with the count); open /_console/studio/~org/automations directly: it offers one pillar only, no Create app, and an empty state that names the way to change a packaged flow ('No flows outside a package. To change a packaged flow, open its package and use New similar.', engine.studio.org.none) with no action and no link out of Studio (StudioDesignSurface.tsx, the auto-empty state: since ADR-0146 D11 no Setup page copies into this scope)", "write the package-less flow (fixtures.requires[1]); reload: the rail lists qa_org_raw and none of the showcase's packaged flows; GET /api/v1/meta/flow?package=com.example.showcase omits it, the unscoped list includes it", "open it: the canvas and the Enabled switch are editable; change a node label; let the autosave land; read GET /api/v1/meta/_drafts?type=flow — the draft row carries no package", "Publish → the review sheet lists only package-less flow drafts → Publish all; capture the network trace", @@ -2768,7 +2768,8 @@ "change": "negative[1] moved to source[3]: it was a scope note naming the items that own the neighbouring surfaces, which no run can decide, so it could only score skipped. Its text is unchanged except the SCOPE: label, which now reads cross-ref:, the spelling the sibling source rows use. Ruling 6545938831 item ① on #28345 (scope notes leave negative[], which keeps only decidable entries; the #27651 precedent). No clause changed. Wave anchor #27377", "ref": "#28345" }, - { "revision": 3, "date": "2026-11-03", "change": "fixtures.requires[1] names a fixture that still makes a package-less flow, and steps[0], steps[1], steps[4], acceptance[0].verify and source[1] follow it. Since #28149 (ADR-0146 D4) the clone door lands its copy in the source's pair .custom, so QA run #29672's clone of showcase_urgent_task_alert answered packageId com.example.showcase.custom and made no package-less flow; the run substituted PUT /api/v1/meta/flow/qa_org_raw naming no package (200) and passed every clause on it. Read at base 339f63da30: ADR-0146 D11 closes a package-less write only onto an item a code package ships (packagelessOverlayWriteRefusal), so a fresh name stays writable, and a PUT with no ?mode= is an active save (meta-save-request.ts). The same run found steps[0]'s empty state stale: it now reads engine.studio.org.none with no Open in Setup link (StudioDesignSurface.tsx). The clauses are unchanged. Card #29679, from QA run #29672", "ref": "#29679" } + { "revision": 3, "date": "2026-11-03", "change": "fixtures.requires[1] names a fixture that still makes a package-less flow, and steps[0], steps[1], steps[4], acceptance[0].verify and source[1] follow it. Since #28149 (ADR-0146 D4) the clone door lands its copy in the source's pair .custom, so QA run #29672's clone of showcase_urgent_task_alert answered packageId com.example.showcase.custom and made no package-less flow; the run substituted PUT /api/v1/meta/flow/qa_org_raw naming no package (200) and passed every clause on it. Read at base 339f63da30: ADR-0146 D11 closes a package-less write only onto an item a code package ships (packagelessOverlayWriteRefusal), so a fresh name stays writable, and a PUT with no ?mode= is an active save (meta-save-request.ts). The same run found steps[0]'s empty state stale: it now reads engine.studio.org.none with no Open in Setup link (StudioDesignSurface.tsx). The clauses are unchanged. Card #29679, from QA run #29672", "ref": "#29679" }, + { "revision": 4, "date": "2026-11-17", "change": "steps[0] no longer opens a landing entry when there is no package-less flow: since #34715 the Studio landing draws its 'Flows in no app' entry (formerly 'Organization flows') only when at least one such flow exists, with the count, so the step reads the entry's absence and opens the scope by its URL. The clauses are unchanged. Card #34715", "ref": "#34715" } ] }, { diff --git a/packages/cli/test/package-restart-acceptance.integration.test.ts b/packages/cli/test/package-restart-acceptance.integration.test.ts index 8d04154d46a..bf3233c273a 100644 --- a/packages/cli/test/package-restart-acceptance.integration.test.ts +++ b/packages/cli/test/package-restart-acceptance.integration.test.ts @@ -19,9 +19,8 @@ * * 1. Studio writable list — Studio's builder landing (objectui * `packages/app-shell/src/views/studio-design/BuilderLanding.tsx`, heading - * `engine.studio.landing.mineHeading` = "My packages (writable)", empty - * state "No writable packages yet") lists `fetchPackages()` filtered to - * `writable`. `fetchPackages()` (`studio-design/packages-io.ts`) is ONE + * `engine.studio.landing.ownHeading` = "Your own apps") lists + * `fetchPackages()` filtered to `writable`. `fetchPackages()` (`studio-design/packages-io.ts`) is ONE * read: `GET /api/v1/packages`, no query parameters; `parsePackages` drops * `scope: system | cloud` rows and takes the row's top-level `writable` * boolean — the server's verdict (`withWritableVerdict` in diff --git a/ui/packages/app-shell/src/views/studio-design/BuilderLanding.newPackageDeepLink-26614.test.tsx b/ui/packages/app-shell/src/views/studio-design/BuilderLanding.newPackageDeepLink-26614.test.tsx index 5dd55da7869..71833855f3d 100644 --- a/ui/packages/app-shell/src/views/studio-design/BuilderLanding.newPackageDeepLink-26614.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/BuilderLanding.newPackageDeepLink-26614.test.tsx @@ -39,6 +39,13 @@ vi.mock('../metadata-admin/PackageFormDialog', () => ({ ), })); +// The package-less flow count the landing draws (objectstack#34715) is not under +// test here: no flow belongs to no package, and no request leaves the file. +vi.mock('./packageSurfaces', async (importOriginal) => { + const mod = await importOriginal(); + return { ...mod, loadPackageLessSurfaces: vi.fn(async () => []) }; +}); + import { BuilderLanding } from './BuilderLanding'; import { STUDIO_NEW_PACKAGE_PATH } from './studioNewPackage'; diff --git a/ui/packages/app-shell/src/views/studio-design/BuilderLanding.recentPackages-11863.test.tsx b/ui/packages/app-shell/src/views/studio-design/BuilderLanding.recentPackages-11863.test.tsx index 2e58a7d02ad..aacb691f768 100644 --- a/ui/packages/app-shell/src/views/studio-design/BuilderLanding.recentPackages-11863.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/BuilderLanding.recentPackages-11863.test.tsx @@ -62,6 +62,13 @@ vi.mock('./packageCustomizations-io', () => ({ fetchPackageCustomizationCounts: vi.fn(() => new Promise(() => {})), })); +// The package-less flow count the landing draws (objectstack#34715) is not under +// test here: no flow belongs to no package, and no request leaves the file. +vi.mock('./packageSurfaces', async (importOriginal) => { + const mod = await importOriginal(); + return { ...mod, loadPackageLessSurfaces: vi.fn(async () => []) }; +}); + import { BuilderLanding } from './BuilderLanding'; import { RecentItemsProvider } from '../../context/RecentItemsProvider'; diff --git a/ui/packages/app-shell/src/views/studio-design/BuilderLanding.setupExit-12513.test.tsx b/ui/packages/app-shell/src/views/studio-design/BuilderLanding.setupExit-12513.test.tsx index a13f407bf42..efa7f33abe2 100644 --- a/ui/packages/app-shell/src/views/studio-design/BuilderLanding.setupExit-12513.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/BuilderLanding.setupExit-12513.test.tsx @@ -39,6 +39,13 @@ vi.mock('./packageCustomizations-io', () => ({ fetchPackageCustomizationCounts: vi.fn(() => new Promise(() => {})), })); +// The package-less flow count the landing draws (objectstack#34715) is not under +// test here: no flow belongs to no package, and no request leaves the file. +vi.mock('./packageSurfaces', async (importOriginal) => { + const mod = await importOriginal(); + return { ...mod, loadPackageLessSurfaces: vi.fn(async () => []) }; +}); + import * as landing from './BuilderLanding'; const { BuilderLanding } = landing; From 770728ea91b14308d4d0ad9d1d051b9fa0d048ec Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 17 Nov 2026 08:49:16 +0000 Subject: [PATCH 3/8] fix(ui): the landing's Customize button keeps a 44px phone target (#34715) Claude-Session: https://claude.ai/code/session_01WGufzivEnnozveqZfr4fDx Co-authored-by: Claude --- .../app-shell/src/views/studio-design/BuilderLanding.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/packages/app-shell/src/views/studio-design/BuilderLanding.tsx b/ui/packages/app-shell/src/views/studio-design/BuilderLanding.tsx index c25d2102090..79a650782f4 100644 --- a/ui/packages/app-shell/src/views/studio-design/BuilderLanding.tsx +++ b/ui/packages/app-shell/src/views/studio-design/BuilderLanding.tsx @@ -420,7 +420,7 @@ export function BuilderLanding(): React.ReactElement { onClick={() => open(p.id)} aria-label={tFormat('engine.studio.landing.customizeTitle', locale, { name: p.name })} title={tFormat('engine.studio.landing.customizeTitle', locale, { name: p.name })} - className="shrink-0 rounded-md border px-2.5 py-1 text-[11px] font-medium hover:bg-muted" + className="shrink-0 rounded-md border px-2.5 py-1 text-[11px] font-medium hover:bg-muted max-md:min-h-11 max-md:px-3" > {t('engine.studio.customize.action', locale)} From edcfe85c430b3b1ef360a6b1bd6ebd2155c83ff6 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 17 Nov 2026 09:11:46 +0000 Subject: [PATCH 4/8] test(ui): two edited landing tests pay the lint import at collection (#34715) Claude-Session: https://claude.ai/code/session_01WGufzivEnnozveqZfr4fDx Co-authored-by: Claude --- .../BuilderLanding.customizationCounts-28566.test.tsx | 2 ++ .../studio-design/BuilderLanding.customizeCopy-29489.test.tsx | 2 ++ 2 files changed, 4 insertions(+) diff --git a/ui/packages/app-shell/src/views/studio-design/BuilderLanding.customizationCounts-28566.test.tsx b/ui/packages/app-shell/src/views/studio-design/BuilderLanding.customizationCounts-28566.test.tsx index 23b438e9bd7..4009702538e 100644 --- a/ui/packages/app-shell/src/views/studio-design/BuilderLanding.customizationCounts-28566.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/BuilderLanding.customizationCounts-28566.test.tsx @@ -12,6 +12,8 @@ */ import '@testing-library/jest-dom/vitest'; +// The source under test reaches `import('@objectstack/lint')`: paid here, at collection, never inside a test's clock. +import '@objectstack/lint'; import * as React from 'react'; import { afterEach, describe, expect, it, vi } from 'vitest'; import { cleanup, fireEvent, render, screen, waitFor, within } from '@testing-library/react'; diff --git a/ui/packages/app-shell/src/views/studio-design/BuilderLanding.customizeCopy-29489.test.tsx b/ui/packages/app-shell/src/views/studio-design/BuilderLanding.customizeCopy-29489.test.tsx index 13021aebf95..59737e014ab 100644 --- a/ui/packages/app-shell/src/views/studio-design/BuilderLanding.customizeCopy-29489.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/BuilderLanding.customizeCopy-29489.test.tsx @@ -17,6 +17,8 @@ */ import '@testing-library/jest-dom/vitest'; +// The source under test reaches `import('@objectstack/lint')`: paid here, at collection, never inside a test's clock. +import '@objectstack/lint'; import * as React from 'react'; import { afterEach, describe, expect, it, vi } from 'vitest'; import { cleanup, render, screen } from '@testing-library/react'; From d247d947e95c9960459d3abfb92e7d388291c952 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 17 Nov 2026 09:29:23 +0000 Subject: [PATCH 5/8] feat(console): installed apps lead the Studio landing even with recent visits (#34715) The card's acceptance reads the first block as the installed apps; Recently viewed now follows the author's own apps, among the other entries. Claude-Session: https://claude.ai/code/session_01WGufzivEnnozveqZfr4fDx Co-authored-by: Claude --- .changeset/34715-studio-landing-task-order.md | 2 +- ...ilderLanding.recentPackages-11863.test.tsx | 16 +++++++ .../views/studio-design/BuilderLanding.tsx | 46 ++++++++++--------- 3 files changed, 41 insertions(+), 23 deletions(-) diff --git a/.changeset/34715-studio-landing-task-order.md b/.changeset/34715-studio-landing-task-order.md index afbd48b81df..7f5be6862c5 100644 --- a/.changeset/34715-studio-landing-task-order.md +++ b/.changeset/34715-studio-landing-task-order.md @@ -9,7 +9,7 @@ Metadata-protocol: none The Studio landing (`/studio`, the App Builder) used to open with a paragraph about writable packages and `.custom` customization packages, list the author's writable packages, then two entries named for the architecture ("Organization flows", "Environment catalog"), and put the installed apps, the likeliest thing to change, last, each with a Read-only badge and its package id. Now: -- **Installed apps come first** (after "Recently viewed", when there are recent packages). The section says in one line that each app is upgraded by its vendor and the author's changes are kept separately. Each card carries a **Customize** button that opens the app in Studio, as clicking the card does; it no longer shows a Read-only badge or the package id (the id is the card's title). A card whose app has nothing changed says "No changes yet" instead of "0 customized, 0 switched off". The marketplace link sits beside the section heading as "Install from the marketplace". +- **Installed apps come first**, even when there are recent packages: "Recently viewed" now follows the author's own apps. The section says in one line that each app is upgraded by its vendor and the author's changes are kept separately. Each card carries a **Customize** button that opens the app in Studio, as clicking the card does; it no longer shows a Read-only badge or the package id (the id is the card's title). A card whose app has nothing changed says "No changes yet" instead of "0 customized, 0 switched off". The marketplace link sits beside the section heading as "Install from the marketplace". - **The author's own apps follow**, with the create card renamed "New app of your own" (was "New package (writable base)"). - **Entries outside any app come last.** "Environment catalog" is now **"Positions and permissions"** ("Positions, permission sets and sharing rules, shared by every app."); it still opens the same Studio area (ADR-0146 D1 keeps these editors in Studio). "Organization flows" is now **"Flows in no app"**, shows how many there are, and is drawn only when there is at least one; when the count cannot be read the entry is drawn with no number. - The page's lead is one sentence about what the author can do. In Chinese the landing body no longer carries 「.custom」「基座」「只读」. diff --git a/ui/packages/app-shell/src/views/studio-design/BuilderLanding.recentPackages-11863.test.tsx b/ui/packages/app-shell/src/views/studio-design/BuilderLanding.recentPackages-11863.test.tsx index aacb691f768..6388d3a8a22 100644 --- a/ui/packages/app-shell/src/views/studio-design/BuilderLanding.recentPackages-11863.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/BuilderLanding.recentPackages-11863.test.tsx @@ -117,6 +117,22 @@ const recentSection = () => screen.getByTestId('studio-landing-recent'); const recentLinks = () => within(recentSection()).getAllByRole('link'); describe('Studio landing → recent packages (objectui#11863)', () => { + it('with a recent visit, the installed apps still lead the page: the list follows the author’s own apps (objectstack#34715)', async () => { + packages.list = [ + { id: 'com.acme.crm', name: 'Acme CRM', writable: true, namespace: 'acme' }, + { id: 'com.example.showcase', name: 'Showcase', writable: false, namespace: 'showcase' }, + ]; + renderLanding([visit('com.example.showcase')]); + + await screen.findByText('Recently viewed'); + expect(screen.getAllByRole('heading', { level: 2 }).map((h) => h.textContent)).toEqual([ + 'Installed apps', + 'Your own apps', + 'Recently viewed', + 'Outside any app', + ]); + }); + it('lists the most recent packages first, each by its current name, each opening its /studio/PKG route', async () => { packages.list = [ { id: 'com.acme.crm', name: 'Acme CRM', writable: true, namespace: 'acme' }, diff --git a/ui/packages/app-shell/src/views/studio-design/BuilderLanding.tsx b/ui/packages/app-shell/src/views/studio-design/BuilderLanding.tsx index 79a650782f4..e4586e764b3 100644 --- a/ui/packages/app-shell/src/views/studio-design/BuilderLanding.tsx +++ b/ui/packages/app-shell/src/views/studio-design/BuilderLanding.tsx @@ -9,9 +9,8 @@ * builder (`/studio/:packageId/:tab`). Also served standalone at bare `/studio` so the * builder is bookmarkable. * - * The page is ordered by what the author came to do (objectstack#34715). The - * packages the author was last in lead, when there are any (objectui#11863). - * Installed apps come first after them, because changing one is the likeliest + * The page is ordered by what the author came to do (objectstack#34715). + * Installed apps come first, because changing one is the likeliest * errand: each card says what this deployment changed on it, "n customized, * m switched off" (ADR-0146 D3), from the server's per-package customization * read, and carries a Customize button that opens the app in Studio, where its @@ -340,25 +339,6 @@ export function BuilderLanding(): React.ReactElement {
)} - {recentPackages.length > 0 && ( - <> -

{t('engine.home.recent', locale)}

-
- {recentPackages.map((item) => ( - - - - - - {recentLabel(item)} - {item.name} - - - ))} -
- - )} - {pkgs === null &&

{t('engine.studio.loading', locale)}

} {/* objectui#11808 — an installed (read-only) app is not a dead end, and @@ -532,6 +512,28 @@ export function BuilderLanding(): React.ReactElement { onSaved={(r) => open(r.id)} /> + {/* objectui#11863 — the packages last opened here. objectstack#34715 + * orders the page by the errand: installed apps first, the author's own + * apps next, then the other entries, this one among them. */} + {recentPackages.length > 0 && ( + <> +

{t('engine.home.recent', locale)}

+
+ {recentPackages.map((item) => ( + + + + + + {recentLabel(item)} + {item.name} + + + ))} +
+ + )} +

{t('engine.studio.landing.outsideHeading', locale)}

{/* objectstack#28561 — the "All metadata" area's cross-package leg From 19bfd599ab8d0503a65fe0921486aacc323ae5cc Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 17 Nov 2026 09:46:04 +0000 Subject: [PATCH 6/8] fix(console): a system package draws no installed-app card on the Studio landing (#34715) A kernel package served flat with a system or cloud scope stays in the package list, tagged kernel; the landing now drops it by that tag. Claude-Session: https://claude.ai/code/session_01WGufzivEnnozveqZfr4fDx Co-authored-by: Claude --- .changeset/34715-studio-landing-task-order.md | 1 + .../BuilderLanding.taskOrder-34715.test.tsx | 23 +++++++++++++++++++ .../views/studio-design/BuilderLanding.tsx | 8 ++++++- 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/.changeset/34715-studio-landing-task-order.md b/.changeset/34715-studio-landing-task-order.md index 7f5be6862c5..c6d573a48b6 100644 --- a/.changeset/34715-studio-landing-task-order.md +++ b/.changeset/34715-studio-landing-task-order.md @@ -10,6 +10,7 @@ Metadata-protocol: none The Studio landing (`/studio`, the App Builder) used to open with a paragraph about writable packages and `.custom` customization packages, list the author's writable packages, then two entries named for the architecture ("Organization flows", "Environment catalog"), and put the installed apps, the likeliest thing to change, last, each with a Read-only badge and its package id. Now: - **Installed apps come first**, even when there are recent packages: "Recently viewed" now follows the author's own apps. The section says in one line that each app is upgraded by its vendor and the author's changes are kept separately. Each card carries a **Customize** button that opens the app in Studio, as clicking the card does; it no longer shows a Read-only badge or the package id (the id is the card's title). A card whose app has nothing changed says "No changes yet" instead of "0 customized, 0 switched off". The marketplace link sits beside the section heading as "Install from the marketplace". +- **A system package is not an installed app.** A kernel package the server lists flat with a `system` or `cloud` scope (a hosted environment's `sys.*` packages) no longer draws a card under Installed apps, by the same `kernel` tag the Studio package switcher reads. - **The author's own apps follow**, with the create card renamed "New app of your own" (was "New package (writable base)"). - **Entries outside any app come last.** "Environment catalog" is now **"Positions and permissions"** ("Positions, permission sets and sharing rules, shared by every app."); it still opens the same Studio area (ADR-0146 D1 keeps these editors in Studio). "Organization flows" is now **"Flows in no app"**, shows how many there are, and is drawn only when there is at least one; when the count cannot be read the entry is drawn with no number. - The page's lead is one sentence about what the author can do. In Chinese the landing body no longer carries 「.custom」「基座」「只读」. diff --git a/ui/packages/app-shell/src/views/studio-design/BuilderLanding.taskOrder-34715.test.tsx b/ui/packages/app-shell/src/views/studio-design/BuilderLanding.taskOrder-34715.test.tsx index ce2bfd46c6b..c47b32a8266 100644 --- a/ui/packages/app-shell/src/views/studio-design/BuilderLanding.taskOrder-34715.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/BuilderLanding.taskOrder-34715.test.tsx @@ -55,6 +55,7 @@ vi.mock('./packageSurfaces', async (importOriginal) => { }); import { BuilderLanding } from './BuilderLanding'; +import { parsePackages } from './packages-io'; const HOTCRM = { id: 'app.objectstack.hotcrm', name: 'HotCRM', writable: false, namespace: 'crm' }; const SERVICE = { id: 'app.objectstack.service', name: 'HotCRM Service', writable: false, namespace: 'svc' }; @@ -142,6 +143,28 @@ describe('Studio landing: ordered by what the author came to do (objectstack#347 ); }); + it('a system package served flat with a kernel scope is no installed app: no card, no Customize (comment 6943119575)', async () => { + // The list as the registry half serves a hosted environment: a `sys.*` + // package whose kernel `scope` is flat, beside an installed app. + const parsed = parsePackages({ + data: [ + { id: 'sys.package-state', name: 'Package State', scope: 'system', writable: false }, + { id: 'sys.env-artifact-cache', name: 'Environment Artifact Cache', scope: 'cloud', writable: false }, + { manifest: { id: 'app.objectstack.hotcrm', name: 'HotCRM', namespace: 'crm' }, writable: false }, + ], + }); + // CONTROL: the parser keeps the flat kernel rows, tagged — the landing is what drops them. + expect(parsed.filter((p) => p.kernel).map((p) => p.id)).toEqual(['sys.package-state', 'sys.env-artifact-cache']); + packages.list = parsed.map((p) => ({ ...p })); + renderLanding(); + + const installed = await screen.findByTestId('studio-landing-installed'); + expect(within(installed).getByText('HotCRM')).toBeInTheDocument(); + expect(within(installed).getAllByTestId('studio-landing-customize')).toHaveLength(1); + expect(document.querySelector('[data-package-id^="sys."]')).toBeNull(); + expect(bodyText()).not.toMatch(/Package State|Environment Artifact Cache/u); + }); + it('positions and permissions keep their Studio entry under the new name', async () => { packages.list = [HOTCRM]; renderLanding(); diff --git a/ui/packages/app-shell/src/views/studio-design/BuilderLanding.tsx b/ui/packages/app-shell/src/views/studio-design/BuilderLanding.tsx index e4586e764b3..bb5b807136b 100644 --- a/ui/packages/app-shell/src/views/studio-design/BuilderLanding.tsx +++ b/ui/packages/app-shell/src/views/studio-design/BuilderLanding.tsx @@ -146,7 +146,13 @@ export function BuilderLanding(): React.ReactElement { // customized line and link, and the pair's export and delete stay on the // Packages page, which lists every package. A pair whose base is not listed // keeps its card. - const cards = pkgs === null ? [] : foldCustomizationPairs(pkgs).rows; + // + // objectstack#34715 — a kernel package (ADR-0016 §3.8: no one authors into + // it) is not an app the author installed, so it draws no card. The list + // leaves out a manifest-scoped one already; a flat-scoped one stays in it, + // tagged `kernel` (`parsePackages`), and is dropped here by the same tag the + // package switcher reads (objectstack#34593). + const cards = pkgs === null ? [] : foldCustomizationPairs(pkgs.filter((p) => !p.kernel)).rows; const writable = cards.filter((p) => p.writable); const readonly = cards.filter((p) => !p.writable); From bc193a5db7fed856b2627c6916b831c7700ba2ad Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 17 Nov 2026 09:57:21 +0000 Subject: [PATCH 7/8] feat(console): the Studio landing lists this environment's customizations in one panel (#34714) Claude-Session: https://claude.ai/code/session_01WGufzivEnnozveqZfr4fDx Co-authored-by: Claude --- ...lderLanding.accessibleNames-12510.test.tsx | 5 +- ...erLanding.envCustomizations-34714.test.tsx | 362 ++++++++++++++++++ .../BuilderLanding.orgScope-11553.test.tsx | 5 +- ...ilderLanding.recentPackages-11863.test.tsx | 6 +- .../BuilderLanding.setupExit-12513.test.tsx | 5 +- .../BuilderLanding.taskOrder-34715.test.tsx | 23 +- .../views/studio-design/BuilderLanding.tsx | 45 ++- .../LandingCustomizationsPanel.tsx | 275 +++++++++++++ .../studio-design/landingCustomizations-io.ts | 186 +++++++++ .../studio-design/packageCustomizations-io.ts | 12 +- ui/packages/i18n/src/namespaces/studio/en.ts | 30 ++ ui/packages/i18n/src/namespaces/studio/zh.ts | 30 ++ 12 files changed, 967 insertions(+), 17 deletions(-) create mode 100644 ui/packages/app-shell/src/views/studio-design/BuilderLanding.envCustomizations-34714.test.tsx create mode 100644 ui/packages/app-shell/src/views/studio-design/LandingCustomizationsPanel.tsx create mode 100644 ui/packages/app-shell/src/views/studio-design/landingCustomizations-io.ts diff --git a/ui/packages/app-shell/src/views/studio-design/BuilderLanding.accessibleNames-12510.test.tsx b/ui/packages/app-shell/src/views/studio-design/BuilderLanding.accessibleNames-12510.test.tsx index b2956be5dbb..caa05d6ffcc 100644 --- a/ui/packages/app-shell/src/views/studio-design/BuilderLanding.accessibleNames-12510.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/BuilderLanding.accessibleNames-12510.test.tsx @@ -37,8 +37,9 @@ vi.mock('./packages-io', async (importOriginal) => { vi.mock('../metadata-admin/PackageFormDialog', () => ({ PackageFormDialog: () => null })); // A read-only base's customization read (ADR-0146 D3) is not under test here: // it stays pending, so no request leaves the file. -vi.mock('./packageCustomizations-io', () => ({ - fetchPackageCustomizationCounts: vi.fn(() => new Promise(() => {})), +vi.mock('./packageCustomizations-io', async (importOriginal) => ({ + ...(await importOriginal()), + fetchPackageCustomizations: vi.fn(() => new Promise(() => {})), })); // One flow belongs to no package, so the landing draws that entry (objectstack#34715). vi.mock('./packageSurfaces', async (importOriginal) => { diff --git a/ui/packages/app-shell/src/views/studio-design/BuilderLanding.envCustomizations-34714.test.tsx b/ui/packages/app-shell/src/views/studio-design/BuilderLanding.envCustomizations-34714.test.tsx new file mode 100644 index 00000000000..dbdede99dda --- /dev/null +++ b/ui/packages/app-shell/src/views/studio-design/BuilderLanding.envCustomizations-34714.test.tsx @@ -0,0 +1,362 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +/** + * objectstack#34714 — the Studio landing lists every change this deployment + * made to its installed apps in one panel, "Customizations in this + * environment". + * + * The real `BuilderLanding`, the real panel and the real customization reader + * (`packageCustomizations-io`) run under a real router; the package list, the + * wire of the customization route and the panel's label read are stubbed. The + * stubbed answers are shaped by the route's declaration + * (`GetPackageCustomizationsResponseSchema`) inside the dispatcher envelope. + * + * Acceptance: two installed apps with one change each and one switched-off + * flow draw 3 rows with the right app and mode, each opening its item; the + * panel's total equals the cards' "customized" plus "switched off"; with no + * change the panel is one line; an app whose read answers 403 is named as + * unreadable and the other app's rows still list. + */ + +import '@testing-library/jest-dom/vitest'; +// The source under test reaches `import('@objectstack/lint')`: paid here, at collection, never inside a test's clock. +import '@objectstack/lint'; +import * as React from 'react'; +import { afterEach, describe, expect, it, vi } from 'vitest'; +import { cleanup, fireEvent, render, screen, waitFor, within } from '@testing-library/react'; +import { MemoryRouter, Route, Routes, useLocation } from 'react-router-dom'; +import { I18nProvider, createI18n } from '@object-ui/i18n'; +import { loadStudioCatalogue } from '@object-ui/i18n/namespaces/studio'; +await loadStudioCatalogue('zh'); + +const packages = vi.hoisted(() => ({ list: [] as Array> })); +const labels = vi.hoisted(() => ({ byApp: {} as Record> })); + +vi.mock('./packages-io', async (importOriginal) => { + const mod = await importOriginal(); + return { ...mod, fetchPackages: vi.fn(async () => packages.list) }; +}); +vi.mock('../metadata-admin/PackageFormDialog', () => ({ PackageFormDialog: () => null })); +// No flow belongs to no package; no request leaves the file for that count. +vi.mock('./packageSurfaces', async (importOriginal) => ({ + ...(await importOriginal()), + loadPackageLessSurfaces: vi.fn(async () => []), +})); +// The label read answers from `labels.byApp`; its own behaviour is pinned in the io case below. +vi.mock('./landingCustomizations-io', async (importOriginal) => ({ + ...(await importOriginal()), + loadCustomizationLabels: vi.fn(async (_client: unknown, appId: string) => labels.byApp[appId] ?? {}), +})); + +import { BuilderLanding } from './BuilderLanding'; +import { customizationRowsOf } from './landingCustomizations-io'; +import { LANDING_CUSTOMIZATION_ROWS_SHOWN } from './LandingCustomizationsPanel'; + +const HOTCRM = { id: 'app.objectstack.hotcrm', name: 'HotCRM', writable: false, namespace: 'crm' }; +const SERVICE = { id: 'app.objectstack.service', name: 'Service Desk', writable: false, namespace: 'svc' }; +const OWN = { id: 'com.acme.app', name: 'Acme', writable: true, namespace: 'acme' }; + +type Lists = { + overrides?: Array>; + extensions?: Array>; + switchedOff?: Array>; + contributions?: Array>; +}; +type Answer = { status: number; body: unknown }; + +/** A served answer for `id`, its counts derived from its lists as the route derives them. */ +function served(id: string, lists: Lists = {}): Answer { + const overrides = lists.overrides ?? []; + const extensions = lists.extensions ?? []; + const switchedOff = lists.switchedOff ?? []; + const contributions = lists.contributions ?? []; + return { + status: 200, + body: { + success: true, + data: { + packageId: id, + overrides, + extensions, + switchedOff, + contributions, + counts: { + overrides: overrides.length, + extensions: extensions.length, + switchedOff: switchedOff.length, + contributions: contributions.length, + }, + }, + }, + }; +} + +const CUSTOMIZATIONS_RE = /^\/api\/v1\/packages\/([^/]+)\/customizations$/; + +/** Answer each customization request from `answers` by base id; any other request is refused. */ +function stubWire(answers: Record) { + const requested: string[] = []; + vi.stubGlobal( + 'fetch', + vi.fn(async (input: RequestInfo | URL) => { + const url = String(input); + requested.push(url); + const m = CUSTOMIZATIONS_RE.exec(url); + const answer = m ? answers[decodeURIComponent(m[1])] : undefined; + if (!answer) throw new Error(`unexpected request ${url}`); + return { + ok: answer.status >= 200 && answer.status < 300, + status: answer.status, + json: async () => answer.body, + text: async () => JSON.stringify(answer.body), + } as Response; + }), + ); + return { requested }; +} + +afterEach(() => { + cleanup(); + vi.unstubAllGlobals(); + packages.list = []; + labels.byApp = {}; +}); + +function LocationProbe() { + const { pathname, search } = useLocation(); + return
{`${pathname}${search}`}
; +} + +function renderLanding(lang: 'en' | 'zh' = 'en') { + const landing = ( + + + + } /> + } /> + } /> + + + ); + if (lang === 'en') return render(landing); + const zh = createI18n({ defaultLanguage: 'zh', detectBrowserLanguage: false, resources: { zh: {} } }); + return render({landing}); +} + +const panel = () => screen.getByTestId('studio-landing-env-customizations'); +const rows = () => within(panel()).queryAllByTestId('studio-landing-env-customization'); +const rowLine = (row: HTMLElement) => + `${row.querySelector('a')?.textContent} | ${within(row).getByTestId('studio-landing-env-customization-meta').textContent}`; + +/** The cards' "customized" + "switched off", summed over every read card. */ +function cardSum(): number { + return screen + .getAllByTestId('studio-landing-customizations') + .filter((l) => l.getAttribute('data-state') === 'read') + .reduce((sum, l) => sum + [...(l.textContent ?? '').matchAll(/(\d+)/gu)].reduce((s, m) => s + Number(m[1]), 0), 0); +} + +/** Two apps, one change each, and one switched-off flow on HotCRM. */ +const ACCEPTANCE = { + [HOTCRM.id]: served(HOTCRM.id, { + overrides: [{ type: 'view', name: 'account_list' }], + switchedOff: [{ type: 'flow', name: 'lead_nurture' }], + // Another package's field on a HotCRM object: not this deployment's change. + contributions: [{ kind: 'field', object: 'account', name: 'erp_code', packageId: 'com.acme.erp' }], + }), + [SERVICE.id]: served(SERVICE.id, { extensions: [{ object: 'ticket', kind: 'field', name: 'region' }] }), +}; + +describe('Studio landing → Customizations in this environment (objectstack#34714)', () => { + it('two apps with one change each and one switched-off flow list 3 rows, each with its app and how it changed it', async () => { + packages.list = [HOTCRM, SERVICE, OWN]; + stubWire(ACCEPTANCE); + labels.byApp = { [HOTCRM.id]: { 'view:account_list': 'All accounts' } }; + renderLanding(); + + // The label arrives after the rows: a row is drawn on its name first. + await waitFor(() => + expect(rows().map(rowLine)).toEqual([ + 'All accounts | Changed · View · HotCRM', + 'lead_nurture | Switched off · Flow · HotCRM', + 'ticket.region | Added · Field · Service Desk', + ]), + ); + expect(rows().map((r) => `${r.getAttribute('data-app-id')}:${r.getAttribute('data-mode')}`)).toEqual([ + `${HOTCRM.id}:changed`, + `${HOTCRM.id}:switchedOff`, + `${SERVICE.id}:added`, + ]); + // The contributed field makes no row. + expect(panel().textContent).not.toContain('erp_code'); + }); + + it('each row opens its item in Studio: the item on its app’s metadata area, an added field on its object', async () => { + packages.list = [HOTCRM, SERVICE]; + stubWire(ACCEPTANCE); + renderLanding(); + + await waitFor(() => expect(rows()).toHaveLength(3)); + expect(rows().map((r) => r.querySelector('a')?.getAttribute('href'))).toEqual([ + '/studio/app.objectstack.hotcrm/metadata/view/account_list', + '/studio/app.objectstack.hotcrm/metadata/flow/lead_nurture', + '/studio/app.objectstack.service/metadata/object/ticket', + ]); + fireEvent.click(within(rows()[1]).getByRole('link')); + await waitFor(() => + expect(screen.getByTestId('location')).toHaveTextContent('/studio/app.objectstack.hotcrm/metadata/flow/lead_nurture'), + ); + expect(screen.getByTestId('area-item')).toBeInTheDocument(); + }); + + it('the panel’s total equals the cards’ customized + switched off', async () => { + packages.list = [HOTCRM, SERVICE]; + stubWire(ACCEPTANCE); + renderLanding(); + + await waitFor(() => expect(rows()).toHaveLength(3)); + await waitFor(() => expect(cardSum()).toBe(3)); + expect(screen.getByTestId('studio-landing-env-customizations-total')).toHaveTextContent('3'); + // One read per app serves the card and the panel. + const requested = vi.mocked(globalThis.fetch).mock.calls.map((c) => String(c[0])); + expect(requested.filter((u) => CUSTOMIZATIONS_RE.test(u)).sort()).toEqual([ + '/api/v1/packages/app.objectstack.hotcrm/customizations', + '/api/v1/packages/app.objectstack.service/customizations', + ]); + }); + + it('with no change anywhere the panel is one line, and draws no list', async () => { + packages.list = [HOTCRM, SERVICE]; + stubWire({ [HOTCRM.id]: served(HOTCRM.id), [SERVICE.id]: served(SERVICE.id) }); + renderLanding(); + + expect(await screen.findByTestId('studio-landing-env-customizations-empty')).toHaveTextContent( + 'No installed app has been changed in this environment yet.', + ); + expect(rows()).toHaveLength(0); + expect(screen.queryByTestId('studio-landing-env-customizations-total')).not.toBeInTheDocument(); + expect(screen.queryByTestId('studio-landing-env-customizations-search')).not.toBeInTheDocument(); + }); + + it('an app whose read answers 403 is named as unreadable, never counted as 0; the other app still lists', async () => { + packages.list = [HOTCRM, SERVICE]; + stubWire({ + [HOTCRM.id]: { status: 403, body: { success: false, error: { code: 'PERMISSION_DENIED', message: 'Not allowed to read customizations.' } } }, + [SERVICE.id]: ACCEPTANCE[SERVICE.id], + }); + renderLanding(); + + const unreadable = await screen.findByTestId('studio-landing-env-customizations-unreadable'); + expect(unreadable).toHaveTextContent('HotCRM: this app’s customizations could not be read.'); + expect(unreadable).toHaveAttribute('data-app-id', HOTCRM.id); + await waitFor(() => expect(rows()).toHaveLength(1)); + expect(rowLine(rows()[0])).toBe('ticket.region | Added · Field · Service Desk'); + expect(screen.getByTestId('studio-landing-env-customizations-total')).toHaveTextContent('1'); + expect(screen.queryByTestId('studio-landing-env-customizations-empty')).not.toBeInTheDocument(); + // The card says the same: failed, not "No changes yet". + const hotcrmCard = document.querySelector(`[data-package-id="${HOTCRM.id}"]`) as HTMLElement; + expect(within(hotcrmCard).getByTestId('studio-landing-customizations')).toHaveAttribute('data-state', 'failed'); + }); + + it('tabs narrow by kind, the search by text, and the rows group by app', async () => { + packages.list = [HOTCRM, SERVICE]; + stubWire(ACCEPTANCE); + renderLanding(); + await waitFor(() => expect(rows()).toHaveLength(3)); + + const tab = (key: string) => screen.getByTestId(`studio-landing-env-customizations-tab-${key}`); + expect(['all', 'fields', 'views', 'flows', 'switchedOff'].map((k) => tab(k).textContent)).toEqual([ + 'All 3', + 'New fields 1', + 'Forms and views 1', + 'Flows 1', + 'Switched off 1', + ]); + fireEvent.click(tab('fields')); + expect(rows().map((r) => r.getAttribute('data-mode'))).toEqual(['added']); + fireEvent.click(tab('switchedOff')); + expect(rows().map((r) => r.querySelector('a')?.textContent)).toEqual(['lead_nurture']); + fireEvent.click(tab('all')); + + fireEvent.change(screen.getByTestId('studio-landing-env-customizations-search'), { target: { value: 'service' } }); + expect(rows().map((r) => r.querySelector('a')?.textContent)).toEqual(['ticket.region']); + fireEvent.change(screen.getByTestId('studio-landing-env-customizations-search'), { target: { value: '' } }); + + fireEvent.click(screen.getByTestId('studio-landing-env-customizations-group')); + const groups = within(panel()).getAllByTestId('studio-landing-env-customizations-app'); + expect(groups.map((g) => [g.getAttribute('data-app-id'), within(g).getAllByTestId('studio-landing-env-customization').length])).toEqual([ + [HOTCRM.id, 2], + [SERVICE.id, 1], + ]); + }); + + it(`shows the first ${LANDING_CUSTOMIZATION_ROWS_SHOWN} rows, the rest behind "Show all"`, async () => { + const many = Array.from({ length: LANDING_CUSTOMIZATION_ROWS_SHOWN + 3 }, (_, i) => ({ type: 'view', name: `view_${i}` })); + packages.list = [HOTCRM]; + stubWire({ [HOTCRM.id]: served(HOTCRM.id, { overrides: many }) }); + renderLanding(); + + await waitFor(() => expect(rows()).toHaveLength(LANDING_CUSTOMIZATION_ROWS_SHOWN)); + const showAll = screen.getByTestId('studio-landing-env-customizations-show-all'); + expect(showAll).toHaveTextContent(`Show all ${many.length}`); + fireEvent.click(showAll); + expect(rows()).toHaveLength(many.length); + }); + + it('zh-CN: the panel speaks the card’s words — 本环境的定制, 改了原有的 / 新增的 / 已停用', async () => { + packages.list = [HOTCRM, SERVICE]; + stubWire(ACCEPTANCE); + renderLanding('zh'); + + await waitFor(() => expect(rows()).toHaveLength(3)); + expect(within(panel()).getByRole('heading', { level: 2 })).toHaveTextContent('本环境的定制'); + expect(rows().map((r) => within(r).getByTestId('studio-landing-env-customization-meta').textContent)).toEqual([ + '改了原有的 · 视图 · HotCRM', + '已停用 · 流程 · HotCRM', + '新增的 · 字段 · Service Desk', + ]); + expect(screen.getByTestId('studio-landing-env-customizations-tab-fields')).toHaveTextContent('新增字段'); + expect(screen.getByTestId('studio-landing-env-customizations-tab-views')).toHaveTextContent('表单与视图'); + }); +}); + +describe('the panel’s rows and labels (objectstack#34714)', () => { + it('one row per served override, extension and switched-off item; contributions make none', () => { + const read = (ACCEPTANCE[HOTCRM.id].body as { data: Parameters[1] }).data; + expect(customizationRowsOf(HOTCRM, read).map((r) => `${r.mode}:${r.type}:${r.name}`)).toEqual([ + 'changed:view:account_list', + 'switchedOff:flow:lead_nurture', + ]); + }); + + it('labels come from the app’s own list of each type with rows, a field’s from its object; a failed list keeps the names', async () => { + const { loadCustomizationLabels: real } = await vi.importActual( + './landingCustomizations-io', + ); + const rowsOf = customizationRowsOf(SERVICE, { + overrides: [{ type: 'view', name: 'ticket_list' }], + extensions: [{ object: 'ticket', kind: 'field', name: 'region' }], + switchedOff: [{ type: 'flow', name: 'escalate' }], + }); + const asked: string[] = []; + const client = { + list: vi.fn(async (type: string, options?: { packageId?: string }) => { + asked.push(`${type}@${options?.packageId}`); + if (type === 'flow') throw new Error('HTTP 500'); + if (type === 'view') return [{ name: 'ticket_list', label: { en: 'All tickets', zh: '全部工单' } }]; + if (type === 'object') return [{ name: 'ticket', label: 'Ticket', fields: { region: { label: 'Region' } } }]; + return []; + }), + }; + expect(await real(client, SERVICE.id, rowsOf, 'zh')).toEqual({ + 'view:ticket_list': '全部工单', + 'object:ticket': 'Ticket', + 'field:ticket.region': 'Region', + }); + expect(asked.sort()).toEqual(['flow@app.objectstack.service', 'object@app.objectstack.service', 'view@app.objectstack.service']); + // No row, no request. + client.list.mockClear(); + expect(await real(client, HOTCRM.id, rowsOf, 'en')).toEqual({}); + expect(client.list).not.toHaveBeenCalled(); + }); +}); diff --git a/ui/packages/app-shell/src/views/studio-design/BuilderLanding.orgScope-11553.test.tsx b/ui/packages/app-shell/src/views/studio-design/BuilderLanding.orgScope-11553.test.tsx index b2780273b68..b9e7d0d6807 100644 --- a/ui/packages/app-shell/src/views/studio-design/BuilderLanding.orgScope-11553.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/BuilderLanding.orgScope-11553.test.tsx @@ -39,8 +39,9 @@ vi.mock('./packages-io', async (importOriginal) => { vi.mock('../metadata-admin/PackageFormDialog', () => ({ PackageFormDialog: () => null })); // A read-only base's customization read (ADR-0146 D3) is not under test here: // it stays pending, so no request leaves the file. -vi.mock('./packageCustomizations-io', () => ({ - fetchPackageCustomizationCounts: vi.fn(() => new Promise(() => {})), +vi.mock('./packageCustomizations-io', async (importOriginal) => ({ + ...(await importOriginal()), + fetchPackageCustomizations: vi.fn(() => new Promise(() => {})), })); vi.mock('./packageSurfaces', async (importOriginal) => { diff --git a/ui/packages/app-shell/src/views/studio-design/BuilderLanding.recentPackages-11863.test.tsx b/ui/packages/app-shell/src/views/studio-design/BuilderLanding.recentPackages-11863.test.tsx index 6388d3a8a22..8fba6a41911 100644 --- a/ui/packages/app-shell/src/views/studio-design/BuilderLanding.recentPackages-11863.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/BuilderLanding.recentPackages-11863.test.tsx @@ -58,8 +58,9 @@ vi.mock('./packages-io', async (importOriginal) => { vi.mock('../metadata-admin/PackageFormDialog', () => ({ PackageFormDialog: () => null })); // A read-only base's customization read (ADR-0146 D3) is not under test here: // it stays pending, so no request leaves the file. -vi.mock('./packageCustomizations-io', () => ({ - fetchPackageCustomizationCounts: vi.fn(() => new Promise(() => {})), +vi.mock('./packageCustomizations-io', async (importOriginal) => ({ + ...(await importOriginal()), + fetchPackageCustomizations: vi.fn(() => new Promise(() => {})), })); // The package-less flow count the landing draws (objectstack#34715) is not under @@ -127,6 +128,7 @@ describe('Studio landing → recent packages (objectui#11863)', () => { await screen.findByText('Recently viewed'); expect(screen.getAllByRole('heading', { level: 2 }).map((h) => h.textContent)).toEqual([ 'Installed apps', + 'Customizations in this environment', 'Your own apps', 'Recently viewed', 'Outside any app', diff --git a/ui/packages/app-shell/src/views/studio-design/BuilderLanding.setupExit-12513.test.tsx b/ui/packages/app-shell/src/views/studio-design/BuilderLanding.setupExit-12513.test.tsx index efa7f33abe2..e34deac531d 100644 --- a/ui/packages/app-shell/src/views/studio-design/BuilderLanding.setupExit-12513.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/BuilderLanding.setupExit-12513.test.tsx @@ -35,8 +35,9 @@ vi.mock('./packages-io', async (importOriginal) => { vi.mock('../metadata-admin/PackageFormDialog', () => ({ PackageFormDialog: () => null })); // A read-only base's customization read (ADR-0146 D3) is not under test here: // it stays pending, so no request leaves the file. -vi.mock('./packageCustomizations-io', () => ({ - fetchPackageCustomizationCounts: vi.fn(() => new Promise(() => {})), +vi.mock('./packageCustomizations-io', async (importOriginal) => ({ + ...(await importOriginal()), + fetchPackageCustomizations: vi.fn(() => new Promise(() => {})), })); // The package-less flow count the landing draws (objectstack#34715) is not under diff --git a/ui/packages/app-shell/src/views/studio-design/BuilderLanding.taskOrder-34715.test.tsx b/ui/packages/app-shell/src/views/studio-design/BuilderLanding.taskOrder-34715.test.tsx index c47b32a8266..ffd32252c91 100644 --- a/ui/packages/app-shell/src/views/studio-design/BuilderLanding.taskOrder-34715.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/BuilderLanding.taskOrder-34715.test.tsx @@ -40,8 +40,25 @@ vi.mock('./packages-io', async (importOriginal) => { }; }); vi.mock('../metadata-admin/PackageFormDialog', () => ({ PackageFormDialog: () => null })); -vi.mock('./packageCustomizations-io', () => ({ - fetchPackageCustomizationCounts: vi.fn(async (id: string) => counts.byId[id] ?? { customized: 0, switchedOff: 0 }), +vi.mock('./packageCustomizations-io', async (importOriginal) => ({ + ...(await importOriginal()), + // A served answer whose lists are as long as the counts asked for: `customized` view overrides, `switchedOff` flows. + fetchPackageCustomizations: vi.fn(async (id: string) => { + const { customized, switchedOff } = counts.byId[id] ?? { customized: 0, switchedOff: 0 }; + return { + packageId: id, + overrides: Array.from({ length: customized }, (_, i) => ({ type: 'view', name: `view_${i}` })), + extensions: [], + switchedOff: Array.from({ length: switchedOff }, (_, i) => ({ type: 'flow', name: `flow_${i}` })), + contributions: [], + counts: { overrides: customized, extensions: 0, switchedOff, contributions: 0 }, + }; + }), +})); +// The panel's label read (objectstack#34714) is not under test here: rows keep their names. +vi.mock('./landingCustomizations-io', async (importOriginal) => ({ + ...(await importOriginal()), + loadCustomizationLabels: vi.fn(async () => ({})), })); vi.mock('./packageSurfaces', async (importOriginal) => { const mod = await importOriginal(); @@ -102,7 +119,7 @@ describe('Studio landing: ordered by what the author came to do (objectstack#347 renderLanding(); await screen.findByText('HotCRM'); - expect(headings()).toEqual(['Installed apps', 'Your own apps', 'Outside any app']); + expect(headings()).toEqual(['Installed apps', 'Customizations in this environment', 'Your own apps', 'Outside any app']); const installed = screen.getByTestId('studio-landing-installed'); // DOM order: each installed card precedes the author's own card. const own = screen.getByTestId('studio-landing-own'); diff --git a/ui/packages/app-shell/src/views/studio-design/BuilderLanding.tsx b/ui/packages/app-shell/src/views/studio-design/BuilderLanding.tsx index bb5b807136b..658c835ff6b 100644 --- a/ui/packages/app-shell/src/views/studio-design/BuilderLanding.tsx +++ b/ui/packages/app-shell/src/views/studio-design/BuilderLanding.tsx @@ -34,7 +34,13 @@ import { t, tFormat, useMetadataLocale } from '../metadata-admin/i18n.js'; import { PackageFormDialog } from '../metadata-admin/PackageFormDialog.js'; import { isMarketplaceEnabled } from '../../runtime-config.js'; import { fetchPackages, fetchListedPackageIds, duplicatePackage, isSpecPackageId, type PkgEntry } from './packages-io.js'; -import { fetchPackageCustomizationCounts, type PackageCustomizationCounts } from './packageCustomizations-io.js'; +import { + customizationCountsOf, + fetchPackageCustomizations, + type PackageCustomizationCounts, + type PackageCustomizations, +} from './packageCustomizations-io.js'; +import { LandingCustomizationsPanel, type AppCustomizationRead } from './LandingCustomizationsPanel.js'; import { customizationPackageId, isCustomizationPackage } from '@objectstack/spec/kernel'; import { PackageIdInput } from './PackageIdInput.js'; import { studioOrgScopePath } from './studioScope.js'; @@ -61,7 +67,7 @@ const RECENT_PACKAGES_SHOWN = 3; * read. No entry means the read has not answered: the line shows no number. */ type CustomizationLine = - | { kind: 'read'; counts: PackageCustomizationCounts } + | { kind: 'read'; counts: PackageCustomizationCounts; read: PackageCustomizations } | { kind: 'failed'; message: string }; /** A package's Studio address on one pillar, the way `open` below spells it. */ @@ -170,9 +176,14 @@ export function BuilderLanding(): React.ReactElement { if (!customizationTargetKey) return; let cancelled = false; for (const id of customizationTargetKey.split('\n')) { - fetchPackageCustomizationCounts(id).then( - (counts) => { - if (!cancelled) setCustomizationLines((prev) => ({ ...prev, [id]: { kind: 'read', counts } })); + // objectstack#34714 — the whole answer is kept: the card draws its two + // numbers off it and the "Customizations in this environment" panel its + // rows, so one read serves both and the panel's total is the cards' sum. + fetchPackageCustomizations(id).then( + (read) => { + if (!cancelled) { + setCustomizationLines((prev) => ({ ...prev, [id]: { kind: 'read', counts: customizationCountsOf(read), read } })); + } }, (e: unknown) => { const message = e instanceof Error ? e.message : String(e); @@ -184,6 +195,21 @@ export function BuilderLanding(): React.ReactElement { cancelled = true; }; }, [customizationTargetKey]); + // objectstack#34714 — the panel's apps are the cards' bases, in card order; + // its reads are the same answers the cards draw. + const customizationApps = React.useMemo( + () => readonly.filter((p) => !isCustomizationPackage(p.id)).map((p) => ({ id: p.id, name: p.name })), + // eslint-disable-next-line react-hooks/exhaustive-deps + [customizationTargetKey, pkgs], + ); + const customizationReads = React.useMemo(() => { + const out: Record = {}; + for (const [id, line] of Object.entries(customizationLines)) { + out[id] = line.kind === 'read' ? { kind: 'read', read: line.read } : line; + } + return out; + }, [customizationLines]); + // objectui#11553 — how many flows belong to no package: the same published // and draft union the package-less scope lists (`loadPackageLessSurfaces`). // The entry is drawn once the read says there is at least one; a failed read @@ -416,6 +442,15 @@ export function BuilderLanding(): React.ReactElement { )} + {/* objectstack#34714 — every change this deployment made to its + * installed apps, in one list, under the apps themselves. */} + +

{t('engine.studio.landing.ownHeading', locale)}

{writable.map((p) => ( diff --git a/ui/packages/app-shell/src/views/studio-design/LandingCustomizationsPanel.tsx b/ui/packages/app-shell/src/views/studio-design/LandingCustomizationsPanel.tsx new file mode 100644 index 00000000000..da7a639407f --- /dev/null +++ b/ui/packages/app-shell/src/views/studio-design/LandingCustomizationsPanel.tsx @@ -0,0 +1,275 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +/** + * objectstack#34714 — "Customizations in this environment": the Studio + * landing's one list of every change this deployment made to its installed + * apps, so "what did we change here" is answered without opening each app. + * + * The rows are the per-app customization read the landing already makes for + * each installed app's card (ADR-0146 D3), handed in whole: one read per app + * serves both the card's numbers and these rows, so the panel's total is the + * sum of the cards' "customized" and "switched off" by construction + * (`customizationRowsOf`, `landingCustomizations-io.ts`). Other packages' + * contributions make no row. + * + * Each row names the item (its label where the app's list gives one), what + * kind of item it is, which app it belongs to and how it changed it, and opens + * the item in Studio. Tabs narrow by kind, a search narrows by text, and the + * rows can be grouped by app; the first rows show, the rest behind "Show all". + * With no change anywhere the panel is one line. An app whose read failed (a + * 403 included) is named as unreadable, never counted as 0. + */ + +import * as React from 'react'; +import { Link } from 'react-router-dom'; +import { Search } from 'lucide-react'; +import { t, tFormat } from '../metadata-admin/i18n.js'; +import { useMetadataClient } from '../metadata-admin/useMetadata.js'; +import type { PackageCustomizations } from './packageCustomizations-io.js'; +import { + customizationRowsOf, + loadCustomizationLabels, + type CustomizationRow, +} from './landingCustomizations-io.js'; + +/** One app's read, as the landing holds it. */ +export type AppCustomizationRead = + | { kind: 'read'; read: Pick } + | { kind: 'failed'; message: string }; + +/** How many rows the panel shows before "Show all". */ +export const LANDING_CUSTOMIZATION_ROWS_SHOWN = 6; + +type Tab = 'all' | 'fields' | 'views' | 'flows' | 'switchedOff'; +const TABS: readonly Tab[] = ['all', 'fields', 'views', 'flows', 'switchedOff']; + +const inTab = (row: CustomizationRow, tab: Tab): boolean => { + switch (tab) { + case 'all': + return true; + case 'fields': + return row.mode === 'added' && row.type === 'field'; + case 'views': + return row.type === 'view' || row.type === 'form'; + case 'flows': + return row.type === 'flow'; + case 'switchedOff': + return row.mode === 'switchedOff'; + } +}; + +/** The kinds the panel names in words; any other type shows as served. */ +const NAMED_TYPES = new Set(['object', 'field', 'validation', 'index', 'view', 'flow', 'page', 'dashboard', 'report', 'action']); +const K = 'engine.studio.landing.envCustomizations'; + +export function LandingCustomizationsPanel({ + apps, + reads, + locale, + headingClass, +}: { + /** The installed apps whose cards are drawn, in card order (pairs excluded). */ + apps: ReadonlyArray<{ id: string; name: string }>; + /** Each app's read, by id; an app not yet answered is absent. */ + reads: Readonly>; + locale: string; + headingClass: string; +}): React.ReactElement | null { + const rows = React.useMemo( + () => + apps.flatMap((app) => { + const r = reads[app.id]; + return r?.kind === 'read' ? customizationRowsOf(app, r.read) : []; + }), + [apps, reads], + ); + const unreadable = apps.filter((app) => reads[app.id]?.kind === 'failed'); + const pending = apps.some((app) => !reads[app.id]); + + // Labels: one read per app and type that has rows, keyed on the rows drawn + // (ui/AGENTS.md #10: the effect reads the joined keys, a primitive). + const client = useMetadataClient(); + const [labels, setLabels] = React.useState>>({}); + const labelTargetKey = [...new Set(rows.map((r) => r.appId))] + .map((id) => `${id}\u0001${rows.filter((r) => r.appId === id).map((r) => r.labelKey).join('\u0002')}`) + .join('\n'); + React.useEffect(() => { + if (!labelTargetKey) return; + let cancelled = false; + for (const id of new Set(rows.map((r) => r.appId))) { + loadCustomizationLabels(client, id, rows, locale).then( + (found) => { + if (!cancelled) setLabels((prev) => ({ ...prev, [id]: found })); + }, + () => {}, + ); + } + return () => { + cancelled = true; + }; + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [labelTargetKey, locale]); + const labelOf = (row: CustomizationRow) => labels[row.appId]?.[row.labelKey] ?? row.name; + + const [tab, setTab] = React.useState('all'); + const [query, setQuery] = React.useState(''); + const [grouped, setGrouped] = React.useState(false); + const [expanded, setExpanded] = React.useState(false); + + if (apps.length === 0) return null; + + const typeText = (type: string) => (NAMED_TYPES.has(type) ? t(`${K}.type.${type}`, locale) : type); + const needle = query.trim().toLowerCase(); + const matches = (row: CustomizationRow) => + !needle || + [labelOf(row), row.name, row.type, typeText(row.type), row.appName, t(`${K}.mode.${row.mode}`, locale)].some((s) => + s.toLowerCase().includes(needle), + ); + const visible = rows.filter((r) => inTab(r, tab) && matches(r)); + const shown = grouped || expanded ? visible : visible.slice(0, LANDING_CUSTOMIZATION_ROWS_SHOWN); + + const renderRow = (row: CustomizationRow) => { + const label = labelOf(row); + return ( +
  • + + {label} + + + {`${t(`${K}.mode.${row.mode}`, locale)} · ${typeText(row.type)}${grouped ? '' : ` · ${row.appName}`}`} + +
  • + ); + }; + + const settled = !pending; + const nothing = settled && rows.length === 0 && unreadable.length === 0; + + return ( +
    +
    +

    {t(`${K}.heading`, locale)}

    + {rows.length > 0 && ( + + {rows.length} + + )} +
    + + {unreadable.map((app) => { + const r = reads[app.id]; + return ( +

    + {tFormat(`${K}.unreadable`, locale, { name: app.name })} +

    + ); + })} + + {pending && rows.length === 0 && ( +

    + {t(`${K}.loading`, locale)} +

    + )} + + {nothing && ( +

    + {t(`${K}.empty`, locale)} +

    + )} + + {rows.length > 0 && ( +
    +
    + {TABS.map((key) => { + const count = rows.filter((r) => inTab(r, key)).length; + return ( + + ); + })} + + +
    + + {visible.length === 0 ? ( +

    {t(`${K}.noMatch`, locale)}

    + ) : grouped ? ( + apps + .filter((app) => shown.some((r) => r.appId === app.id)) + .map((app) => ( +
    +

    {app.name}

    +
      {shown.filter((r) => r.appId === app.id).map(renderRow)}
    +
    + )) + ) : ( +
      {shown.map(renderRow)}
    + )} + + {!grouped && !expanded && visible.length > shown.length && ( + + )} +
    + )} +
    + ); +} diff --git a/ui/packages/app-shell/src/views/studio-design/landingCustomizations-io.ts b/ui/packages/app-shell/src/views/studio-design/landingCustomizations-io.ts new file mode 100644 index 00000000000..77e44c9006d --- /dev/null +++ b/ui/packages/app-shell/src/views/studio-design/landingCustomizations-io.ts @@ -0,0 +1,186 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +/** + * objectstack#34714 — the rows of the Studio landing's "Customizations in this + * environment" panel: every change this deployment made to its installed apps, + * in one list. + * + * The rows are the server's per-app customization read + * (`GET /api/v1/packages/:id/customizations`, ADR-0146 D3, D8 item 4), the same + * answer each installed app's card counts, one row per served entry: + * + * - `overrides` → "changed" (an item of the app the pair overrides); + * - `extensions` → "added" (a field, validation or index the pair adds to one + * of the app's objects); + * - `switchedOff` → "switched off" (an item of the app this deployment turned + * off). + * + * `contributions` (what OTHER packages bring to the app) are not this + * deployment's changes and make no row. Nothing is folded or deduped, so the + * panel's total is the cards' "customized" plus "switched off" by + * construction: the served counts are each list's length. + * + * The answer carries names, not labels. A row's label is read from the app's + * own published list of that type (one list per app and type that has rows); + * a field's from its object. A label that cannot be read leaves the row on its + * name: a failed label read never hides a row. + * + * ⛔ No diff against the app, no "based on" version and no clone lineage + * (ADR-0146 D6): a row says what changed and where, nothing more. + */ + +import { resolveI18nLabel, type I18nLabel } from '@objectstack/spec/ui'; +import type { PackageCustomizations } from './packageCustomizations-io.js'; +import { studioMetadataAreaPath } from './metadataArea.js'; + +/** How a row changed the app. */ +export type CustomizationMode = 'changed' | 'added' | 'switchedOff'; + +/** One row of the panel. */ +export interface CustomizationRow { + /** Stable key: app, mode and the entry's identity. */ + key: string; + appId: string; + appName: string; + mode: CustomizationMode; + /** + * The row's metadata type: the served `type` for a changed or switched-off + * item; for an added member its kind (`field`, `validation`, `index`). + */ + type: string; + /** The entry's name; for an added member, `object.name`. */ + name: string; + /** For an added member: the object it is added to. */ + object?: string; + /** The key {@link loadCustomizationLabels} answers a label under. */ + labelKey: string; + /** Where the row opens in Studio. */ + href: string; +} + +/** The address of one item on an app's metadata area; a pillar type opens its pillar from there. */ +const itemHref = (appId: string, type: string, name: string) => + `${studioMetadataAreaPath(appId)}/${encodeURIComponent(type)}/${encodeURIComponent(name)}`; + +/** The rows one app's served answer makes, in the served order: changed, added, switched off. */ +export function customizationRowsOf( + app: { id: string; name: string }, + read: Pick, +): CustomizationRow[] { + const rows: CustomizationRow[] = []; + for (const o of read.overrides) { + const name = o.member ? `${o.name} (${o.member})` : o.name; + rows.push({ + key: `${app.id}\u0000changed\u0000${o.type}\u0000${o.name}\u0000${o.member ?? ''}`, + appId: app.id, + appName: app.name, + mode: 'changed', + type: o.type, + name, + labelKey: `${o.type}:${o.name}`, + href: itemHref(app.id, o.type, o.name), + }); + } + read.extensions.forEach((e, i) => { + const member = e.name ?? (e.fields?.join(', ') || String(i + 1)); + rows.push({ + key: `${app.id}\u0000added\u0000${e.object}\u0000${e.kind}\u0000${e.name ?? `#${i}`}`, + appId: app.id, + appName: app.name, + mode: 'added', + type: e.kind, + name: `${e.object}.${member}`, + object: e.object, + labelKey: e.kind === 'field' && e.name ? `field:${e.object}.${e.name}` : `${e.kind}:${e.object}.${member}`, + // A member opens on its object: the Data pillar designs the object's fields and rules. + href: itemHref(app.id, 'object', e.object), + }); + }); + for (const s of read.switchedOff) { + rows.push({ + key: `${app.id}\u0000switchedOff\u0000${s.type}\u0000${s.name}`, + appId: app.id, + appName: app.name, + mode: 'switchedOff', + type: s.type, + name: s.name, + labelKey: `${s.type}:${s.name}`, + href: itemHref(app.id, s.type, s.name), + }); + } + return rows; +} + +/** The slice of the metadata client the label read uses. */ +export interface LabelClient { + list(type: string, options?: { packageId?: string }): Promise; +} + +const labelOf = (label: unknown, locale: string | undefined): string | undefined => { + if (label === null || label === undefined) return undefined; + const resolved = resolveI18nLabel(label as I18nLabel, locale)?.trim(); + return resolved || undefined; +}; + +/** A served object's fields, as a map or as a list, by name. */ +function fieldsOf(object: Record): Array<[string, unknown]> { + const fields = object.fields; + if (Array.isArray(fields)) { + return fields + .filter((f): f is Record => !!f && typeof f === 'object' && typeof (f as { name?: unknown }).name === 'string') + .map((f) => [String(f.name), f.label]); + } + if (fields && typeof fields === 'object') { + return Object.entries(fields as Record).map(([name, f]) => [ + name, + f && typeof f === 'object' ? (f as { label?: unknown }).label : undefined, + ]); + } + return []; +} + +/** + * Read the labels of one app's rows: one `list(type, { packageId })` per type + * its changed and switched-off rows name, and one `list('object', …)` when it + * has added fields. Answers `labelKey → label` for the labels it could read; a + * failed list leaves its rows out of the answer, so they keep their names. No + * row, no request. + */ +export async function loadCustomizationLabels( + client: LabelClient, + appId: string, + rows: readonly CustomizationRow[], + locale?: string, +): Promise> { + const mine = rows.filter((r) => r.appId === appId); + const types = new Set(mine.filter((r) => r.mode !== 'added').map((r) => r.type)); + const wantsFields = mine.some((r) => r.mode === 'added' && r.type === 'field'); + if (wantsFields) types.add('object'); + const labels: Record = {}; + await Promise.all( + [...types].map(async (type) => { + let items: unknown; + try { + items = await client.list(type, { packageId: appId }); + } catch { + return; + } + if (!Array.isArray(items)) return; + for (const raw of items) { + if (!raw || typeof raw !== 'object') continue; + const item = raw as Record; + const name = typeof item.name === 'string' ? item.name : ''; + if (!name) continue; + const label = labelOf(item.label, locale); + if (label) labels[`${type}:${name}`] = label; + if (type === 'object' && wantsFields) { + for (const [field, fieldLabel] of fieldsOf(item)) { + const l = labelOf(fieldLabel, locale); + if (l) labels[`field:${name}.${field}`] = l; + } + } + } + }), + ); + return labels; +} diff --git a/ui/packages/app-shell/src/views/studio-design/packageCustomizations-io.ts b/ui/packages/app-shell/src/views/studio-design/packageCustomizations-io.ts index 35f1c596a11..e3f0c088f1c 100644 --- a/ui/packages/app-shell/src/views/studio-design/packageCustomizations-io.ts +++ b/ui/packages/app-shell/src/views/studio-design/packageCustomizations-io.ts @@ -84,6 +84,16 @@ export async function fetchPackageCustomizations(baseId: string): Promise { - const { counts } = await fetchPackageCustomizations(baseId); + return customizationCountsOf(await fetchPackageCustomizations(baseId)); +} + +/** + * The two numbers a card draws, off one served answer: "customized" is the + * served overrides plus the served extensions, "switched off" the served + * switched-off count. Pure, so a reader that holds the whole answer (the + * landing, which also lists its rows, objectstack#34714) draws the same + * numbers without a second request. + */ +export function customizationCountsOf({ counts }: Pick): PackageCustomizationCounts { return { customized: counts.overrides + counts.extensions, switchedOff: counts.switchedOff }; } diff --git a/ui/packages/i18n/src/namespaces/studio/en.ts b/ui/packages/i18n/src/namespaces/studio/en.ts index 2387370b143..f2408dcbfe5 100644 --- a/ui/packages/i18n/src/namespaces/studio/en.ts +++ b/ui/packages/i18n/src/namespaces/studio/en.ts @@ -3454,6 +3454,36 @@ const STUDIO_EN: Record = { 'engine.studio.landing.rolesPermissions.description': 'Positions, permission sets and sharing rules, shared by every app.', 'engine.studio.landing.unassignedFlows.name': 'Flows in no app', 'engine.studio.landing.unassignedFlows.description': 'Flows that belong to no app, such as a copy of an app’s flow. They open editable.', + // objectstack#34714 — the landing's "Customizations in this environment" panel. + 'engine.studio.landing.envCustomizations.heading': 'Customizations in this environment', + 'engine.studio.landing.envCustomizations.totalTitle': '{count} changes across the installed apps', + 'engine.studio.landing.envCustomizations.loading': 'Reading what this environment changed…', + 'engine.studio.landing.envCustomizations.empty': 'No installed app has been changed in this environment yet.', + 'engine.studio.landing.envCustomizations.unreadable': '{name}: this app’s customizations could not be read.', + 'engine.studio.landing.envCustomizations.tab.all': 'All', + 'engine.studio.landing.envCustomizations.tab.fields': 'New fields', + 'engine.studio.landing.envCustomizations.tab.views': 'Forms and views', + 'engine.studio.landing.envCustomizations.tab.flows': 'Flows', + 'engine.studio.landing.envCustomizations.tab.switchedOff': 'Switched off', + 'engine.studio.landing.envCustomizations.search': 'Search customizations', + 'engine.studio.landing.envCustomizations.groupByApp': 'Group by app', + 'engine.studio.landing.envCustomizations.ungroup': 'One list', + 'engine.studio.landing.envCustomizations.showAll': 'Show all {count}', + 'engine.studio.landing.envCustomizations.noMatch': 'No customization matches.', + 'engine.studio.landing.envCustomizations.mode.changed': 'Changed', + 'engine.studio.landing.envCustomizations.mode.added': 'Added', + 'engine.studio.landing.envCustomizations.mode.switchedOff': 'Switched off', + 'engine.studio.landing.envCustomizations.type.object': 'Object', + 'engine.studio.landing.envCustomizations.type.field': 'Field', + 'engine.studio.landing.envCustomizations.type.validation': 'Validation rule', + 'engine.studio.landing.envCustomizations.type.index': 'Index', + 'engine.studio.landing.envCustomizations.type.view': 'View', + 'engine.studio.landing.envCustomizations.type.flow': 'Flow', + 'engine.studio.landing.envCustomizations.type.page': 'Page', + 'engine.studio.landing.envCustomizations.type.dashboard': 'Dashboard', + 'engine.studio.landing.envCustomizations.type.report': 'Report', + 'engine.studio.landing.envCustomizations.type.action': 'Action', + 'engine.studio.landing.envCustomizations.rowTitle': 'Open {name} in {app}', // objectstack#28561 — assignments are Setup's (ADR-0146 D7): the area links // the Setup page in place of the section. 'engine.studio.area.assignments.position': 'The people who hold this position are assigned in Setup.', diff --git a/ui/packages/i18n/src/namespaces/studio/zh.ts b/ui/packages/i18n/src/namespaces/studio/zh.ts index ab5164daba9..d416feb9b2e 100644 --- a/ui/packages/i18n/src/namespaces/studio/zh.ts +++ b/ui/packages/i18n/src/namespaces/studio/zh.ts @@ -3046,6 +3046,36 @@ const STUDIO_ZH: Record = { 'engine.studio.landing.rolesPermissions.description': '岗位、权限集、共享规则,所有应用共用。', 'engine.studio.landing.unassignedFlows.name': '未归属的流程', 'engine.studio.landing.unassignedFlows.description': '不属于任何应用的流程,例如应用流程的副本。可直接编辑。', + // objectstack#34714 — the landing's "Customizations in this environment" panel. + 'engine.studio.landing.envCustomizations.heading': '本环境的定制', + 'engine.studio.landing.envCustomizations.totalTitle': '已安装的应用上共 {count} 处改动', + 'engine.studio.landing.envCustomizations.loading': '正在读取本环境的改动…', + 'engine.studio.landing.envCustomizations.empty': '本环境还没有改过任何已安装的应用。', + 'engine.studio.landing.envCustomizations.unreadable': '{name}:这个应用的定制读不到。', + 'engine.studio.landing.envCustomizations.tab.all': '全部', + 'engine.studio.landing.envCustomizations.tab.fields': '新增字段', + 'engine.studio.landing.envCustomizations.tab.views': '表单与视图', + 'engine.studio.landing.envCustomizations.tab.flows': '流程', + 'engine.studio.landing.envCustomizations.tab.switchedOff': '已停用', + 'engine.studio.landing.envCustomizations.search': '搜索定制', + 'engine.studio.landing.envCustomizations.groupByApp': '按应用分组', + 'engine.studio.landing.envCustomizations.ungroup': '合成一张清单', + 'engine.studio.landing.envCustomizations.showAll': '显示全部 {count} 项', + 'engine.studio.landing.envCustomizations.noMatch': '没有匹配的定制。', + 'engine.studio.landing.envCustomizations.mode.changed': '改了原有的', + 'engine.studio.landing.envCustomizations.mode.added': '新增的', + 'engine.studio.landing.envCustomizations.mode.switchedOff': '已停用', + 'engine.studio.landing.envCustomizations.type.object': '对象', + 'engine.studio.landing.envCustomizations.type.field': '字段', + 'engine.studio.landing.envCustomizations.type.validation': '校验规则', + 'engine.studio.landing.envCustomizations.type.index': '索引', + 'engine.studio.landing.envCustomizations.type.view': '视图', + 'engine.studio.landing.envCustomizations.type.flow': '流程', + 'engine.studio.landing.envCustomizations.type.page': '页面', + 'engine.studio.landing.envCustomizations.type.dashboard': '仪表盘', + 'engine.studio.landing.envCustomizations.type.report': '报表', + 'engine.studio.landing.envCustomizations.type.action': '动作', + 'engine.studio.landing.envCustomizations.rowTitle': '在 {app} 里打开 {name}', 'engine.studio.area.assignments.position': '此岗位的任职人员在设置中分配。', 'engine.studio.area.assignments.permission': '此权限集分配给哪些人,在设置中管理。', 'engine.studio.area.assignments.open': '在设置中打开', From 9f4237471fbc54d1ae18f2d174992adc8e6b0cad Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 17 Nov 2026 10:07:35 +0000 Subject: [PATCH 8/8] chore(changeset): the landing's customizations panel (#34714) Claude-Session: https://claude.ai/code/session_01WGufzivEnnozveqZfr4fDx Co-authored-by: Claude --- .../34714-studio-landing-env-customizations.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .changeset/34714-studio-landing-env-customizations.md diff --git a/.changeset/34714-studio-landing-env-customizations.md b/.changeset/34714-studio-landing-env-customizations.md new file mode 100644 index 00000000000..a7cb753b9cc --- /dev/null +++ b/.changeset/34714-studio-landing-env-customizations.md @@ -0,0 +1,18 @@ +--- +'@object-ui/i18n': patch +--- + +feat(console): the Studio landing lists every change this environment made to its installed apps in one panel + +Clause-②: yes (widening) +Metadata-protocol: none + +The Studio landing gains a **Customizations in this environment** panel under the installed apps, so "what did we change here" no longer means opening each app. + +- One row per change, read from each installed app's customization read (`GET /api/v1/packages/:id/customizations`, the read its card already makes): items the app's customization package overrides read **Changed**, fields, validation rules and indexes it adds read **Added**, the app's items switched off in this environment read **Switched off**. What other packages contribute is not this environment's change and makes no row. +- Each row names the item (its label where the app's list gives one, else its name), its kind and its app, and opens it in Studio. +- Tabs narrow the list (All, New fields, Forms and views, Flows, Switched off), a search narrows it by text, and the rows can be grouped by app. The first six rows show; the rest are behind "Show all". +- The panel's total equals the cards' "customized" plus "switched off": one read per app now serves both the card and the panel. +- With no change anywhere the panel is one line. An app whose read fails (a 403 included) is named as unreadable, never counted as 0. + +New keys under `engine.studio.landing.envCustomizations.*` in the studio namespace (en, zh). No server change.