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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .changeset/36908-remove-studio-home.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---
'@object-ui/app-shell': patch
'@object-ui/console': patch
Expand All @@ -13,7 +13,7 @@

- **Opening Studio** takes you to the package you were last in, if it is still installed. Otherwise an administrator lands on Setup → Packages, and a developer who cannot open that Setup page lands on the All metadata area. The 应用构建 entry of the Studio app goes to the same place.
- **New package.** 「New blank app」 (formerly 「New in Studio」) on Home, on the AI-unavailable screen and in the 「Add app」 menu opens Setup → Packages with the New Package dialog already open; a developer who cannot open Setup → Packages is taken to the All metadata area instead. After the package is created you land in Studio on it. An old bookmark to Studio's new-package page makes the same choice. Creating a package and its app in one step comes with a later change; for now this creates the package only.
- **What this environment changed on an installed app.** The "n customized, m switched off" line and the "Customizations in this environment" panel are now in the app's detail in Setup → Packages, with a 「Customize in Studio」 link. The count now includes tab, field-group and action-layout arrangements, so an app whose only change is a tab arrangement shows as customized. The list across all installed apps at once is now shown one app at a time.
- **What this environment changed on an installed app.** The "n customized, m switched off" line and the "Customizations in this environment" panel are now in the app's detail in Setup → Packages, with a 「Customize in Studio」 link. Tab, field-group and action-layout arrangements are named on their own in that line, not counted as customized. The list across all installed apps at once is now shown one app at a time.
- **The 「Add app」 menu** no longer offers 「Build with AI」, and neither do the buttons on the "No applications yet" screen. 「New blank app」 is now always offered wherever apps can be built, whether or not the AI build assistant is available, so the menu is never empty for someone who may add an app; a menu with nothing to offer is not shown. Home's own 「Build with AI」 button is unchanged.
- **Organization flows and the environment catalog** are in Studio's left menu.
- **A package Studio cannot find** offers a way to Setup → Packages, or to the All metadata area for a developer who cannot open that page. A retired Setup page whose address names no package opens Setup → Packages.
Expand Down
13 changes: 13 additions & 0 deletions .changeset/37236-customized-means-one-thing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
'@object-ui/app-shell': patch
'@object-ui/i18n': patch
---

fix(console): "customized" means one thing everywhere; Setup → Packages names an app's arrangements apart

Clause-②: no
Metadata-protocol: none

In Setup → Packages, an installed app's "Customizations in this environment" line now counts as customized only the items this environment changed or added on the app (overrides and extensions), the same number the All metadata header shows and the same rule its lists' 「customized」 filter uses. Tab, field-group and action-layout arrangements are not counted as customizations any more: they are named on their own in the same line, and only when there are any — for example "3 customized, 2 rearranged, 1 switched off" (「已定制 3 项,调整排列 2 处,已停用 1 项」).

An app whose only change is an arrangement now reads "0 customized, 2 rearranged, 0 switched off" instead of "2 customized", and still lists both arrangements under the section's 「布局」 tab. The All metadata header and the 「customized」 filter are unchanged.
Original file line number Diff line number Diff line change
Expand Up @@ -869,15 +869,15 @@ async function settledSheet(sheet: HTMLElement) {
}

describe('Setup → Packages: a read-only base’s customizations in its detail (objectstack#36908)', () => {
it('a code package’s detail draws what this deployment changed on it, arrangements counted (objectstack#36833)', async () => {
it('a code package’s detail draws what this deployment changed on it, its arrangement named apart (objectstack#37236)', async () => {
await serve({ packages: [CODE] });
renderAt(ADMIN_URL);
fireEvent.click(await screen.findByTestId('pkg-row-com.acme.code'));
const sheet = await screen.findByRole('dialog');

const section = within(sheet).getByTestId('pkg-detail-customizations');
await waitFor(() =>
expect(within(section).getByTestId('pkg-detail-customizations-summary')).toHaveTextContent('1 customized, 0 switched off'),
expect(within(section).getByTestId('pkg-detail-customizations-summary')).toHaveTextContent('0 customized, 1 rearranged, 0 switched off'),
);
expect(within(section).getByTestId('pkg-detail-customize')).toHaveAttribute('href', '/studio/com.acme.code/data');
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@
* - a failed read draws no mark, no filter and no number, with the server's sentence;
* - a base without a pair is unchanged, and Setup (no area) never reads;
* - in the cross-package leg an item of a pair is labelled with its base;
* - objectstack#30063 — the page tile counts a page's override.
* - objectstack#30063 — the page tile counts a page's override;
* - objectstack#37236 — "customized" is overrides + extensions alone
* (`customizationTotal`): a base whose only change is an arrangement draws
* no header total, and neither list offers it the "customized" filter.
*/

// Paid at collection, not inside a case's clock (check:test-source-alias).
Expand All @@ -37,13 +40,16 @@ import { MetadataAreaHostContext, type MetadataAreaHost } from './metadataAreaHo
const BASE = 'hotcrm';
const PAIR = 'hotcrm.custom';
const PLAIN = 'com.example.crm';
/** objectstack#37236 — a base whose pair's only change is an arrangement. */
const ARRANGED = 'com.example.arranged';

const LISTS: Record<string, Record<string, unknown>[]> = {
// A served override is served as the base's item, under the base's id.
translation: [
{ name: 'crm_en', label: 'CRM English', _packageId: BASE },
{ name: 'crm_de', label: 'CRM German', _packageId: BASE },
{ name: 'plain_en', label: 'Plain English', _packageId: PLAIN },
{ name: 'arranged_en', label: 'Arranged English', _packageId: ARRANGED },
],
email_template: [
{ name: 'welcome', label: 'Welcome', locale: 'en', _packageId: BASE },
Expand Down Expand Up @@ -103,6 +109,7 @@ vi.mock('../../hooks/useCanAuthorMetadata', async (importOriginal) => ({

import { MetadataDirectoryPage } from './DirectoryPage';
import { MetadataResourceListPage } from './ResourceListPage';
import { useListOrderedNames } from './useListOrderedNames';
import { registerDefaultMetadataSchemas } from './default-schemas';
import { t, tFormat } from './i18n';

Expand All @@ -121,6 +128,19 @@ const HOTCRM_READ = {
contributions: [],
counts: { overrides: 2, extensions: 1, switchedOff: 0, arrangements: 0, contributions: 0 },
};
/** objectstack#37236 — two arrangements, no override, no extension. */
const ARRANGED_READ = {
packageId: ARRANGED,
overrides: [],
extensions: [],
switchedOff: [],
arrangements: [
{ object: 'crm_account', key: 'relatedLists' },
{ object: 'crm_account', key: 'fieldGroups' },
],
contributions: [],
counts: { overrides: 0, extensions: 0, switchedOff: 0, arrangements: 2, contributions: 0 },
};
const EMPTY_READ = { packageId: PLAIN, overrides: [], extensions: [], switchedOff: [], arrangements: [], contributions: [], counts: { overrides: 0, extensions: 0, switchedOff: 0, arrangements: 0, contributions: 0 } };

let customizationsFail = false;
Expand All @@ -144,7 +164,8 @@ const fetchMock = vi.fn(async (url: string) => {
return json(503, { success: false, error: { code: 'SERVICE_UNAVAILABLE', message: 'The customization ledger is unavailable.' } });
}
const hotcrm = readListsPage ? withPage(HOTCRM_READ) : HOTCRM_READ;
return json(200, { success: true, data: decodeURIComponent(m[1]) === BASE ? hotcrm : EMPTY_READ });
const id = decodeURIComponent(m[1]);
return json(200, { success: true, data: id === BASE ? hotcrm : id === ARRANGED ? ARRANGED_READ : EMPTY_READ });
}
if (u.startsWith('/api/v1/data/sys_metadata_activation')) {
return json(200, { object: 'sys_metadata_activation', records: [], hasMore: false });
Expand Down Expand Up @@ -305,3 +326,57 @@ describe('the All metadata directory counts a base\'s customizations (objectstac
expect(screen.queryAllByTestId(/^directory-tile-customized-/)).toEqual([]);
});
});

/** The detail's ‹ › names (`useListOrderedNames`), drawn for a pin to read. */
function OrderedProbe({ type }: { type: string }) {
const ordered = useListOrderedNames(type);
return (
<output data-testid="ordered" data-status={ordered.status}>
{ordered.names.join(',')}
</output>
);
}

function mountOrdered(host: MetadataAreaHost, type: string, search: string) {
return render(
<MetadataAreaHostContext.Provider value={host}>
<MemoryRouter initialEntries={[`${host.basePath}/${type}/x${search}`]}>
<OrderedProbe type={type} />
</MemoryRouter>
</MetadataAreaHostContext.Provider>,
);
}

describe('objectstack#37236 — "customized" is overrides + extensions, never an arrangement', () => {
it('the directory header draws no total for a base whose only change is an arrangement', async () => {
mountDirectory(area(ARRANGED));
await vi.waitFor(() => expect(customizationReads()).toEqual([`/api/v1/packages/${ARRANGED}/customizations`]));
// Let the read's answer render, then look.
await new Promise((r) => setTimeout(r, 0));
expect(screen.queryByTestId('directory-customizations-failed')).toBeNull();
expect(screen.queryByTestId('directory-customizations-total')).toBeNull();
expect(screen.queryAllByTestId(/^directory-tile-customized-/)).toEqual([]);
});

it('the list offers no "customized" filter to a base whose only change is an arrangement', async () => {
mountList(area(ARRANGED), 'translation', `?package=${ARRANGED}`);
await screen.findByTestId('metadata-row-arranged_en');
await vi.waitFor(() => expect(customizationReads()).toEqual([`/api/v1/packages/${ARRANGED}/customizations`]));
await new Promise((r) => setTimeout(r, 0));
expect(screen.queryByTestId('metadata-customizations-failed')).toBeNull();
expect(screen.queryByTestId('metadata-only-customizations')).toBeNull();
expect(marksOf('arranged_en')).toEqual([]);
});

it('the detail ‹ › names: "only customizations" is not offered to it, so it filters nothing out', async () => {
mountOrdered(area(ARRANGED), 'translation', '?customized=1');
await vi.waitFor(() => expect(screen.getByTestId('ordered')).toHaveAttribute('data-status', 'ready'));
expect(screen.getByTestId('ordered')).toHaveTextContent(/^arranged_en$/);
});

it('CONTROL: for HotCRM, whose pair overrides, the same ‹ › names keep only the customized row', async () => {
mountOrdered(area(BASE), 'translation', '?customized=1');
await vi.waitFor(() => expect(screen.getByTestId('ordered')).toHaveAttribute('data-status', 'ready'));
expect(screen.getByTestId('ordered')).toHaveTextContent(/^crm_en$/);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
* objectstack#36908 — an installed app's "Customizations in this environment"
* in its Setup → Packages detail: the removed Studio home's panel
* (objectstack#34714) and its card line (ADR-0146 D3), one app at a time.
* objectstack#36833 — "customized" counts the pair's arrangements too: an app
* whose only change is a tab arrangement is customized.
* objectstack#37236 — "customized" means overrides + extensions everywhere
* (`customizationTotal`); arrangements are not customizations and are named
* apart, so an app whose only change is a tab arrangement reads "0 customized"
* beside its arrangement count.
*
* The real panel and the real customization reader (`packageCustomizations-io`)
* run under a real router; the wire of the customization route and the
Expand Down Expand Up @@ -34,7 +36,7 @@ vi.mock('../metadata-admin/useMetadata.js', async (importOriginal) => ({
}));

import { PACKAGE_CUSTOMIZATION_ROWS_SHOWN, PackageCustomizationsPanel } from './PackageCustomizationsPanel';
import { customizationRowsOf, customizedCountOf, loadCustomizationLabels } from './packageCustomizationRows';
import { customizationRowsOf, loadCustomizationLabels } from './packageCustomizationRows';
import { t } from '../metadata-admin/i18n';
import type { PackageCustomizations } from './packageCustomizations-io';

Expand Down Expand Up @@ -131,21 +133,40 @@ describe('Setup → Packages: an installed app’s customizations (objectstack#3
renderPanel();

await waitFor(() => expect(summary()).toHaveAttribute('data-state', 'read'));
expect(summary()).toHaveTextContent('3 customized, 1 switched off');
// objectstack#37236: the arrangement is named apart, not counted as customized.
expect(summary()).toHaveTextContent('2 customized, 1 rearranged, 1 switched off');
expect(rows().map((r) => r.getAttribute('data-mode'))).toEqual(['changed', 'added', 'arranged', 'switchedOff']);
await waitFor(() => expect(rows()[0]).toHaveTextContent('All accounts'));
expect(within(rows()[2]).getByTestId('pkg-detail-customization-meta')).toHaveTextContent('Rearranged · Tabs');
// The label read asks the app's own lists, one per type with rows.
expect(lists.asked.sort()).toEqual([`flow@${APP}`, `object@${APP}`, `view@${APP}`]);
});

it('objectstack#36833: an app whose only change is a tab arrangement is customized, on its own tab', async () => {
stubWire(200, served({ arrangements: [{ object: 'account', key: 'relatedLists' }] }));
it('objectstack#37236: an arrangement-only app reads 0 customized beside its arrangement count, its rows still listed', async () => {
stubWire(
200,
served({
arrangements: [
{ object: 'account', key: 'relatedLists' },
{ object: 'account', key: 'fieldGroups' },
],
}),
);
renderPanel();

await waitFor(() => expect(summary()).toHaveTextContent('1 customized, 0 switched off'));
expect(tab('arranged')).toHaveTextContent('1');
expect(rows()).toHaveLength(1);
await waitFor(() => expect(summary()).toHaveAttribute('data-state', 'read'));
expect(summary().textContent).toBe('0 customized, 2 rearranged, 0 switched off');
// The rows are unchanged: both arrangements are listed, on their own tab.
expect(tab('arranged')).toHaveTextContent('2');
expect(rows().map((r) => r.getAttribute('data-mode'))).toEqual(['arranged', 'arranged']);
});

it('objectstack#37236: no arrangement, no arrangement segment', async () => {
stubWire(200, served({ overrides: [{ type: 'view', name: 'account_list' }] }));
renderPanel();

await waitFor(() => expect(summary()).toHaveAttribute('data-state', 'read'));
expect(summary().textContent).toBe('1 customized, 0 switched off');
});

it('with no change the section says so in one line and draws no list', async () => {
Expand Down Expand Up @@ -219,10 +240,11 @@ describe('Setup → Packages: an installed app’s customizations (objectstack#3
expect(rows()).toHaveLength(PACKAGE_CUSTOMIZATION_ROWS_SHOWN + 2);
});

it('zh-CN: the section speaks the card’s words', async () => {
it('zh-CN: the section speaks the card’s words; an arrangement-only app is 已定制 0 项 beside 调整排列', async () => {
stubWire(200, served({ arrangements: [{ object: 'account', key: 'relatedLists' }] }));
renderPanel('zh');
await waitFor(() => expect(summary()).toHaveTextContent('已定制 1 项,已停用 0 项'));
await waitFor(() => expect(summary()).toHaveAttribute('data-state', 'read'));
expect(summary().textContent).toBe('已定制 0 项,调整排列 1 处,已停用 0 项');
expect(screen.getByText('本环境的定制')).toBeInTheDocument();
expect(within(rows()[0]).getByTestId('pkg-detail-customization-meta')).toHaveTextContent('重新排列 · 页签');
});
Expand All @@ -246,10 +268,6 @@ describe('the section’s rows, count and labels (objectstack#36908)', () => {
]);
});

it('objectstack#36833: "customized" is overrides + extensions + arrangements', () => {
expect(customizedCountOf(read)).toBe(3);
});

it('a switched-off action with no object read opens its own page', () => {
const rowsOf = customizationRowsOf(APP, { ...served(), switchedOff: [{ type: 'action', name: 'export_all' }] });
expect(rowsOf[0].href).toBe(`/studio/${APP}/metadata/action/export_all`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,14 @@
* that app's detail, one app at a time.
*
* The numbers and the rows are the server's per-package customization read
* (`GET /api/v1/packages/:id/customizations`): "customized" counts the pair's
* overrides, extensions and arrangements (objectstack#36833: an app whose only
* change is a tab arrangement is customized), "switched off" the ledger's
* switched-off items. Each row names the item (its label where the app's list
* (`GET /api/v1/packages/:id/customizations`): "customized" is
* `customizationTotal`, the pair's overrides and extensions, the one meaning
* the All metadata header and both lists' "customized" filter read
* (objectstack#37236). Arrangements are not customizations: they are named
* apart ("2 rearranged"), and only when there are any, so an app whose only
* change is a tab arrangement reads "0 customized" beside its arrangement
* count, never "No changes". "Switched off" counts the ledger's switched-off
* items. Each row names the item (its label where the app's list
* gives one), what kind of item it is and how it changed, and opens the item
* in Studio. Tabs narrow by kind and a search by text; the first rows show,
* the rest behind "Show all". A read that fails says so, never "0".
Expand All @@ -29,9 +33,9 @@ import { t, tFormat } from '../metadata-admin/i18n.js';
import { useMetadataClient } from '../metadata-admin/useMetadata.js';
import { fetchPackageCustomizations } from './packageCustomizations-io.js';
import { readActionObjects, type ActionObjects } from './switchedOffActionTargets.js';
import { customizationTotal } from './customizationMarks.js';
import {
customizationRowsOf,
customizedCountOf,
loadCustomizationLabels,
type CustomizationRow,
} from './packageCustomizationRows.js';
Expand Down Expand Up @@ -67,7 +71,7 @@ const K = 'engine.packages.customizations';
type ReadState =
| { status: 'loading' }
| { status: 'failed'; message: string }
| { status: 'read'; rows: CustomizationRow[]; customized: number; switchedOff: number };
| { status: 'read'; rows: CustomizationRow[]; customized: number; arranged: number; switchedOff: number };

export function PackageCustomizationsPanel({
packageId,
Expand Down Expand Up @@ -97,7 +101,8 @@ export function PackageCustomizationsPanel({
return {
status: 'read' as const,
rows: customizationRowsOf(packageId, read, actionObjects),
customized: customizedCountOf(read),
customized: customizationTotal(read),
arranged: read.counts.arrangements,
switchedOff: read.counts.switchedOff,
};
})
Expand Down Expand Up @@ -187,13 +192,15 @@ export function PackageCustomizationsPanel({
)}
{state.status === 'read' && (
<p data-testid="pkg-detail-customizations-summary" data-state="read" className="text-xs text-muted-foreground">
{state.customized === 0 && state.switchedOff === 0
{state.customized === 0 && state.arranged === 0 && state.switchedOff === 0
? t(`${K}.none`, locale)
: `${tFormat(`${K}.customized`, locale, { count: state.customized })}${t(`${K}.separator`, locale)}${tFormat(
`${K}.switchedOff`,
locale,
{ count: state.switchedOff },
)}`}
: [
tFormat(`${K}.customized`, locale, { count: state.customized }),
// Arrangements are not customizations (objectstack#37236): their own
// segment, drawn only when there are any.
...(state.arranged > 0 ? [tFormat(`${K}.arranged`, locale, { count: state.arranged })] : []),
tFormat(`${K}.switchedOff`, locale, { count: state.switchedOff }),
].join(t(`${K}.separator`, locale))}
</p>
)}

Expand Down
Loading
Loading