diff --git a/.changeset/36903-flow-designer-fullscreen.md b/.changeset/36903-flow-designer-fullscreen.md new file mode 100644 index 00000000000..6121054fcec --- /dev/null +++ b/.changeset/36903-flow-designer-fullscreen.md @@ -0,0 +1,38 @@ +--- +'@object-ui/app-shell': patch +'@object-ui/i18n': patch +--- + +feat(studio): a flow opens full-screen in its own page; the Automations pillar's flow list is gone + +Clause-②: yes (narrowing) +Metadata-protocol: none +Skills-docs: none — no page under `skills/` or `content/docs/` names the Automations rail's strings or teaches overriding a Studio console string + + + +**BREAKING** for a host that overrides one of the nine studio console strings listed under "Removed translation keys" below: they are retired with the Automations pillar's flow list in 19.0.0, and an override of one of them no longer applies. + +In Studio, a flow now opens on its own page, full-screen beside the left menu, from the flow list in "All metadata", instead of in the Automations pillar's flow list and canvas. Its header is the one every full-screen item page has: × goes back to the flow list with its filters and sort kept, ‹ › step through the list in its order, and the flow's label, type and package are shown, with its machine name in a chip beside the label. A ⋯ menu holds New similar and Delete flow. The header still shows the flow's Trigger, Status (the engine's run status), Run as and version, and the Enabled switch (or, on a read-only package, the activation switch). The tab row holds the designer's Canvas, Variables, Runs, Problems and Debug, then References, History and Source, which replace the item-tools menu and its side sheets; a refreshed or shared link reopens the same tab. Save stays in the Studio top bar and still publishes that one flow, pinned to the version it was loaded at. Leaving with unsaved edits (×, ‹ ›, the menu, the Changes sheet, a reload, closing the tab) asks first. + +A flow is created from the flow list's 「新建」, with the same starting points, and that create refuses to overwrite a flow published under the same name, as the pillar's did. When the name is taken by a flow in this package, the dialog says so and offers to open it. New similar opens the copy on its own page, with a strip saying where it landed. Deleting a flow returns to the flow list. The copilot still knows which flow is open, and still refreshes it after its edits. + +The organization's own flows, which belong to no package, have their own flow list and open on their own pages; that list offers no 「新建」, as before, and when it is empty it says how a packaged flow is changed instead (open its package and use New similar). + +Old bookmarks keep working. A link to a flow in the Automations pillar opens that flow's page, and a link to the pillar itself opens the flow list, for a package, a read-only package's customizations and the organization's own flows alike. A flow's History link opens its History tab. A link naming a flow the package does not hold says so and opens no other flow; one naming a flow that belongs to no package opens it among the organization's flows. A flow's draft-review link (and the environment view) opens the general item page with its review, as it did when flows had a pillar. A permission set's review link keeps opening its matrix page, as before. + +The flow list has no column yet for a flow's trigger object or its run status; until it has one, both are shown in the flow's header. + +Removed translation keys (studio namespace of `@object-ui/i18n`, released in 18.6.0; no code reads them since the flow list left the designer). Each is removed from both packs it shipped in, `en` and `zh`: + +- `engine.studio.auto.heading` (en, zh) +- `engine.studio.auto.none` (en, zh) +- `engine.studio.auto.emptyMain` (en, zh) +- `engine.studio.auto.group.noObject` (en, zh) +- `engine.studio.auto.kind.record` (en, zh) +- `engine.studio.auto.kind.scheduled` (en, zh) +- `engine.studio.auto.kind.screen` (en, zh) +- `engine.studio.auto.kind.autolaunched` (en, zh) +- `engine.studio.auto.legend` (en, zh) + +An override of one of these keys no longer applies; delete it. `engine.studio.org.none` is kept: the organization's empty flow list shows it. diff --git a/ui/packages/app-shell/README.md b/ui/packages/app-shell/README.md index 0c21b3fad82..653ae39c155 100644 --- a/ui/packages/app-shell/README.md +++ b/ui/packages/app-shell/README.md @@ -793,21 +793,26 @@ On the declared page: rule already switched off has no served projection, so its clone continues in the pre-filled New form, which asks for the criteria. -### Package-less flows (`/studio/~org/automations`) +### Package-less flows (`/studio/~org/metadata/flow`) A flow that belongs to no package — a clone of a packaged flow is one, by ADR-0126 §7.1 — matches no package scope, so Studio gives it one scope of its -own: `/studio/~org/automations` (`studioOrgScopePath()`, segment -`STUDIO_ORG_SCOPE_SEGMENT`). It is the same `StudioDesignSurface` with no -package under it, reached from the Studio home and from the package switcher. -Its Automations rail lists every flow whose served `_packageId` names no -package, opens each one editable, and saves package-less drafts; its Publish -promotes those drafts one by one through the single-item publish door, because -the package batch publish cannot reach a draft bound to no package. It offers -no other pillar and no "New" flow. `~` is outside every package-id alphabet, -so the segment can never name a package. A `?surface=flow:` deep link that -names a flow the open rail does not hold opens no other flow in its place; -from a package's pillar, a package-less flow is opened in this scope instead. +own, segment `STUDIO_ORG_SCOPE_SEGMENT` (`~org`): its own leg of the "All +metadata" area. The list is `/studio/~org/metadata/flow?source=runtime` and a +flow opens full-screen in the flow designer at +`/studio/~org/metadata/flow/?source=runtime` (`studioOrgScopePath()`, +`orgScopeFlowOf()`). It is the same `StudioDesignSurface` with no package under +it, reached from the Studio home and the left menu. The list holds every flow +whose served `_packageId` names no package and offers no create; each flow opens +editable and saves package-less drafts. An empty list says how a packaged flow +is changed instead (in its package, with New similar). Publish promotes the +scope's drafts one by one through the single-item publish door, because the +package batch publish cannot reach a draft bound to no package. `~` is outside +every package-id alphabet, so the segment can never name a package. A package's +address naming a package-less flow opens it in this scope; one naming a flow +nowhere held says so and opens no other flow. The retired +`/studio/~org/automations` addresses (with or without `?surface=flow:`) +redirect to the list or the flow (objectstack#36903). ### Access matrix (package-scoped) diff --git a/ui/packages/app-shell/src/chrome/CommandPalette.studioScope-11863.test.tsx b/ui/packages/app-shell/src/chrome/CommandPalette.studioScope-11863.test.tsx index 5187b5660c4..9282aa0b4cf 100644 --- a/ui/packages/app-shell/src/chrome/CommandPalette.studioScope-11863.test.tsx +++ b/ui/packages/app-shell/src/chrome/CommandPalette.studioScope-11863.test.tsx @@ -214,7 +214,7 @@ describe('the palette in the `studio` scope lists the Studio, not an app (object await studioListed(); pick('studio-flow Onboard Account '); await waitFor(() => - expect(locationNow()).toBe('/studio/com.acme.crm/automations?surface=flow%3Acrm_onboard'), + expect(locationNow()).toBe('/studio/com.acme.crm/metadata/flow/crm_onboard'), ); }); @@ -222,7 +222,7 @@ describe('the palette in the `studio` scope lists the Studio, not an app (object mountStudio(); await studioListed(); pick('studio-flow Nightly Cleanup '); - await waitFor(() => expect(locationNow()).toBe('/studio/~org/automations?surface=flow%3Aorg_cleanup')); + await waitFor(() => expect(locationNow()).toBe('/studio/~org/metadata/flow/org_cleanup?source=runtime')); }); it('matches an entry by its label or its machine name', async () => { diff --git a/ui/packages/app-shell/src/console/ai/__tests__/artifactStudioPath.test.ts b/ui/packages/app-shell/src/console/ai/__tests__/artifactStudioPath.test.ts index 54120a65cb0..40eb45bef25 100644 --- a/ui/packages/app-shell/src/console/ai/__tests__/artifactStudioPath.test.ts +++ b/ui/packages/app-shell/src/console/ai/__tests__/artifactStudioPath.test.ts @@ -16,9 +16,9 @@ describe('artifactStudioPath', () => { ); }); - it('flow → Automations pillar (the reserved ?surface=flow: consumer gets its first producer)', () => { + it('flow → the flow designer on its metadata address (objectstack#36903)', () => { expect(artifactStudioPath(pkg, { type: 'flow', name: 'customer_lost_follow_up' })).toBe( - '/studio/app.rmpe/automations?surface=flow%3Acustomer_lost_follow_up', + '/studio/app.rmpe/metadata/flow/customer_lost_follow_up', ); }); diff --git a/ui/packages/app-shell/src/console/ai/artifactStudioPath.ts b/ui/packages/app-shell/src/console/ai/artifactStudioPath.ts index 9a19b9922c9..6c5c6a834ab 100644 --- a/ui/packages/app-shell/src/console/ai/artifactStudioPath.ts +++ b/ui/packages/app-shell/src/console/ai/artifactStudioPath.ts @@ -7,8 +7,8 @@ * (objectui#2623). * * object → Data pillar, the object's schema/records surface - * flow → Automations pillar (the `?surface=flow:` consumer was reserved - * for exactly this bridge — this is its first producer) + * flow → the flow designer, full-screen on the flow's metadata address + * (objectstack#36903: the Automations pillar retired) * dashboard, page, view, app * → the item's page in the "All metadata" area. objectstack#36502: * the Interfaces pillar that designed them is retired; they are diff --git a/ui/packages/app-shell/src/index.ts b/ui/packages/app-shell/src/index.ts index 72adc251433..786e8ce778b 100644 --- a/ui/packages/app-shell/src/index.ts +++ b/ui/packages/app-shell/src/index.ts @@ -617,8 +617,10 @@ export { // Standalone at `/studio` and embedded via the `studio:builder` component ref. export { BuilderLanding } from './views/studio-design/BuilderLanding.js'; // The one Studio scope that is not a package (objectui#11553): the -// organization's own package-less flows, at `/studio/~org/automations`. A host -// that declares the `/studio` routes reads the reserved segment from here. +// organization's own package-less flows, listed at +// `/studio/~org/metadata/flow?source=runtime` (objectstack#36903; the old +// `/studio/~org/automations` redirects there). A host that declares the +// `/studio` routes reads the reserved segment from here. export { STUDIO_ORG_SCOPE_SEGMENT, STUDIO_ORG_SCOPE_PILLAR, diff --git a/ui/packages/app-shell/src/views/metadata-admin/MetadataListCreateDialog.tsx b/ui/packages/app-shell/src/views/metadata-admin/MetadataListCreateDialog.tsx index bf52ce8519a..6a14777a27f 100644 --- a/ui/packages/app-shell/src/views/metadata-admin/MetadataListCreateDialog.tsx +++ b/ui/packages/app-shell/src/views/metadata-admin/MetadataListCreateDialog.tsx @@ -232,7 +232,7 @@ function ObjectCreate({ open, onOpenChange, packageId, inPair, locale, onCreated ); } -function FlowCreate({ open, onOpenChange, packageId, inPair, locale, onCreated }: MetadataListCreateDialogProps) { +function FlowCreate({ open, onOpenChange, packageId, inPair, locale, onCreated, onOpenExisting }: MetadataListCreateDialogProps) { const client = useMetadataClient(); const startTrigger = React.useMemo(() => newFlowTriggerFields(locale), [locale]); const watchesObject = startTrigger.object?.showWhen?.equals ?? []; @@ -242,7 +242,9 @@ function FlowCreate({ open, onOpenChange, packageId, inPair, locale, onCreated } const [needs, setNeeds] = React.useState(null); const [busy, setBusy] = React.useState(false); const [error, setError] = React.useState(null); - const [taken, setTaken] = React.useState(null); + // `here`: the flow holding the identifier is this package's own (published or + // a draft), so the notice offers to open it, as the Automations pillar's did. + const [taken, setTaken] = React.useState<(Taken & { here: boolean }) | null>(null); const group = React.useId(); React.useEffect(() => { if (!open) return; @@ -261,7 +263,8 @@ function FlowCreate({ open, onOpenChange, packageId, inPair, locale, onCreated } try { const held = await findTakenIdentifier(client, 'flow', name, locale); if (held) { - setTaken(held); + const own = await loadPackageSurfaces(client, 'flow', packageId, locale).catch(() => []); + setTaken({ ...held, here: own.some((flow) => flow.name === name) }); return; } // Born switched off (`obsolete`, what the switch writes for Off): @@ -275,9 +278,13 @@ function FlowCreate({ open, onOpenChange, packageId, inPair, locale, onCreated } ); const target = await createTarget(packageId, inPair, null); await client.save('flow', name, skeleton, { mode: 'draft', packageId: target.packageId, ifNoneMatch: '*', surface: 'studio' }); - const live = await publishSavedItem(client, { type: 'flow', name, packageId: target.packageId }, false); + // objectstack#36726 — pinned `If-None-Match: *`, as the Automations + // pillar's create was (objectstack#36903 moved every flow create here): + // a flow another writer published under the name since the check above + // is refused, not replaced. + const live = await publishSavedItem(client, { type: 'flow', name, packageId: target.packageId }, false, publishCreated); if (!live.ok) { - setError(plainRefusal(live.error)); + if ('error' in live) setError(plainRefusal(live.error)); return; } toast.success(tFormat('engine.studio.auto.createdOff', locale, { name: label })); @@ -313,7 +320,13 @@ function FlowCreate({ open, onOpenChange, packageId, inPair, locale, onCreated } {taken && ( onOpenExisting(studioItemPath(packageId, 'flow', taken.name)) : undefined} /> )}
diff --git a/ui/packages/app-shell/src/views/metadata-admin/ResourceListPage.tsx b/ui/packages/app-shell/src/views/metadata-admin/ResourceListPage.tsx index 5ef399d9bb6..16a49bb3885 100644 --- a/ui/packages/app-shell/src/views/metadata-admin/ResourceListPage.tsx +++ b/ui/packages/app-shell/src/views/metadata-admin/ResourceListPage.tsx @@ -762,6 +762,11 @@ function DefaultMetadataList({ type, appName }: { type: string; appName?: string : {}), }; const filtered = applyListState(scopedItems, listState, rowReader, locale); + // objectstack#36903 — a host that says what its empty list means (the + // package-less scope, whose list is its source filter's narrowing of the + // environment's rows) reads an unsearched, empty list as empty, not as a + // search with no match. + const hintedEmpty = !!host?.emptyListHint && !query.trim() && filtered.length === 0; // The list context every row link carries to its detail (decision 10). const listContext = listContextQuery(listState); @@ -1449,12 +1454,13 @@ function DefaultMetadataList({ type, appName }: { type: string; appName?: string {!loading && !error && !packagesPending && (envScope || !!host || (projectPackages?.length ?? 0) > 0) && filtered.length === 0 && ( - {scopedItems.length === 0 + {scopedItems.length === 0 || hintedEmpty ? tFormat('engine.list.emptyType', locale, { type: typeLabel }) : tFormat('engine.list.emptyQuery', locale, { query })} - {config.emptyStateHint ?? + {(scopedItems.length === 0 || hintedEmpty ? host?.emptyListHint : undefined) ?? + config.emptyStateHint ?? (canCreate ? tFormat('engine.list.createHint', locale, { type: typeLabel }) : t('engine.list.readOnlyHint', locale))} diff --git a/ui/packages/app-shell/src/views/metadata-admin/metadataAreaHost.ts b/ui/packages/app-shell/src/views/metadata-admin/metadataAreaHost.ts index c72026f83ad..54e1c7f953e 100644 --- a/ui/packages/app-shell/src/views/metadata-admin/metadataAreaHost.ts +++ b/ui/packages/app-shell/src/views/metadata-admin/metadataAreaHost.ts @@ -56,6 +56,12 @@ export interface MetadataAreaHost { * customization to create with, or the ensure door refuses this caller. */ pairCreate?: boolean; + /** + * objectstack#36903 — what an empty list of the area says under its title in + * place of the type's own hint: the package-less scope's flow list says how a + * packaged flow is changed instead (ADR-0146 D11). Absent elsewhere. + */ + emptyListHint?: string; } export const MetadataAreaHostContext = React.createContext(null); diff --git a/ui/packages/app-shell/src/views/metadata-admin/studio-locale.i18n.test.tsx b/ui/packages/app-shell/src/views/metadata-admin/studio-locale.i18n.test.tsx index 8a7d2c87434..1f9971c49a0 100644 --- a/ui/packages/app-shell/src/views/metadata-admin/studio-locale.i18n.test.tsx +++ b/ui/packages/app-shell/src/views/metadata-admin/studio-locale.i18n.test.tsx @@ -43,7 +43,8 @@ const SAMPLE_KEYS = [ 'engine.studio.pkg.new', 'engine.studio.data.newObject', 'engine.studio.data.tab.records', - 'engine.studio.auto.heading', + // objectstack#36903 — the flow designer's, now that the rail's heading is gone. + 'engine.studio.auto.defaultOff', 'engine.studio.access.title', 'engine.appNav.heading', 'engine.appNav.addItem', diff --git a/ui/packages/app-shell/src/views/metadata-admin/studioAutomationCopy.plainLanguage-11659.test.ts b/ui/packages/app-shell/src/views/metadata-admin/studioAutomationCopy.plainLanguage-11659.test.ts index 649c47ec844..543e9ea1749 100644 --- a/ui/packages/app-shell/src/views/metadata-admin/studioAutomationCopy.plainLanguage-11659.test.ts +++ b/ui/packages/app-shell/src/views/metadata-admin/studioAutomationCopy.plainLanguage-11659.test.ts @@ -26,9 +26,12 @@ import { t } from './i18n'; import { loadStudioCatalogue } from '@object-ui/i18n/namespaces/studio'; await loadStudioCatalogue('zh'); -/** The automation pillar's chrome: every `engine.studio.auto.*` row it renders as prose. */ +/** + * The flow designer's chrome: every `engine.studio.auto.*` row it renders as + * prose. objectstack#36903 — the rail's heading and empty rows went with the + * rail. + */ const PILLAR_ROWS = [ - 'engine.studio.auto.heading', 'engine.studio.auto.defaultOff', 'engine.studio.auto.canvasHint', 'engine.studio.auto.on', @@ -47,8 +50,6 @@ const PILLAR_ROWS = [ 'engine.studio.auto.enabledToast', 'engine.studio.auto.disabledToast', 'engine.studio.auto.newTitle', - 'engine.studio.auto.none', - 'engine.studio.auto.emptyMain', 'engine.studio.auto.config', 'engine.studio.auto.emptyLine1', 'engine.studio.auto.emptyLine2', @@ -82,7 +83,7 @@ describe('Studio automation pillar — zh copy is plain language (objectui#11659 expect(INTERNAL_TOKENS[2].test('已 ON')).toBe(true); }); - it('the en heading names the pillar without the metadata type', () => { - expect(t('engine.studio.auto.heading', 'en-US')).not.toMatch(/\bflow\b/i); - }); + // objectstack#36903 — the pillar's en heading (`engine.studio.auto.heading`) + // went with the rail and is retired in 19.0.0 (ruling 7153171432), so its + // case went with it; the designer's rows above carry the plain-language pin. }); diff --git a/ui/packages/app-shell/src/views/studio-design/AutomationsFlowRail.tsx b/ui/packages/app-shell/src/views/studio-design/AutomationsFlowRail.tsx index 660fc0090ed..8d3adc8e64a 100644 --- a/ui/packages/app-shell/src/views/studio-design/AutomationsFlowRail.tsx +++ b/ui/packages/app-shell/src/views/studio-design/AutomationsFlowRail.tsx @@ -1,38 +1,23 @@ // Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. /** - * The Automations pillar's flow rail helpers: the runtime and rail states, the - * status dot and its glyph tables, the flow, definition and object-label reads, - * the new-flow trigger helpers, `pairIdOf` and the copied-flow arrival reader, + * The flow designer's helpers: the runtime state, the registration read, the + * new-flow trigger helpers, `pairIdOf` and the copied-flow arrival reader, * moved out of `StudioDesignSurface.tsx` unchanged by objectstack#29988 (slice 4 - * of the move-only split). + * of the move-only split). objectstack#36903 — the rail they were named for is + * gone with its status dot, glyph tables and grouping reads; the designer and + * the list's create dialog read what is left. */ -import * as React from 'react'; import type { MetadataClient } from '@object-ui/data-objectstack'; import type { FlowRuntimeState as SpecFlowRuntimeState } from '@objectstack/spec/contracts'; -import { resolveI18nLabel, type I18nLabel } from '@objectstack/spec/ui'; import { customizationPackageId } from '@objectstack/spec/kernel'; -import type { FlowTriggerGlyph } from './flowGrouping.js'; -import { - Zap, - Clock, - MousePointerClick, - CornerDownRight, - type LucideIcon, -} from 'lucide-react'; import { fieldsForNodeType, localizeFlowFields, type FlowConfigField, } from '../metadata-admin/inspectors/flow-node-config.js'; -import { - deriveFlowRunStatus, - describeFlowRunStatus, - type FlowRunStatus, - type FlowRunStatusView, - type FlowRuntimeRow, -} from '../metadata-admin/previews/flow-problems.js'; +import type { FlowRuntimeRow } from '../metadata-admin/previews/flow-problems.js'; import type { FlowRegistration } from '@objectstack/spec/api'; /** @@ -93,116 +78,6 @@ export function flowRailState(s: FlowRuntimeState): FlowRailState { }; } -/** - * A flow's live status in the Automations rail, from the engine's runtime state - * (persisted `status` is intent; this is what's actually live). Renders nothing - * for a flow the engine doesn't know yet (never published) — the amber - * "unpublished draft" chip already covers that case. - * - * objectui#12349 — and from the engine's registration verdict, which the flow - * list serves beside its items. A flow the engine REFUSED has no runtime row, - * so it used to render nothing here; it now reads "Refused by the engine", - * titled with the engine's `reason.message`, as sent and never parsed. An - * `unregistered` flow reads "Not running here". A `registered` verdict, and - * none at all, leave the row's reading below. - * - * The state is the run status `deriveFlowRunStatus` derives, worded by - * `describeFlowRunStatus` — the derivation the flow header's Status pill and the - * Problems panel read too (objectui#11779), so the three cannot disagree: - * - enabled and bound, or enabled with no declared trigger: "On", titled - * "bound to its trigger" / "no trigger (run manually)" — a flow that runs - * when invoked is never called "not running"; - * - enabled, with a declared trigger the engine has not armed: "Not running - * here". Its title is the platform's `reason`, verbatim (objectui#11281), - * or, from a backend that predates the field, the contract's own reading of - * the row: its trigger is not armed here; - * - disabled: "Off". - * - * objectui#12454 — drawn as a 6 px dot, as the redesign's rail draws it: green - * for On, grey for Not running here, amber for Refused, a hollow ring for Off - * (`flowDotClass`). The words are the element's visually hidden text and the - * row's title (the dot no longer prints them), and the dot's own title is the - * reason it always carried. The rail's legend names each look. - * Nothing here is styled as an error: a deployment policy is not a defect. - */ -export function FlowStatusDot({ - state, - registration, - locale, -}: { - state?: FlowRailState; - /** The engine's verdict on this flow, from the list's `registrations`; absent when none was served. */ - registration?: FlowRegistration; - locale: string; -}): React.ReactElement | null { - const reading = flowRailStatus(state, registration, locale); - if (!reading) return null; - const { status, view } = reading; - // objectui#12454 — a 6 px dot; the status words stay the element's text - // (visually hidden, so a reader and a search still find them) and the hover - // text stays the reason as it was. - return ( - - - {view.label} - - ); -} - -/** - * The rail's reading of one flow: the run status `FlowStatusDot` draws and the - * row's title names, or `null` when there is nothing to say — a flow the engine - * does not know yet and holds no verdict on (the amber "unpublished draft" chip - * already covers that case). - */ -export function flowRailStatus( - state: FlowRailState | undefined, - registration: FlowRegistration | undefined, - locale: string, -): { status: FlowRunStatus; view: FlowRunStatusView } | null { - const decides = registration?.state === 'refused' || registration?.state === 'unregistered'; - if (!state && !decides) return null; - const status = deriveFlowRunStatus(state, undefined, registration); - return { status, view: describeFlowRunStatus(status, locale) }; -} - -/** - * The dot's look per run status (objectui#12454): green when the flow runs - * (bound, or run by hand), grey when this deployment does not run it, amber - * when the engine refused it, and a hollow ring when it is switched off. - * Nothing here is styled as an error: a deployment policy is not a defect. - */ -export function flowDotClass(status: FlowRunStatus): string { - switch (status.kind) { - case 'on': - case 'manual': - return 'bg-emerald-500'; - case 'refused': - return 'bg-amber-500'; - case 'off': - return 'border border-muted-foreground/70'; - default: - return 'bg-muted-foreground/50'; - } -} - -/** Each trigger kind's 14 px glyph and its words, in the rail rows and the legend (objectui#12454). */ -export const FLOW_GLYPH_ICON: Record = { - record: Zap, - scheduled: Clock, - screen: MousePointerClick, - autolaunched: CornerDownRight, -}; -export const FLOW_GLYPH_LABEL_KEY: Record = { - record: 'engine.studio.auto.kind.record', - scheduled: 'engine.studio.auto.kind.scheduled', - screen: 'engine.studio.auto.kind.screen', - autolaunched: 'engine.studio.auto.kind.autolaunched', -}; - -/** The React key of the trailing group, whose grouping key is the empty string. */ -export const NO_OBJECT_GROUP_KEY = '__no_object__'; - /** * The engine's registration verdict on each flow of the rail's scope * (objectui#12349): the flow list's `registrations`, which the server serves @@ -226,72 +101,6 @@ export async function readFlowRegistrations( } } -/** - * Each flow's definition in the rail's scope, by name (objectui#12454): what - * the rail's grouping and trigger glyphs read. Read with the drafts overlaid, - * so a draft-only flow, and a published one whose draft moved its trigger, - * group as the author's draft has them; a server that refuses that read gives - * the published list, and a failing list gives none, which groups every flow - * under "No object" rather than failing the rail. - */ -export async function readFlowDefinitions(client: MetadataClient, packageId: string | null): Promise> { - const scope = packageId === null ? {} : { packageId }; - const read = async (): Promise> | null | undefined> => { - try { - return await client.withPreviewDrafts(true).list>('flow', scope); - } catch { - return await client.list>('flow', scope); - } - }; - const definitions = new Map(); - try { - for (const flow of (await read()) ?? []) { - if (flow && typeof flow.name === 'string' && flow.name) definitions.set(flow.name, flow); - } - } catch { - /* no definitions: every flow groups under "No object" */ - } - return definitions; -} - -/** - * The scope's objects, name → label in the designer locale (objectui#12454): - * the rail's group headers and their order, and which objects count as the - * scope's own when a flow is grouped by the data it touches. The package's - * object list, as the Data rail reads it; unscoped in the package-less scope. - * A failing read gives an empty index, which `groupFlowsByObject` reads as - * "every object is the scope's". - */ -export async function readObjectLabels(client: MetadataClient, packageId: string | null, locale: string): Promise> { - const labels = new Map(); - try { - // The package's pending object drafts too, as the Data rail lists them: a - // flow on an object not published yet is grouped under it, and the header - // reads its label (the `_drafts` row carries one), not its name. A - // published object keeps its published label; a failed draft read adds - // none and leaves the published index whole (an async function, so even - // a throw before the read is sent rejects into the catch). - const readDrafts = async (): Promise> => - (await client.listDrafts(packageId === null ? { type: 'object' } : { packageId, type: 'object' })) ?? []; - const [objects, drafts] = await Promise.all([ - client.list>('object', packageId === null ? {} : { packageId }), - readDrafts().catch(() => []), - ]); - for (const object of objects ?? []) { - if (!object || typeof object.name !== 'string' || !object.name) continue; - const label = resolveI18nLabel(object.label as I18nLabel | undefined, locale)?.trim(); - labels.set(object.name, label || object.name); - } - for (const draft of drafts) { - if (!draft || typeof draft.name !== 'string' || !draft.name || labels.has(draft.name)) continue; - labels.set(draft.name, resolveI18nLabel(draft.label ?? undefined, locale)?.trim() || draft.name); - } - } catch { - /* an empty index */ - } - return labels; -} - /** The trigger the New automation dialog chose (objectui#11788). */ export interface NewFlowTrigger { triggerType: string; @@ -341,9 +150,6 @@ export function withStartTrigger( }; } -/** No navigation order: one shared empty list, so the rail's memo holds across renders. */ -export const NO_OBJECT_ORDER: readonly string[] = []; - /** * objectstack#28567 — what the Automations pillar's "New similar" strip says: * the copy the clone door saved, shown on that copy in the package the answer diff --git a/ui/packages/app-shell/src/views/studio-design/AutomationsPillar.authorRefusal-11785.test.tsx b/ui/packages/app-shell/src/views/studio-design/AutomationsPillar.authorRefusal-11785.test.tsx index e72feaa4901..e8005b63cd4 100644 --- a/ui/packages/app-shell/src/views/studio-design/AutomationsPillar.authorRefusal-11785.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/AutomationsPillar.authorRefusal-11785.test.tsx @@ -105,6 +105,11 @@ import { registerMetadataInspector } from '../metadata-admin/inspector-registry' import { FlowPreview } from '../metadata-admin/previews/FlowPreview'; import { FlowInspector } from '../metadata-admin/inspectors/FlowInspector'; import { t, tFormat } from '../metadata-admin/i18n'; +// The source under test reaches these dynamic imports (the command palette's +// record preview, the drafts panel's lint, the code editor): their first load +// is paid here, at collection, never inside a case's clock (`check:test-source-alias`). +import '@objectstack/lint'; +import '@object-ui/plugin-detail'; const dataSource = createEmptyDataSource(); @@ -129,8 +134,8 @@ afterEach(cleanup); async function refusedSave(issues: Array<{ path: string; message: string }>): Promise { server.issues = issues; render( - - + + , ); const toggle = await screen.findByRole('switch', undefined, { timeout: 8000 }); diff --git a/ui/packages/app-shell/src/views/studio-design/AutomationsPillar.customizeFlow-28570.test.tsx b/ui/packages/app-shell/src/views/studio-design/AutomationsPillar.customizeFlow-28570.test.tsx index 5b621145b48..9955c93c2db 100644 --- a/ui/packages/app-shell/src/views/studio-design/AutomationsPillar.customizeFlow-28570.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/AutomationsPillar.customizeFlow-28570.test.tsx @@ -179,6 +179,10 @@ import { publishRefusal } from './metadataError'; import { t, tFormat } from '../metadata-admin/i18n'; import { createEmptyDataSource } from './__tests__/emptyDataSource'; import { StudioSaveHarness, pressStudioSave } from './__tests__/studioSaveHarness'; +// The source under test reaches these dynamic imports (the command palette's +// record preview, the drafts panel's lint, the code editor): their first load +// is paid here, at collection, never inside a case's clock (`check:test-source-alias`). +import '@object-ui/plugin-detail'; const dataSource = createEmptyDataSource(); @@ -272,13 +276,13 @@ function Host({ : null, [readOnly, walled, pairId, ensure, ensurePackage], ); - return ; + return ; } function mount(props: React.ComponentProps = {}) { return render( - + , @@ -299,7 +303,7 @@ async function customize(): Promise { } async function openMenu(): Promise { - fireEvent.pointerDown(await screen.findByTestId('auto-item-more', undefined, { timeout: 8000 }), { button: 0, ctrlKey: false }); + fireEvent.pointerDown(await screen.findByTestId('studio-detail-more', undefined, { timeout: 8000 }), { button: 0, ctrlKey: false }); await screen.findByTestId('auto-item-new-similar'); } @@ -425,16 +429,15 @@ describe('Customize a read-only base’s flow into its pair (objectstack#28570)' mount({ listedPair: PAIR }); await openFlow(/^Notify owner and manager v2$/); - // objectstack#29692 — the dialog names the flow as its rail row does. - const railText = within(screen.getByTestId('studio-rail-automations')) - .getByRole('button', { name: /^Notify owner/ }) - // The row's label, without the switch reading the row prints after it. - .querySelector('.flex-1') - ?.textContent?.trim(); - expect(railText).toBe('Notify owner'); + // objectstack#29692 — the dialog names the flow by its listed label, the + // label the base's flow list serves (objectstack#36903: the rail is gone). + // Read off the header's title, which names the flow by that label too, so + // the case still cross-checks the dialog against what the page shows. + const listedLabel = within(header()).getByTestId('auto-canvas-caption').textContent ?? ''; + expect(listedLabel).not.toBe(''); fireEvent.click(within(await openRestorePopover()).getByTestId('studio-override-restore')); const dialog = await screen.findByTestId('studio-restore-original-dialog'); - const vars = { item: railText!, package: 'HotCRM' }; + const vars = { item: listedLabel, package: 'HotCRM' }; expect(dialog).toHaveTextContent(tFormat('engine.studio.customize.restoreConfirm', 'en', vars)); expect(dialog).toHaveTextContent(tFormat('engine.studio.customize.restoreFlowBody', 'en', vars)); expect(dialog).toHaveTextContent(t('engine.studio.customize.restoreDraft', 'en')); diff --git a/ui/packages/app-shell/src/views/studio-design/AutomationsPillar.deleteFlow-27356.test.tsx b/ui/packages/app-shell/src/views/studio-design/AutomationsPillar.deleteFlow-27356.test.tsx index 20acf324384..90c09426e10 100644 --- a/ui/packages/app-shell/src/views/studio-design/AutomationsPillar.deleteFlow-27356.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/AutomationsPillar.deleteFlow-27356.test.tsx @@ -15,7 +15,7 @@ import * as React from 'react'; import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; import { render, screen, fireEvent, cleanup, waitFor, within } from '@testing-library/react'; import { toast } from 'sonner'; -import { MemoryRouter } from 'react-router-dom'; +import { MemoryRouter, Route, Routes, useLocation } from 'react-router-dom'; const PKG = 'com.acme.app'; @@ -70,6 +70,11 @@ vi.mock('sonner', () => ({ toast: { success: vi.fn(), error: vi.fn() } })); import { AutomationsPillar } from './StudioDesignSurface'; import { createEmptyDataSource } from './__tests__/emptyDataSource'; +// The source under test reaches these dynamic imports (the command palette's +// record preview, the drafts panel's lint, the code editor): their first load +// is paid here, at collection, never inside a case's clock (`check:test-source-alias`). +import '@objectstack/lint'; +import '@object-ui/plugin-detail'; const dataSource = createEmptyDataSource(); @@ -86,28 +91,41 @@ beforeEach(() => { afterEach(cleanup); +function Where() { + const { pathname, search } = useLocation(); + return
{`${pathname}${search}`}
; +} +const where = () => screen.getByTestId('where').textContent; +const LIST = `/studio/${PKG}/metadata/flow`; + function mount(readOnly = false) { render( - - + + + + } + /> + } /> + , ); } /** Open the ⋯ menu and pick Delete flow: the confirm dialog. */ async function openConfirm(): Promise { - fireEvent.pointerDown(await screen.findByTestId('auto-item-more', undefined, { timeout: 8000 }), { button: 0, ctrlKey: false }); + fireEvent.pointerDown(await screen.findByTestId('studio-detail-more', undefined, { timeout: 8000 }), { button: 0, ctrlKey: false }); fireEvent.click(await screen.findByTestId('auto-item-delete')); return screen.findByTestId('auto-delete-confirm-dialog'); } const deleteFromMenu = async () => fireEvent.click(within(await openConfirm()).getByTestId('auto-delete-confirm-action')); describe('Automations — Delete flow (#27356 row 19)', () => { - it('asks naming the flow, discards its draft, deletes it at the package, and leaves the pillar on its empty state', async () => { + it('asks naming the flow, discards its draft, deletes it at the package, and returns to the flow list', async () => { server.draft = { ...FLOW, label: 'Approval' }; mount(); expect(await screen.findByTestId('auto-canvas-caption', undefined, { timeout: 8000 })).toHaveTextContent('Approval'); - const listReads = mockClient.list.mock.calls.length; const dialog = await openConfirm(); expect(dialog).toHaveTextContent('"Approval"'); @@ -120,19 +138,19 @@ describe('Automations — Delete flow (#27356 row 19)', () => { ['flow', 'approval', { state: 'draft', packageId: PKG }], ['flow', 'approval', { packageId: PKG }], ]); - await waitFor(() => expect(mockClient.list.mock.calls.length).toBeGreaterThan(listReads)); - await waitFor(() => expect(screen.queryByText('Approval')).toBeNull()); - expect(screen.getByText('Escalate')).toBeInTheDocument(); + // objectstack#36903 — the flow list, as × opens it, its sort kept; no + // other flow is opened in the deleted one's place. + expect(await screen.findByTestId('flow-list')).toBeInTheDocument(); + expect(where()).toBe(`${LIST}?sort=label`); expect(mockClient.layered.mock.calls.map(([, name]) => name)).not.toContain('escalate'); expect(screen.queryByTestId('auto-canvas-caption')).toBeNull(); - expect(screen.queryByTestId('auto-item-more')).toBeNull(); expect(toast.success).toHaveBeenCalledWith('Deleted flow "Approval"'); }); it('a flow with no pending draft is deleted with the one call', async () => { mount(); await deleteFromMenu(); - await waitFor(() => expect(screen.queryByTestId('auto-canvas-caption')).toBeNull()); + expect(await screen.findByTestId('flow-list')).toBeInTheDocument(); expect(mockClient.reset.mock.calls).toEqual([['flow', 'approval', { packageId: PKG }]]); }); @@ -150,7 +168,7 @@ describe('Automations — Delete flow (#27356 row 19)', () => { it('a read-only package\'s menu offers no Delete', async () => { mount(true); expect(await screen.findByTestId('auto-canvas-caption', undefined, { timeout: 8000 })).toHaveTextContent('Approval'); - fireEvent.pointerDown(await screen.findByTestId('auto-item-more'), { button: 0, ctrlKey: false }); + fireEvent.pointerDown(await screen.findByTestId('studio-detail-more'), { button: 0, ctrlKey: false }); expect(await screen.findByTestId('auto-item-new-similar')).toBeInTheDocument(); expect(screen.queryByTestId('auto-item-delete')).toBeNull(); }); diff --git a/ui/packages/app-shell/src/views/studio-design/AutomationsPillar.heldIncomplete-11786.test.tsx b/ui/packages/app-shell/src/views/studio-design/AutomationsPillar.heldIncomplete-11786.test.tsx index ddbed0a4c2b..fd777d78751 100644 --- a/ui/packages/app-shell/src/views/studio-design/AutomationsPillar.heldIncomplete-11786.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/AutomationsPillar.heldIncomplete-11786.test.tsx @@ -98,6 +98,10 @@ import { FlowPreview } from '../metadata-admin/previews/FlowPreview'; import { FlowInspector } from '../metadata-admin/inspectors/FlowInspector'; import { browserClick } from '../metadata-admin/previews/__tests__/browserClick'; import { t, tFormat } from '../metadata-admin/i18n'; +// The source under test reaches these dynamic imports (the command palette's +// record preview, the drafts panel's lint, the code editor): their first load +// is paid here, at collection, never inside a case's clock (`check:test-source-alias`). +import '@object-ui/plugin-detail'; const dataSource = createEmptyDataSource(); @@ -135,8 +139,8 @@ async function outlastDebounce(): Promise { async function addNotify(): Promise { render( - - + + , ); diff --git a/ui/packages/app-shell/src/views/studio-design/AutomationsPillar.ledgerSwitch-28148.test.tsx b/ui/packages/app-shell/src/views/studio-design/AutomationsPillar.ledgerSwitch-28148.test.tsx index 51a6dcaf43b..dcd3595fe61 100644 --- a/ui/packages/app-shell/src/views/studio-design/AutomationsPillar.ledgerSwitch-28148.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/AutomationsPillar.ledgerSwitch-28148.test.tsx @@ -107,6 +107,11 @@ vi.mock('sonner', () => ({ toast: { success: vi.fn(), error: vi.fn() } })); import { AutomationsPillar } from './StudioDesignSurface'; import { createEmptyDataSource } from './__tests__/emptyDataSource'; +// The source under test reaches these dynamic imports (the command palette's +// record preview, the drafts panel's lint, the code editor): their first load +// is paid here, at collection, never inside a case's clock (`check:test-source-alias`). +import '@objectstack/lint'; +import '@object-ui/plugin-detail'; const dataSource = createEmptyDataSource(); @@ -158,8 +163,8 @@ afterEach(cleanup); function mount(readOnly = true) { render( - - + + , ); } @@ -297,7 +302,7 @@ describe('Automations — the ledger switch on a read-only package (ADR-0146 D4) fireEvent.click(sw); await new Promise((r) => setTimeout(r, 50)); expect(calls('/toggle')).toHaveLength(0); - fireEvent.pointerDown(await screen.findByTestId('auto-item-more'), { button: 0, ctrlKey: false }); + fireEvent.pointerDown(await screen.findByTestId('studio-detail-more'), { button: 0, ctrlKey: false }); expect(await screen.findByTestId('auto-item-delete')).toBeInTheDocument(); }); }); diff --git a/ui/packages/app-shell/src/views/studio-design/AutomationsPillar.narrowRow-11795.test.tsx b/ui/packages/app-shell/src/views/studio-design/AutomationsPillar.narrowRow-11795.test.tsx index 4383f03746e..d8e5e2784eb 100644 --- a/ui/packages/app-shell/src/views/studio-design/AutomationsPillar.narrowRow-11795.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/AutomationsPillar.narrowRow-11795.test.tsx @@ -93,6 +93,11 @@ import { FlowPreview } from '../metadata-admin/previews/FlowPreview'; import { FlowInspector } from '../metadata-admin/inspectors/FlowInspector'; import { t } from '../metadata-admin/i18n'; import { browserClick } from '../metadata-admin/previews/__tests__/browserClick'; +// The source under test reaches these dynamic imports (the command palette's +// record preview, the drafts panel's lint, the code editor): their first load +// is paid here, at collection, never inside a case's clock (`check:test-source-alias`). +import '@objectstack/lint'; +import '@object-ui/plugin-detail'; const dataSource = createEmptyDataSource(); failOnAbsorbedFetchError(); @@ -163,8 +168,8 @@ afterEach(() => { function renderPillarAt(width: number) { rowWidth = width; return render( - - + + , ); } diff --git a/ui/packages/app-shell/src/views/studio-design/AutomationsPillar.newFlowStatus-36742.test.tsx b/ui/packages/app-shell/src/views/studio-design/AutomationsPillar.newFlowStatus-36742.test.tsx index fd1b7eb360b..cae5bf24a05 100644 --- a/ui/packages/app-shell/src/views/studio-design/AutomationsPillar.newFlowStatus-36742.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/AutomationsPillar.newFlowStatus-36742.test.tsx @@ -4,6 +4,10 @@ * objectstack#36742 — after a flow is created in Studio, the header reads the * engine's status for it, and the create toast says the flow is switched off. * + * objectstack#36903 — the flow is created from the list's 「新建」 + * (`MetadataListCreateDialog`), and opens on its own address: the designer it + * mounts reads the engine once the flow exists. + * * - A new flow is published as it is created, born switched off. The header's * Status pill reads the engine's row, so it says 「已停用」 (Switched off), * not 「未发布草稿」 (Unpublished draft): the snapshot taken before the flow @@ -117,6 +121,7 @@ vi.mock('sonner', () => ({ toast: { success: vi.fn(), error: vi.fn(), info: vi.f import { toast } from 'sonner'; import { AutomationsPillar } from './StudioDesignSurface'; +import { MetadataListCreateDialog } from '../metadata-admin/MetadataListCreateDialog'; import { createEmptyDataSource } from './__tests__/emptyDataSource'; import { StudioSaveHarness } from './__tests__/studioSaveHarness'; import { registerMetadataPreview } from '../metadata-admin/preview-registry'; @@ -125,6 +130,10 @@ import { FlowPreview } from '../metadata-admin/previews/FlowPreview'; import { FlowInspector } from '../metadata-admin/inspectors/FlowInspector'; import { t, tFormat } from '../metadata-admin/i18n'; import { loadStudioCatalogue } from '@object-ui/i18n/namespaces/studio'; +// The source under test reaches these dynamic imports (the command palette's +// record preview, the drafts panel's lint, the code editor): their first load +// is paid here, at collection, never inside a case's clock (`check:test-source-alias`). +import '@object-ui/plugin-detail'; const dataSource = createEmptyDataSource(); registerMetadataPreview('flow', FlowPreview); @@ -174,11 +183,28 @@ afterEach(() => { vi.unstubAllGlobals(); }); +/** The list's create dialog, then the created flow's designer, as the list's `onCreated` opens it. */ +function CreateThenOpen(): React.ReactElement { + const [created, setCreated] = React.useState(null); + if (created) return ; + return ( + {}} + packageId={PKG} + inPair={false} + locale="en-US" + onCreated={({ name }) => setCreated(name)} + /> + ); +} + function mount(): void { render( - - + + , ); @@ -188,9 +214,7 @@ const statusValue = () => screen.getByText('Status:').nextElementSibling?.textCo async function createFlow(label: string): Promise { mount(); - await screen.findByTestId(`auto-rail-row-${FLOW.name}`, undefined, { timeout: 8000 }); - fireEvent.click(screen.getByTitle(en('engine.studio.auto.newTitle'))); - const dialog = await screen.findByRole('dialog'); + const dialog = await screen.findByRole('dialog', undefined, { timeout: 8000 }); fireEvent.click(within(dialog).getByTestId('create-flow-preset-manual')); fireEvent.change(dialog.querySelectorAll('input')[0], { target: { value: label } }); fireEvent.click(within(dialog).getByRole('button', { name: en('engine.studio.createLive') })); @@ -205,14 +229,14 @@ describe('a new flow — the header reads the engine, the toast says it is off ( await screen.findByText('Status:', undefined, { timeout: 8000 }); await waitFor(() => expect(statusValue()).toBe(en('engine.studio.auto.off')), { timeout: 8000 }); expect(statusValue()).not.toBe(en('engine.studio.unpublishedDraft')); - // The status was read again after the publish, not only at mount. - expect(statusReads).toBeGreaterThan(1); + // The status was read after the publish: by the designer the create opened. + expect(statusReads).toBeGreaterThan(0); }, 40_000); it('the create toast is its own key, worded switched off until enabled', async () => { await createFlow('Escalate'); await waitFor(() => expect(toast.success).toHaveBeenCalled(), { timeout: 8000 }); - expect(toast.success).toHaveBeenCalledWith(tFormat('engine.studio.auto.createdOff', 'en', { name: 'Escalate' }), { id: 'studio-save' }); + expect(toast.success).toHaveBeenCalledWith(tFormat('engine.studio.auto.createdOff', 'en', { name: 'Escalate' })); expect(toast.success).not.toHaveBeenCalledWith(tFormat('engine.studio.save.done', 'en', { items: 'Escalate' }), expect.anything()); // The Chinese row, from the namespace's lazily loaded catalogue. const zh = await loadStudioCatalogue('zh-CN'); diff --git a/ui/packages/app-shell/src/views/studio-design/AutomationsPillar.newSimilar-28567.test.tsx b/ui/packages/app-shell/src/views/studio-design/AutomationsPillar.newSimilar-28567.test.tsx index 13b269cfa4b..ab5129dca12 100644 --- a/ui/packages/app-shell/src/views/studio-design/AutomationsPillar.newSimilar-28567.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/AutomationsPillar.newSimilar-28567.test.tsx @@ -109,6 +109,10 @@ import { t } from '../metadata-admin/i18n'; import { createEmptyDataSource } from './__tests__/emptyDataSource'; import { registerMetadataPreview } from '../metadata-admin/preview-registry'; import { FlowPreview } from '../metadata-admin/previews/FlowPreview'; +// The source under test reaches these dynamic imports (the command palette's +// record preview, the drafts panel's lint, the code editor): their first load +// is paid here, at collection, never inside a case's clock (`check:test-source-alias`). +import '@object-ui/plugin-detail'; const dataSource = createEmptyDataSource(); // The flow header's meta (its Status pill) draws only over a registered flow preview. @@ -172,17 +176,20 @@ function Where() { return {`${loc.pathname}${loc.search}`}; } -/** The Studio's package route, the pillar keyed by package as the surface mounts it. */ +/** + * The flow's address in a package's area, the designer keyed by package and + * flow as the area mounts it (objectstack#36903). + */ function PackageRoute({ readOnlyIds }: { readOnlyIds: readonly string[] }) { - const { pkg = '' } = useParams(); - return ; + const { pkg = '', name = '' } = useParams(); + return ; } function mount(packageId: string, readOnlyIds: readonly string[] = [], lang: 'en' | 'zh' = 'en') { const tree = ( - + - } /> + } /> ); @@ -197,7 +204,7 @@ function mount(packageId: string, readOnlyIds: readonly string[] = [], lang: 'en /** Open the ⋯ menu on the open flow. */ async function openMenu(): Promise { expect(await screen.findByTestId('auto-canvas-caption', undefined, { timeout: 8000 })).toHaveTextContent('Approval'); - fireEvent.pointerDown(await screen.findByTestId('auto-item-more'), { button: 0, ctrlKey: false }); + fireEvent.pointerDown(await screen.findByTestId('studio-detail-more'), { button: 0, ctrlKey: false }); } /** Pick New similar: its dialog. */ @@ -231,7 +238,7 @@ describe('Automations — New similar on a flow (#28567)', () => { expect(cloneBody()).toEqual({ name: 'approval_copy', label: 'Approval (copy)' }); await waitFor(() => - expect(screen.getByTestId('where')).toHaveTextContent(`/studio/${PAIR}/automations?surface=flow%3Aapproval_copy`), + expect(screen.getByTestId('where')).toHaveTextContent(`/studio/${PAIR}/metadata/flow/approval_copy`), ); expect(await screen.findByTestId('auto-canvas-caption', undefined, { timeout: 8000 })).toHaveTextContent('Approval (copy)'); const strip = await screen.findByTestId('auto-new-similar-strip'); @@ -243,7 +250,7 @@ describe('Automations — New similar on a flow (#28567)', () => { expect(screen.queryByTestId('auto-new-similar-dialog')).toBeNull(); }); - it('on a writable package sends that package as the target, and opens the copy here after a re-read', async () => { + it('on a writable package sends that package as the target, and opens the copy on its own address', async () => { server.clone = landedIn(WRITABLE); mount(WRITABLE); await openMenu(); @@ -258,14 +265,12 @@ describe('Automations — New similar on a flow (#28567)', () => { body: { success: true, data: { flow: { ...FLOW, name: 'approval_escalation', label: 'Escalation approval' }, packageId: WRITABLE, notice: NOTICE } }, }; server.flows[WRITABLE] = [...server.flows[WRITABLE], { name: 'approval_escalation', label: 'Escalation approval' }]; - const listReads = mockClient.list.mock.calls.length; fireEvent.click(within(dialog).getByTestId('auto-new-similar-submit')); await waitFor(() => expect(cloneCalls()).toHaveLength(1)); expect(cloneBody()).toEqual({ name: 'approval_escalation', label: 'Escalation approval', package: WRITABLE }); - await waitFor(() => expect(mockClient.list.mock.calls.length).toBeGreaterThan(listReads)); + await waitFor(() => expect(screen.getByTestId('where')).toHaveTextContent(`/studio/${WRITABLE}/metadata/flow/approval_escalation`)); await waitFor(() => expect(mockClient.layered.mock.calls.map(([, n]) => n)).toContain('approval_escalation')); - expect(screen.getByTestId('where')).toHaveTextContent(`/studio/${WRITABLE}/automations`); expect(await screen.findByTestId('auto-new-similar-strip')).toHaveTextContent( `Saved the copy approval_escalation in package ${WRITABLE}.`, ); @@ -281,7 +286,7 @@ describe('Automations — New similar on a flow (#28567)', () => { expect(within(dialog).getByTestId('auto-new-similar-refusal').textContent).toBe(TAKEN); expect(screen.getByTestId('auto-new-similar-dialog')).toBeInTheDocument(); expect(within(dialog).getByTestId('auto-new-similar-name')).toHaveValue('approval_copy'); - expect(screen.getByTestId('where')).toHaveTextContent(`/studio/${BASE}/automations`); + expect(screen.getByTestId('where')).toHaveTextContent(`/studio/${BASE}/metadata/flow/approval`); expect(screen.queryByTestId('auto-new-similar-strip')).toBeNull(); }); @@ -302,7 +307,7 @@ describe('Automations — New similar on a flow (#28567)', () => { const strip = await screen.findByTestId('auto-new-similar-strip'); expect(strip).toHaveTextContent('does not name the package it landed in, so nothing was opened'); expect(screen.getByTestId('auto-new-similar-notice').textContent).toBe(NOTICE); - expect(screen.getByTestId('where')).toHaveTextContent(`/studio/${BASE}/automations`); + expect(screen.getByTestId('where')).toHaveTextContent(`/studio/${BASE}/metadata/flow/approval`); expect(screen.getByTestId('auto-canvas-caption')).toHaveTextContent('Approval'); }); @@ -323,12 +328,12 @@ describe('Automations — New similar on a flow (#28567)', () => { mockClient.list.mockImplementation(async () => [{ name: 'approval', label: 'Approval' }]); try { render( - - + + , ); expect(await screen.findByTestId('auto-canvas-caption', undefined, { timeout: 8000 })).toHaveTextContent('Approval'); - expect(screen.queryByTestId('auto-item-more')).toBeNull(); + expect(screen.queryByTestId('studio-detail-more')).toBeNull(); } finally { mockClient.list.mockImplementation(async (_type: string, opts?: { packageId?: string }) => opts?.packageId ? server.flows[opts.packageId] ?? [] : [], @@ -357,7 +362,7 @@ describe('Automations — New similar: the copy notice in the reader\'s language fireEvent.click(within(dialog).getByTestId('auto-new-similar-submit')); // The copy opens in the pair, so the code rides the navigation to it. await waitFor(() => - expect(screen.getByTestId('where')).toHaveTextContent(`/studio/${PAIR}/automations?surface=flow%3Aapproval_copy`), + expect(screen.getByTestId('where')).toHaveTextContent(`/studio/${PAIR}/metadata/flow/approval_copy`), ); await screen.findByTestId('auto-new-similar-strip', undefined, { timeout: 8000 }); return screen.getByTestId('auto-new-similar-notice'); @@ -380,19 +385,16 @@ describe('Automations — New similar: the copy notice in the reader\'s language }); /** - * A copy that opens in this pillar reads its runtime state at once: the door - * stores the copy live and switched off, and the engine's `_status` already - * holds its row, so the pillar reads `_status` once more after the copy lands. - * CONTROL: a flow the engine holds no row for still reads as an unpublished - * draft after that same read. The other landing remounts the pillar keyed by - * package (the first `#28567` pin), and that mount reads `_status` itself. + * objectstack#28567 — the copy reads its runtime state without a reload: the + * door stores the copy live and switched off, and the engine's `_status` + * already holds its row. objectstack#36903 — the copy opens on its own + * address, and the designer that mounts there reads `_status` itself, once. */ describe('Automations — New similar: the copy reads its runtime state without a reload', () => { /** The header Status pill's value. */ const headerStatus = () => screen.getByText('Status:').nextElementSibling?.textContent ?? ''; - it('the copy opened here reads "Switched off" from one more `_status` read; a flow with no row still reads unpublished', async () => { - server.flows[WRITABLE] = [...server.flows[WRITABLE], { name: 'intake', label: 'Intake' }]; + it('the copy opened on its address reads "Switched off" from one `_status` read of its own', async () => { server.status = [{ name: 'approval', enabled: true, bound: true }]; mount(WRITABLE); await openMenu(); @@ -410,14 +412,8 @@ describe('Automations — New similar: the copy reads its runtime state without expect(screen.getByTestId('auto-canvas-caption')).toHaveTextContent('Approval (copy)'); await waitFor(() => expect(headerStatus()).toBe(t('engine.studio.auto.off', 'en')), { timeout: 8000 }); expect(headerStatus()).not.toBe(t('engine.studio.unpublishedDraft', 'en')); - // One read per copy, not one per render. + // One read for the copy's designer, not one per render. await new Promise((r) => setTimeout(r, 100)); expect(statusReads()).toBe(readsBefore + 1); - - // CONTROL: a flow the engine has no row for reads as before. - fireEvent.click(await screen.findByRole('button', { name: /Intake/ })); - await waitFor(() => expect(screen.getByTestId('auto-canvas-caption')).toHaveTextContent('Intake'), { timeout: 8000 }); - await waitFor(() => expect(headerStatus()).toBe(t('engine.studio.unpublishedDraft', 'en')), { timeout: 8000 }); - expect(statusReads()).toBe(readsBefore + 1); }); }); diff --git a/ui/packages/app-shell/src/views/studio-design/AutomationsPillar.nodeAside-12488.test.tsx b/ui/packages/app-shell/src/views/studio-design/AutomationsPillar.nodeAside-12488.test.tsx index 39a1f94265a..425c6fbbe75 100644 --- a/ui/packages/app-shell/src/views/studio-design/AutomationsPillar.nodeAside-12488.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/AutomationsPillar.nodeAside-12488.test.tsx @@ -98,6 +98,11 @@ import { FlowPreview } from '../metadata-admin/previews/FlowPreview'; import { FlowInspector } from '../metadata-admin/inspectors/FlowInspector'; import { t } from '../metadata-admin/i18n'; import { browserClick } from '../metadata-admin/previews/__tests__/browserClick'; +// The source under test reaches these dynamic imports (the command palette's +// record preview, the drafts panel's lint, the code editor): their first load +// is paid here, at collection, never inside a case's clock (`check:test-source-alias`). +import '@objectstack/lint'; +import '@object-ui/plugin-detail'; const dataSource = createEmptyDataSource(); failOnAbsorbedFetchError(); @@ -125,8 +130,8 @@ afterEach(() => { async function renderOpenFlow(): Promise { render( - - + + , ); await screen.findByTestId('auto-tab-canvas', undefined, { timeout: 8000 }); diff --git a/ui/packages/app-shell/src/views/studio-design/AutomationsPillar.problemsAgree-27799.test.tsx b/ui/packages/app-shell/src/views/studio-design/AutomationsPillar.problemsAgree-27799.test.tsx index 1990310075c..b6d233ae74f 100644 --- a/ui/packages/app-shell/src/views/studio-design/AutomationsPillar.problemsAgree-27799.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/AutomationsPillar.problemsAgree-27799.test.tsx @@ -133,6 +133,10 @@ import { FlowInspector } from '../metadata-admin/inspectors/FlowInspector'; import { FlowPreview } from '../metadata-admin/previews/FlowPreview'; import { valueEnvelopeRefusal } from '../metadata-admin/inspectors/flow-value-envelope'; import { t } from '../metadata-admin/i18n'; +// The source under test reaches these dynamic imports (the command palette's +// record preview, the drafts panel's lint, the code editor): their first load +// is paid here, at collection, never inside a case's clock (`check:test-source-alias`). +import '@object-ui/plugin-detail'; const dataSource = createEmptyDataSource(); @@ -175,8 +179,8 @@ afterEach(() => { async function writeBlankExpression() { render( - - + + , ); diff --git a/ui/packages/app-shell/src/views/studio-design/AutomationsPillar.publishPinned-36726.test.tsx b/ui/packages/app-shell/src/views/studio-design/AutomationsPillar.publishPinned-36726.test.tsx index 413a9c19c7f..49e6c682e0f 100644 --- a/ui/packages/app-shell/src/views/studio-design/AutomationsPillar.publishPinned-36726.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/AutomationsPillar.publishPinned-36726.test.tsx @@ -148,6 +148,7 @@ vi.mock('@object-ui/react', async (importOriginal) => { vi.mock('sonner', () => ({ toast: { success: vi.fn(), error: vi.fn(), info: vi.fn(), dismiss: vi.fn() } })); import { AutomationsPillar } from './StudioDesignSurface'; +import { MetadataListCreateDialog } from '../metadata-admin/MetadataListCreateDialog'; import { createEmptyDataSource } from './__tests__/emptyDataSource'; import { StudioSaveHarness, pressStudioSave } from './__tests__/studioSaveHarness'; import { registerMetadataPreview } from '../metadata-admin/preview-registry'; @@ -155,6 +156,10 @@ import { registerMetadataInspector } from '../metadata-admin/inspector-registry' import { FlowPreview } from '../metadata-admin/previews/FlowPreview'; import { FlowInspector } from '../metadata-admin/inspectors/FlowInspector'; import { t } from '../metadata-admin/i18n'; +// The source under test reaches these dynamic imports (the command palette's +// record preview, the drafts panel's lint, the code editor): their first load +// is paid here, at collection, never inside a case's clock (`check:test-source-alias`). +import '@object-ui/plugin-detail'; const dataSource = createEmptyDataSource(); registerMetadataPreview('flow', FlowPreview); @@ -187,8 +192,8 @@ afterEach(() => { function mount(): void { render( - - + + , ); @@ -298,11 +303,15 @@ describe('Flows — two Saves over one published flow are not last-writer-wins ( expect(live().status).toBe('active'); }, 30_000); - it('a new flow\'s publish asserts no published flow of its name', async () => { - mount(); - await screen.findByTestId(`auto-rail-row-${FLOW.name}`, undefined, WAIT); - fireEvent.click(screen.getByTitle(en('engine.studio.auto.newTitle'))); - const dialog = await screen.findByRole('dialog'); + it('a new flow\'s publish asserts no published flow of its name (the list\'s create, objectstack#36903)', async () => { + render( + + + {}} packageId={PKG} inPair={false} locale="en-US" onCreated={() => {}} /> + + , + ); + const dialog = await screen.findByRole('dialog', undefined, WAIT); fireEvent.click(within(dialog).getByTestId('create-flow-preset-manual')); fireEvent.change(dialog.querySelectorAll('input')[0], { target: { value: 'Escalate' } }); fireEvent.click(within(dialog).getByRole('button', { name: en('engine.studio.createLive') })); diff --git a/ui/packages/app-shell/src/views/studio-design/AutomationsPillar.railSearch-11794.test.tsx b/ui/packages/app-shell/src/views/studio-design/AutomationsPillar.railSearch-11794.test.tsx deleted file mode 100644 index baf90f65daf..00000000000 --- a/ui/packages/app-shell/src/views/studio-design/AutomationsPillar.railSearch-11794.test.tsx +++ /dev/null @@ -1,222 +0,0 @@ -// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. - -/** - * objectui#11794 — the Automations rail can be searched, and a flow's name is - * no longer cut to a stub. - * - * Before: a rail of flows with no search, each label in a `truncate` span in a - * narrow rail, so a long name read as its first few words and an ellipsis. Now a - * search box above the list matches the label or the machine name, and a search - * that matches nothing says so. - * - * objectui#12454 — the redesign groups the rail by object and gives each row - * one 32 px line, so the label truncates again, as the card's rail does; the - * whole name moved to the row's title. The second describe pins that the name - * is still whole on the row, where a pointer reads it. The rows are read by - * their test id, so a group header (also a button) is never counted as a row. - * - * The REAL `AutomationsPillar`. The rail lists what `loadPackageSurfaces` - * merges: published rows by their label, a draft-only row by its name. The - * runtime status read answers 404 here, which the pillar takes as an older - * backend (no dots): the dots are `railUnboundReason-11281`'s subject. - */ - -import '@testing-library/jest-dom/vitest'; -import * as React from 'react'; -import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; -import { render, screen, cleanup, fireEvent, waitFor, within } from '@testing-library/react'; -import { MemoryRouter } from 'react-router-dom'; -import { createI18n, I18nProvider, transformSpecTranslations } from '@object-ui/i18n'; -// Pays the dynamic `@objectstack/lint` load the pillar's source reaches at collection, not inside a case (check:test-source-alias). -import '@objectstack/lint'; - -const PKG = 'com.acme.app'; -const LONG_LABEL = 'Escalate overdue high-priority support cases to the regional on-call manager'; - -const NODES = [ - { id: 'start', type: 'start', label: 'Start' }, - { id: 'end', type: 'end', label: 'End' }, -]; -const EDGES = [{ id: 'e1', source: 'start', target: 'end' }]; - -/** Published rows (label + name) and one draft-only header (name only). */ -const PUBLISHED = [ - { name: 'nightly_digest', label: 'Nightly digest' }, - { name: 'approve_order', label: 'Approve order' }, - { name: 'escalate_overdue_cases', label: LONG_LABEL }, -]; -const DRAFT_HEADERS = [{ name: 'welcome_new_member' }]; - -const mockClient = vi.hoisted(() => ({ - list: vi.fn(async () => [] as Array>), - listDrafts: vi.fn(async () => [] as Array>), - listTypes: vi.fn(async () => ({ entries: [] })), - get: vi.fn(async () => null), - references: vi.fn(async () => []), - layered: vi.fn(async () => ({ code: null, overlay: null, overlayScope: null, effective: null, editable: true, deletable: true, resettable: false, lock: 'none' })), - getDraft: vi.fn(async (type: string, name: string) => { - throw Object.assign(new Error(`No pending draft exists for ${type}/${name}.`), { code: 'NO_DRAFT', status: 404 }); - }), - save: vi.fn(async () => { - throw new Error('this suite saves nothing'); - }), - publish: vi.fn(async () => ({ success: true })), - reset: vi.fn(async () => ({})), -})); - -vi.mock('../metadata-admin/useMetadata', async (importOriginal) => { - const mod = await importOriginal(); - return { ...mod, useMetadataClient: () => mockClient, useMetadataTypes: () => ({ entries: [] }) }; -}); - -vi.mock('./packages-io', async (importOriginal) => { - const mod = await importOriginal(); - return { ...mod, fetchPackages: vi.fn(async () => []) }; -}); - -vi.mock('@object-ui/react', async (importOriginal) => { - const mod = await importOriginal(); - return { ...mod, useAdapter: () => dataSource }; -}); - -vi.mock('sonner', () => ({ toast: { success: vi.fn(), error: vi.fn() } })); - -import { AutomationsPillar } from './StudioDesignSurface'; -import { createEmptyDataSource, failOnAbsorbedFetchError } from './__tests__/emptyDataSource'; -import { t, tFormat } from '../metadata-admin/i18n'; - -const dataSource = createEmptyDataSource(); -failOnAbsorbedFetchError(); - -beforeEach(() => { - mockClient.list.mockImplementation(async () => - PUBLISHED.map((f) => ({ ...f, type: 'autolaunched', nodes: NODES, edges: EDGES })), - ); - mockClient.listDrafts.mockImplementation(async () => DRAFT_HEADERS); - vi.stubGlobal( - 'fetch', - vi.fn(async () => new Response('null', { status: 404, headers: { 'content-type': 'application/json' } })), - ); -}); - -afterEach(() => { - cleanup(); - vi.unstubAllGlobals(); -}); - -/** The rail (the `nav` holding the search box) once every row has rendered; `wrap` puts a provider around the pillar. */ -async function renderRail(wrap: (pillar: React.ReactElement) => React.ReactElement = (pillar) => pillar): Promise { - render({wrap()}); - const search = await screen.findByTestId('auto-rail-search', undefined, { timeout: 8000 }); - const rail = search.closest('nav') as HTMLElement; - await waitFor(() => expect(rail.querySelector('[data-testid="auto-rail-row-welcome_new_member"]')).toBeInTheDocument(), { - timeout: 8000, - }); - return rail; -} - -/** The rail rows' visible names, in order. */ -function rowNames(rail: HTMLElement): string[] { - return Array.from(rail.querySelectorAll('[data-testid^="auto-rail-row-"]')).map( - (b) => b.querySelector('span.min-w-0')?.textContent?.trim() ?? '', - ); -} - -describe('the Automations rail search (objectui#11794)', () => { - it('control: an empty search lists every flow, published and draft-only alike', async () => { - const rail = await renderRail(); - expect(rowNames(rail)).toEqual(['Nightly digest', 'Approve order', LONG_LABEL, 'welcome_new_member']); - }); - - it('matches the label, case-insensitively', async () => { - const rail = await renderRail(); - fireEvent.change(within(rail).getByPlaceholderText(t('engine.studio.designer.search', 'en')), { - target: { value: 'DIGEST' }, - }); - expect(rowNames(rail)).toEqual(['Nightly digest']); - }); - - it('matches the machine name where the label does not hold it', async () => { - const rail = await renderRail(); - // `approve_order` is in no label: only the name answers it. - fireEvent.change(within(rail).getByPlaceholderText(t('engine.studio.designer.search', 'en')), { - target: { value: 'approve_order' }, - }); - expect(rowNames(rail)).toEqual(['Approve order']); - }); - - it('a search that matches nothing says so, and clearing it brings every flow back', async () => { - const rail = await renderRail(); - const search = within(rail).getByPlaceholderText(t('engine.studio.designer.search', 'en')); - fireEvent.change(search, { target: { value: ' invoice ' } }); - expect(rowNames(rail)).toEqual([]); - expect(within(rail).getByText(tFormat('engine.list.emptyQuery', 'en', { query: 'invoice' }))).toBeInTheDocument(); - // Not the empty-package line: the package HAS flows. - expect(within(rail).queryByText(t('engine.studio.auto.none', 'en'))).toBeNull(); - - fireEvent.change(search, { target: { value: '' } }); - expect(rowNames(rail)).toHaveLength(4); - }); -}); - -describe('a flow’s name in the Automations rail is not cut to a stub (objectui#11794, objectui#12454)', () => { - it('the long label is the row’s whole text on one line, and the row’s title holds it whole', async () => { - const rail = await renderRail(); - const row = within(rail).getByRole('button', { name: new RegExp(LONG_LABEL) }); - const label = within(row).getByText(LONG_LABEL); - // jsdom lays nothing out, so the class that decides clipping is what is - // read: `truncate` is `overflow: hidden; text-overflow: ellipsis; - // white-space: nowrap` — the 32 px row of objectui#12454. - expect(label).toHaveClass('truncate'); - expect(label).toHaveTextContent(new RegExp(`^${LONG_LABEL}$`)); - // The whole name is still on the row, where hovering it reads it. - expect(row.getAttribute('title') ?? '').toMatch(new RegExp(`^${LONG_LABEL} · `)); - }); -}); - -describe('a rail row names its flow by the package’s translated label (objectstack#35319)', () => { - // The package's zh-CN pack: a label for two of the four flows. The other two keep their authored copy. - const ZH_CN = { - flows: { - nightly_digest: { label: '夜间摘要' }, - welcome_new_member: { label: '欢迎新成员' }, - }, - }; - /** The console's i18n with the pack loaded under zh-CN, speaking `language`. */ - const withPack = (language: string) => (pillar: React.ReactElement) => { - const instance = createI18n({ defaultLanguage: language, detectBrowserLanguage: false }); - instance.addResourceBundle('zh-CN', 'translation', transformSpecTranslations(ZH_CN), true, true); - return ( - - {pillar} - - ); - }; - // By its test id: under a zh-CN provider the box's placeholder is the Chinese one. - const search = (rail: HTMLElement, value: string) => - fireEvent.change(within(rail).getByTestId('auto-rail-search'), { target: { value } }); - - it('zh-CN: a flow the pack labels reads by that label, on the row and in its title; the rest stay authored', async () => { - const rail = await renderRail(withPack('zh-CN')); - expect(rowNames(rail)).toEqual(['夜间摘要', 'Approve order', LONG_LABEL, '欢迎新成员']); - const row = rail.querySelector('[data-testid="auto-rail-row-nightly_digest"]') as HTMLElement; - expect(row.getAttribute('title') ?? '').toMatch(/^夜间摘要 · /); - }); - - it('zh-CN: the search matches the label the row shows, and still the authored label and the machine name', async () => { - const rail = await renderRail(withPack('zh-CN')); - search(rail, '夜间'); - expect(rowNames(rail)).toEqual(['夜间摘要']); - search(rail, 'DIGEST'); - expect(rowNames(rail)).toEqual(['夜间摘要']); - search(rail, 'welcome_new'); - expect(rowNames(rail)).toEqual(['欢迎新成员']); - }); - - it('en: the zh-CN pack does not speak for English, so every row reads as authored', async () => { - const rail = await renderRail(withPack('en')); - expect(rowNames(rail)).toEqual(['Nightly digest', 'Approve order', LONG_LABEL, 'welcome_new_member']); - search(rail, '夜间'); - expect(rowNames(rail)).toEqual([]); - }); -}); diff --git a/ui/packages/app-shell/src/views/studio-design/AutomationsPillar.saveCancel-36511.test.tsx b/ui/packages/app-shell/src/views/studio-design/AutomationsPillar.saveCancel-36511.test.tsx index 11740bb08e0..a42e6833233 100644 --- a/ui/packages/app-shell/src/views/studio-design/AutomationsPillar.saveCancel-36511.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/AutomationsPillar.saveCancel-36511.test.tsx @@ -119,6 +119,7 @@ vi.mock('sonner', () => ({ toast: { success: vi.fn(), error: vi.fn(), info: vi.f import { toast } from 'sonner'; import { AutomationsPillar } from './StudioDesignSurface'; +import { MetadataListCreateDialog } from '../metadata-admin/MetadataListCreateDialog'; import { createEmptyDataSource } from './__tests__/emptyDataSource'; import { StudioSaveHarness, pressStudioCancel, pressStudioSave } from './__tests__/studioSaveHarness'; import { registerMetadataPreview } from '../metadata-admin/preview-registry'; @@ -126,6 +127,10 @@ import { registerMetadataInspector } from '../metadata-admin/inspector-registry' import { FlowPreview } from '../metadata-admin/previews/FlowPreview'; import { FlowInspector } from '../metadata-admin/inspectors/FlowInspector'; import { t, tFormat } from '../metadata-admin/i18n'; +// The source under test reaches these dynamic imports (the command palette's +// record preview, the drafts panel's lint, the code editor): their first load +// is paid here, at collection, never inside a case's clock (`check:test-source-alias`). +import '@object-ui/plugin-detail'; const dataSource = createEmptyDataSource(); registerMetadataPreview('flow', FlowPreview); @@ -156,13 +161,30 @@ afterEach(() => { function mount(): void { render( - - + + , ); } +/** The list's create dialog, then the created flow's designer, as the list's `onCreated` opens it. */ +function CreateThenOpen(): React.ReactElement { + const [created, setCreated] = React.useState(null); + if (created) return ; + return ( + {}} + packageId={PKG} + inPair={false} + locale="en-US" + onCreated={({ name }) => setCreated(name)} + /> + ); +} + const statusText = () => screen.getByText('Status:').nextElementSibling; async function openFlow(): Promise { @@ -238,10 +260,15 @@ describe('Flows — Save and Cancel in the top bar, live at once (objectstack#36 }, 30_000); it('a new flow is published as it is created, off; switched on, it is published on at once', async () => { - mount(); - await screen.findByTestId(`auto-rail-row-${FLOW.name}`, undefined, { timeout: 8000 }); - fireEvent.click(screen.getByTitle(en('engine.studio.auto.newTitle'))); - const dialog = await screen.findByRole('dialog'); + // objectstack#36903 — created from the list's 「新建」, then opened on its address. + render( + + + + + , + ); + const dialog = await screen.findByRole('dialog', undefined, { timeout: 8000 }); fireEvent.click(within(dialog).getByTestId('create-flow-preset-manual')); fireEvent.change(dialog.querySelectorAll('input')[0], { target: { value: 'Escalate' } }); fireEvent.click(within(dialog).getByRole('button', { name: en('engine.studio.createLive') })); diff --git a/ui/packages/app-shell/src/views/studio-design/AutomationsPillar.serverVerdict-26858.test.tsx b/ui/packages/app-shell/src/views/studio-design/AutomationsPillar.serverVerdict-26858.test.tsx index 210c8531a13..c53f5bdf8c0 100644 --- a/ui/packages/app-shell/src/views/studio-design/AutomationsPillar.serverVerdict-26858.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/AutomationsPillar.serverVerdict-26858.test.tsx @@ -99,6 +99,10 @@ import { createEmptyDataSource } from './__tests__/emptyDataSource'; import { getMetadataPreview, registerMetadataPreview } from '../metadata-admin/preview-registry'; import { registerMetadataInspector } from '../metadata-admin/inspector-registry'; import { FlowInspector } from '../metadata-admin/inspectors/FlowInspector'; +// The source under test reaches these dynamic imports (the command palette's +// record preview, the drafts panel's lint, the code editor): their first load +// is paid here, at collection, never inside a case's clock (`check:test-source-alias`). +import '@object-ui/plugin-detail'; const dataSource = createEmptyDataSource(); @@ -153,8 +157,8 @@ afterEach(() => { function renderPillar() { render( - - + + , ); diff --git a/ui/packages/app-shell/src/views/studio-design/AutomationsPillar.showMeFocus-26730.test.tsx b/ui/packages/app-shell/src/views/studio-design/AutomationsPillar.showMeFocus-26730.test.tsx index 6df2e0a9bd1..7438b26f9e3 100644 --- a/ui/packages/app-shell/src/views/studio-design/AutomationsPillar.showMeFocus-26730.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/AutomationsPillar.showMeFocus-26730.test.tsx @@ -103,6 +103,11 @@ import { registerMetadataInspector } from '../metadata-admin/inspector-registry' import { FlowPreview } from '../metadata-admin/previews/FlowPreview'; import { FlowInspector } from '../metadata-admin/inspectors/FlowInspector'; import { t } from '../metadata-admin/i18n'; +// The source under test reaches these dynamic imports (the command palette's +// record preview, the drafts panel's lint, the code editor): their first load +// is paid here, at collection, never inside a case's clock (`check:test-source-alias`). +import '@objectstack/lint'; +import '@object-ui/plugin-detail'; const dataSource = createEmptyDataSource(); @@ -127,8 +132,8 @@ afterEach(cleanup); async function refusedSave(issues: Array<{ path: string; message: string }>): Promise { server.issues = issues; render( - - + + , ); const toggle = await screen.findByRole('switch', undefined, { timeout: 8000 }); diff --git a/ui/packages/app-shell/src/views/studio-design/AutomationsPillar.tabs-12454.test.tsx b/ui/packages/app-shell/src/views/studio-design/AutomationsPillar.tabs-12454.test.tsx index 24ed9f1d807..85680e8c605 100644 --- a/ui/packages/app-shell/src/views/studio-design/AutomationsPillar.tabs-12454.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/AutomationsPillar.tabs-12454.test.tsx @@ -98,6 +98,11 @@ import { registerMetadataInspector } from '../metadata-admin/inspector-registry' import { FlowPreview } from '../metadata-admin/previews/FlowPreview'; import { FlowInspector } from '../metadata-admin/inspectors/FlowInspector'; import { t } from '../metadata-admin/i18n'; +// The source under test reaches these dynamic imports (the command palette's +// record preview, the drafts panel's lint, the code editor): their first load +// is paid here, at collection, never inside a case's clock (`check:test-source-alias`). +import '@objectstack/lint'; +import '@object-ui/plugin-detail'; const dataSource = createEmptyDataSource(); failOnAbsorbedFetchError(); @@ -123,10 +128,10 @@ afterEach(() => { vi.unstubAllGlobals(); }); -async function renderOpenFlow(): Promise { +async function renderOpenFlow(search = ''): Promise { render( - - + + , ); await screen.findByTestId('auto-tab-canvas', undefined, { timeout: 8000 }); @@ -135,22 +140,6 @@ async function renderOpenFlow(): Promise { /** The section the preview body shows. */ const sectionShown = () => screen.getByTestId('flow-preview-section').getAttribute('data-section'); -describe('the Automations rail groups by object (objectui#12454)', () => { - it('the flow sits under its object’s group, with its count, its trigger glyph and a legend', async () => { - await renderOpenFlow(); - const group = await screen.findByTestId('auto-rail-group-crm_lead', undefined, { timeout: 8000 }); - expect(within(group).getByRole('button', { name: /Lead\s*1/ })).toHaveAttribute('aria-expanded', 'true'); - const row = within(group).getByTestId(`auto-rail-row-${FLOW.name}`); - expect(row).toHaveAttribute('data-trigger', 'record'); - expect(row.getAttribute('title')).toBe(`Route new lead · ${en('engine.studio.auto.kind.record')}`); - expect(screen.getByTestId('auto-rail-legend')).toHaveTextContent(en('engine.studio.auto.kind.scheduled')); - - // Folding the group hides its row; the count stays on the header. - fireEvent.click(within(group).getByRole('button', { name: /Lead\s*1/ })); - expect(within(group).queryByTestId(`auto-rail-row-${FLOW.name}`)).toBeNull(); - }); -}); - describe('the item header’s tab row over the open flow (objectui#12454)', () => { it('offers the five tabs, Canvas open, and the Problems tab carries the problem count as a pill', async () => { await renderOpenFlow(); @@ -213,3 +202,27 @@ describe('the item header’s tab row over the open flow (objectui#12454)', () = expect(document.querySelector('[data-node-id="start"]')).not.toBeNull(); }); }); + +// objectstack#36903 — the open tab is in the address (`?tab=`): a refresh, a +// shared link or ‹ › reopens it on the real designer. +describe('the designer opens the tab its address names (objectstack#36903)', () => { + it('?tab=runs opens the Runs section', async () => { + await renderOpenFlow('?tab=runs'); + await waitFor(() => expect(sectionShown()).toBe('runs'), { timeout: 8000 }); + expect(screen.getByTestId('auto-tab-runs')).toHaveAttribute('aria-pressed', 'true'); + expect(screen.getByTestId('auto-tab-canvas')).toHaveAttribute('aria-pressed', 'false'); + }); + + it('?tab=history opens the History tab’s panel', async () => { + await renderOpenFlow('?tab=history'); + expect(await screen.findByTestId('item-tab-panel-history', undefined, { timeout: 8000 })).toBeInTheDocument(); + expect(screen.getByTestId('auto-tab-canvas')).toHaveAttribute('aria-pressed', 'false'); + }); + + // CONTROL: no `?tab=` opens the Canvas, and no tool panel. + it('CONTROL: with no tab in the address, the Canvas is open', async () => { + await renderOpenFlow(); + expect(sectionShown()).toBe('canvas'); + expect(screen.queryByTestId('item-tab-panel-history')).toBeNull(); + }); +}); diff --git a/ui/packages/app-shell/src/views/studio-design/AutomationsPillar.tsx b/ui/packages/app-shell/src/views/studio-design/AutomationsPillar.tsx index 87cc9ed3120..79885d93a7c 100644 --- a/ui/packages/app-shell/src/views/studio-design/AutomationsPillar.tsx +++ b/ui/packages/app-shell/src/views/studio-design/AutomationsPillar.tsx @@ -1,15 +1,28 @@ // Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. /** - * The Automations pillar — the flow rail, the flow canvas and its inspectors, - * the New automation dialog — with the published-flow-names read only it makes, - * moved out of `StudioDesignSurface.tsx` unchanged by objectstack#36893 (the - * move-only split's pillar slice; the surface re-exports it). + * The flow designer — one flow, full-screen on its metadata address + * (`/studio//metadata/flow/`, or the package-less scope's + * `/studio/~org/metadata/flow/`; objectstack#36903, epic + * objectstack#36890; ADR-0146 D1 as amended): the item header (× back to the + * flow list, ‹ › through it), the designer's tabs with the item tools after + * them (`flowDesignerTabs.ts`), the flow canvas and its inspectors — with the + * published-flow-names read only it makes. + * + * It has no flow list of its own and no New: the list is the area's + * (`ResourceListPage`), and its 「新建」 creates a flow on the starting points + * (`MetadataListCreateDialog`). Another flow opens through ×, ‹ › or ⌘K + * (decision 7); a copy made with New similar opens on its own address. The + * area mounts it (`StudioMetadataArea`); the old + * `/automations?surface=flow:` address redirects there + * (`automationsPillarRedirect.ts`). + * + * Kept under its pillar-era name: the surface and its pins import it by it. */ import * as React from 'react'; import { createPortal } from 'react-dom'; -import { useNavigate, useLocation } from 'react-router-dom'; +import { useNavigate, useLocation, useSearchParams } from 'react-router-dom'; import { extractDraftBody, formatMetadataError, readDraftChanges, type DraftChange } from '@object-ui/data-objectstack'; import type { MetadataClient } from '@object-ui/data-objectstack'; import { type StudioSurfaceLabel } from './StudioAiCopilot.js'; @@ -19,44 +32,29 @@ import { STUDIO_FOLD_LABEL } from './studio-tokens.js'; import { StudioInspector } from './StudioInspector.js'; import { isAgentDraftSurface } from './StudioDraftMark.js'; import { StudioAiDraftNotice } from './StudioAiDraftNotice.js'; -import { StudioItemHeader, StudioTab } from './StudioItemHeader.js'; -import { StudioItemTools } from '../item-tools/StudioItemTools.js'; +import { StudioTab } from './StudioItemHeader.js'; +import { ResourceDetailHeader, detailListHref } from '../metadata-admin/ResourceDetailHeader.js'; +import { ItemToolTabPanel, ItemToolTabStrip } from '../item-tools/ItemToolTabs.js'; +import { FLOW_DESIGNER_TOOL_TABS, useFlowDesignerTab } from './flowDesignerTabs.js'; import { useStudioItemDraftStatus } from './studioItemDraftStatus.js'; -import { FlowItemMoreMenu, flowCloneNoticeText, type FlowCopied } from './FlowItemMoreMenu.js'; +import { useFlowItemMenu, flowCloneNoticeText, type FlowCopied } from './FlowItemMoreMenu.js'; import { FlowLedgerSwitch } from './FlowLedgerSwitch.js'; import { requestFlowToggle, useFlowLedgerWalledReadOnly } from '../setup/packagedFlowLedger.js'; import { activationReading } from '../setup/packagedFlows.js'; -import { StudioRail, StudioRailGroup, StudioRailRow } from './StudioRail.js'; -import { StudioEmptyState, StudioEmptyStateAction } from './StudioEmptyState.js'; -import { FLOW_TRIGGER_GLYPHS, flowTriggerGlyph, groupFlowsByObject } from './flowGrouping.js'; +import { StudioEmptyState } from './StudioEmptyState.js'; import { StudioRefusalStrip } from './StudioRefusalStrip.js'; -import { StudioPicker } from './StudioPicker.js'; import { FLOW_COPIED_ARRIVAL_STATE, - FLOW_GLYPH_ICON, - FLOW_GLYPH_LABEL_KEY, type FlowCopiedStrip, - flowDotClass, type FlowRailState, flowRailState, - flowRailStatus, type FlowRuntimeState, - FlowStatusDot, - type NewFlowTrigger, - newFlowTriggerFields, - NO_OBJECT_GROUP_KEY, - NO_OBJECT_ORDER, pairIdOf, readFlowCopiedArrival, - readFlowDefinitions, readFlowRegistrations, - readObjectLabels, - withStartTrigger, } from './AutomationsFlowRail.js'; import { confirmDropUnsavedWork, - CreateTakenNotice, - findTakenIdentifier, type StudioBaseCustomization, StudioHeldNotice, StudioReadOnlyLink, @@ -65,7 +63,6 @@ import { useShowInputFocus, } from './StudioPillarKit.js'; import { - useIsMobile, Sheet, SheetContent, SheetHeader, @@ -75,7 +72,7 @@ import { TooltipProvider, TooltipTrigger, } from '@object-ui/components'; -import { Ban, Workflow, SlidersHorizontal, MousePointer2, Loader2, Lock, Menu } from 'lucide-react'; +import { Ban, FileQuestion, Workflow, SlidersHorizontal, MousePointer2, Loader2, Lock } from 'lucide-react'; import { useRegisteredMetadataPreview, useRegisteredMetadataPreviewTypes, @@ -95,7 +92,7 @@ import { type ServerDiagnostics, } from '../metadata-admin/draftVerdict.js'; import { emitMetadataRefresh } from '../../assistant/assistantBus.js'; -import { publishSavedItem, publishCreated, publishedPinOfLayers, STUDIO_SAVE_TOAST_ID, useStudioSaveEntry, type StudioSaveResult } from './studioSaveBar.js'; +import { publishSavedItem, publishedPinOfLayers, useStudioSaveEntry, type StudioSaveResult } from './studioSaveBar.js'; import { flowHeldEdit, flowSaveRefusal, @@ -109,19 +106,15 @@ import { loadPackageSurfaces, } from './packageSurfaces.js'; import { studioOrgScopePath } from './studioScope.js'; -import { studioPillarItemPath } from './metadataArea.js'; -import { useCanAuthorMetadata } from '../../hooks/useCanAuthorMetadata.js'; +import { studioItemPath } from './studioAddress.js'; +import { useCanAuthorMetadata, useCanReadAuthoringTrail } from '../../hooks/useCanAuthorMetadata.js'; import { useMetadataRefreshNonce } from './useMetadataRefreshNonce.js'; import { type Surface } from './navSurface.js'; -import { useSurfaceDeepLink, resolveSurfaceDeepLink } from './useSurfaceDeepLink.js'; -import { buildFlowSkeleton } from './skeletons.js'; -import { t, tFormat, translateValidationMessage, useMetadataLocale } from '../metadata-admin/i18n.js'; -import { ObjectPicker } from '../metadata-admin/inspectors/ObjectPicker.js'; +import { t, tFormat, translateMetadataType, translateValidationMessage, useMetadataLocale } from '../metadata-admin/i18n.js'; import { FlowRegistrationContext, FlowRuntimeContext, deriveFlowRunStatus, - type FlowRunStatus, } from '../metadata-admin/previews/flow-problems.js'; import { FlowMetaPills, @@ -132,22 +125,9 @@ import { type FlowProblemTally, } from '../metadata-admin/previews/FlowPreview.js'; import { InspectorShellHostProvider } from '../metadata-admin/inspectors/_shared.js'; -import { useFlowLabelOf, useFlowLabelTranslations } from '../metadata-admin/previews/flow-label-translations.js'; +import { useFlowLabelTranslations } from '../metadata-admin/previews/flow-label-translations.js'; import type { FlowRegistration } from '@objectstack/spec/api'; -import { CreateItemDialog } from './CreateItemDialog.js'; -import { FLOW_PRESETS, flowPresetTrigger, type FlowPreset } from './flowPresets.js'; -import { - ContributedRailRow, - RailCustomizationFilter, - RailCustomizationMark, - StudioPairItemChip, - contributedItemTitle, - railCustomizationsOf, - useOpenContributor, - useRailCustomizationsOnly, - withPairItems, -} from './StudioRailCustomizations.js'; -import { baseContributionsOf, withContributedFlowGroups, type ContributedOnObject } from './contributionRows.js'; +import { StudioPairItemChip, withPairItems } from './StudioRailCustomizations.js'; import { StudioCustomizeButton, StudioOverrideChip, @@ -191,10 +171,13 @@ async function readPublishedFlowNames( } } -/** Automations pillar — flows: list → FlowPreview (default OFF / review-then-enable). */ +/** + * The flow designer (objectstack#36903): one flow, named by its address, read + * at its package (or the package-less scope), drawn full-screen. + */ export function AutomationsPillar({ - packageId: railPackageId, - objectOrder = NO_OBJECT_ORDER, + packageId: scopePackageId, + flowName, publishNonce = 0, onDraftSaved, readOnly: packageReadOnly = false, @@ -203,23 +186,18 @@ export function AutomationsPillar({ onSurfaceLabelChange, }: { /** - * The package whose flows the rail lists, or `null` for the package-less - * scope (objectui#11553, `studioScope.ts`): every flow that belongs to no - * package, saved as package-less drafts. + * The package whose flow this is, or `null` for the package-less scope + * (objectui#11553, `studioScope.ts`): a flow that belongs to no package, + * saved as a package-less draft. */ packageId: string | null; - /** - * objectui#12612 — the objects the package app's navigation lists, in its - * order (`navigationObjectOrder`): the rail's groups follow it. The shell - * reads it with the package's app; none (the package-less scope, a package - * without an app) leaves every group ordered by its flow count. - */ - objectOrder?: readonly string[]; + /** objectstack#36903 — the one flow this page designs: the name in its metadata address. */ + flowName: string; publishNonce?: number; onDraftSaved?: (saved?: StudioSavedDraft) => void; /** Courtesy gate: hide/disable flow-authoring affordances. */ readOnly?: boolean; - /** objectstack#28572 — on a read-only base, its pair: the rail lists the pair's flows too, and New lands there. */ + /** objectstack#28572 — on a read-only base, its pair: a flow the pair adds opens writable at the pair. */ customization?: StudioBaseCustomization | null; /** objectui#11786 — the clause of the edit the autosave holds unsent, for the surface's Publish. */ onHeldEditChange?: (clause: string | null) => void; @@ -233,58 +211,35 @@ export function AutomationsPillar({ const locale = useMetadataLocale(); const navigate = useNavigate(); const location = useLocation(); - // objectstack#28572 (ADR-0146 D3) — the rail is the base's; on a read-only - // base it lists the flows its pair adds too, and New lands in the pair. + const [searchParams] = useSearchParams(); + // objectstack#28572 (ADR-0146 D3) — on a read-only base its pair is read + // too: a flow the pair adds opens here writable, at the pair. + const railPackageId = scopePackageId; const railPairId = packageReadOnly && railPackageId !== null && customization ? customization.pairId : null; - const railMarks = railPackageId === null ? null : railCustomizationsOf(customization?.marks, railPackageId); - const [onlyCustomized, toggleOnlyCustomized] = useRailCustomizationsOnly(); - const newInPair = packageReadOnly && railPackageId !== null && customization !== null && !customization.walled; // objectstack#28567 — "New similar" (`FlowItemMoreMenu`): the strip that // shows the copy the clone door saved, with the door's sentence that it is - // switched off, as sent. The copy usually opens in ANOTHER package (a - // read-only base's pair), which remounts this pillar (keyed by package), so - // the landing rides the navigation's state and is read once here. + // switched off, as sent. The copy opens on its own address (objectstack#36903), + // which mounts a new designer, so the landing rides the navigation's state + // and is read once here. const [flowCopied, setFlowCopied] = React.useState( () => readFlowCopiedArrival(location.state, railPackageId) ?? - // objectstack#28572 — a copy that landed in the base's pair arrives on - // the base's surface (the pair's URL lands there). Matched by the spec's - // pairing rule: a read of where the copy went, never a write target. + // objectstack#28572 — a copy that landed in the base's pair. Matched by + // the spec's pairing rule: a read of where the copy went, never a write target. (railPackageId !== null ? readFlowCopiedArrival(location.state, pairIdOf(railPackageId)) : null), ); - // The copy to open once the rail re-reads, when it landed in THIS package. - const openAfterListRef = React.useRef(null); const canAuthorFlows = useCanAuthorMetadata(); - // See DataPillar's rail — same mobile-overlay treatment for the flow list. - const isMobile = useIsMobile(); - const [railOpen, setRailOpen] = React.useState(false); // objectui#11795 — on a row too narrow for the Configuration aside to sit // beside the canvas (`AUTOMATIONS_CONFIG_FOLD_WIDTH`), the aside folds away // and a selection opens the same configuration as a drawer over the canvas, // so the canvas keeps the row's width. Wider rows keep the aside as it was. const layoutRowRef = React.useRef(null); const configFolded = useIsNarrowerThan(layoutRowRef, AUTOMATIONS_CONFIG_FOLD_WIDTH); - const [flows, setFlows] = React.useState([]); - // objectui#11794 — the rail's search: a case-insensitive match on the label - // or the machine name. Ephemeral (AGENTS.md #8): nobody expects it back. - const [railQuery, setRailQuery] = React.useState(''); - const railNeedle = railQuery.trim().toLowerCase(); - // objectstack#35319 — a row names its flow as the open flow's header does: - // the package's `flows.NAME.label` in the console's language, else the - // authored label. The search matches that name, the authored label and the - // machine name, so what the row shows is always searchable. - const flowLabelOf = useFlowLabelOf(); - const railLabel = (f: Surface) => flowLabelOf(f.name) || f.label; - const flowMatches = (f: Surface) => - [railLabel(f), f.label, f.name].some((text) => text.toLowerCase().includes(railNeedle)); - // objectstack#28572 — "only customizations" keeps the marked rows. - const flowShown = (f: Surface) => - (!railNeedle || flowMatches(f)) && (!onlyCustomized || railMarks?.markOf(f) != null); - const shownFlows = flows.filter(flowShown); - const markedFlows = railMarks ? flows.filter((f) => railMarks.markOf(f) !== null).length : 0; - // objectui#7255 — same live-pulse subscription as the sibling rails; this - // one only replaces the flow LIST, so it needs no edit-buffer hold either. + // objectui#7255 — the live pulse (the copilot's edits, another tab's save) + // re-reads the scope's flows, which names this one and its registration. const metadataRefreshNonce = useMetadataRefreshNonce(); + // The open flow, once the scope's read names it: `null` while it reads and + // when it does not hold the flow (`flowMissing`). const [current, setCurrent] = React.useState(null); // objectstack#28572 — a flow the pair adds (`current.addedIn`) opens // writable, read and saved at the pair: every read and write of the OPEN @@ -365,12 +320,8 @@ export function AutomationsPillar({ // The package the open flow's draft read was asked at (`flow:NAME`): the // address the pin it recorded describes. const flowReadAtRef = React.useRef<{ key: string; at: string | undefined } | null>(null); - // `?surface=flow:` capture + mirror — shared plumbing (see - // useSurfaceDeepLink). No producer emits this link yet; honoring it keeps - // the pillars uniform so a future "design this flow" bridge just works. - const initialSurface = useSurfaceDeepLink(current); - // objectui#11553 — the package-less probe for a deep-linked flow this - // package does not hold runs once per mount, not on every list re-read. + // objectui#11553 — the package-less probe for an address naming a flow this + // package does not hold runs once per mount, not on every re-read. const deepLinkProbedRef = React.useRef(false); const [draft, setDraft] = React.useState>({}); // objectui#11272 — the flow `draft` was loaded for, `flow:NAME`: written @@ -454,35 +405,13 @@ export function AutomationsPillar({ // objectui#11785 — a load failure as it was (`plainRefusal`), a refused save // as an author sentence naming the step and its input, raw text behind Details. const [error, setError] = React.useState(null); - // Tells "still fetching the list" apart from "fetched, package has no flows" - // — without it the empty rail showed an endless "Loading…" for a fresh package. + // Whether the scope's read has answered: until it has, the page neither + // opens the flow nor says it is not here. const [listed, setListed] = React.useState(false); - // The flow a deep link named that this rail, once listed, does not hold. - const missingFlow = - listed && initialSurface?.type === 'flow' && !flows.some((f) => f.name === initialSurface.name) - ? initialSurface.name - : null; - // Inline create — a fresh package starts with zero flows, so the pillar must - // offer a way to author the first one (mirrors the object/app creators). - const [creating, setCreating] = React.useState(false); - const [createBusy, setCreateBusy] = React.useState(false); - // objectui#11788 — the trigger the New dialog asks for (unset = choose it - // later on the Start node), and the object a record trigger watches. The - // New button empties both each time it opens the dialog, as the dialog - // empties its own inputs. - const [newTrigger, setNewTrigger] = React.useState(''); - const [newTriggerObject, setNewTriggerObject] = React.useState(''); - const startTrigger = React.useMemo(() => newFlowTriggerFields(locale), [locale]); - // objectui#11861 — the dialog opens on the starting points of - // `flowPresets.ts`; the trigger form above is the *Advanced* choice. A - // record preset waits for its object: `newNeeds` is the line the dialog - // shows while Create holds it. - const [newChoice, setNewChoice] = React.useState(FLOW_PRESETS[0]); - const [newNeeds, setNewNeeds] = React.useState(null); - // objectstack#26917 — a create refused because the identifier is taken: - // which flow holds it, and whether it is on this rail, so it can be opened. - const [createTaken, setCreateTaken] = React.useState<{ name: string; label: string; here: boolean } | null>(null); - const newChoiceGroup = React.useId(); + // objectstack#36903 — the address named a flow this scope, once read, does + // not hold: said on the canvas, and nothing else opens in its place + // (objectui#11553's rule for a deep link). + const flowMissing = listed && !current && !error; // objectui#12303 — the read-only reason the header's status switch is described by. const toggleReadOnlyReasonId = React.useId(); // objectui#12454 — the canvas hint the header used to print describes the Canvas tab. @@ -511,7 +440,7 @@ export function AutomationsPillar({ // Runtime enable/bound state per flow (GET /automation/_status). Persisted // `status` is intent; this is what's actually live in the engine — the truth - // behind the rail's status dots. Refetched after a publish (publishNonce); + // behind the header's Status pill. Refetched after a publish (publishNonce); // degrades silently on an older backend / offline (dots just don't render). const [flowStatus, setFlowStatus] = React.useState>({}); // objectui#11779 — whether `flowStatus` holds an answer from the engine. With @@ -523,20 +452,23 @@ export function AutomationsPillar({ // list's `registrations` (served beside the items, keyed by name). A flow // with no entry is one no engine judged, which reads as before. const [flowRegistrations, setFlowRegistrations] = React.useState>({}); - // objectstack#34818 — the flows of the rail's scope that have a published + // objectstack#34818 — the flows of the designer's scope that have a published // version, so the Runs tab can tell "not published yet" from "the engine is // not answering". `null` until read, and after a failed read: unknown. const [publishedFlowNames, setPublishedFlowNames] = React.useState | null>(null); - // objectui#12454 — the rail groups flows by the object each is about and - // marks each with its trigger kind, both read off the flow's definition as - // served (`flowGrouping.ts`), with the scope's objects naming the groups. - const [flowDefinitions, setFlowDefinitions] = React.useState>(() => new Map()); - const [objectLabels, setObjectLabels] = React.useState>(() => new Map()); - // Which groups the author folded. Ephemeral (AGENTS.md #8), as the search is. - const [foldedGroups, setFoldedGroups] = React.useState>(() => new Set()); // objectui#12454 — the tab the item header's tab row has open over the flow, // and the problem tally its Problems tab carries (reported by the preview). - const [flowSection, setFlowSection] = React.useState('canvas'); + // objectstack#36903 — in the address (`?tab=`), with the item tools after + // the designer's own sections (`flowDesignerTabs.ts`). + const canReadTrail = useCanReadAuthoringTrail(); + const toolTabs = React.useMemo( + () => FLOW_DESIGNER_TOOL_TABS.filter((tab) => tab !== 'history' || canReadTrail), + [canReadTrail], + ); + const designerTab = useFlowDesignerTab(toolTabs); + const toolTab = designerTab.location.tool; + const flowSection: FlowPreviewSection = designerTab.location.section; + const setFlowSection = designerTab.selectSection; const [problemTally, setProblemTally] = React.useState({ count: 0, errors: 0 }); // ADR-0146 D4 — bumped after a ledger toggle the server accepted: its answer // carries the flag alone, and the flip can move what the engine armed. @@ -563,10 +495,13 @@ export function AutomationsPillar({ }; }, [publishNonce, statusNonce]); - // #27356 row 19 — a delete re-reads the rail (`flowListNonce`) and leaves - // the pillar on its empty state: that one re-read opens no other flow. - const [flowListNonce, setFlowListNonce] = React.useState(0); - const keepEmptyAfterDeleteRef = React.useRef(false); + // objectstack#36903 — the scope's read: the flows of the package (with its + // pair's, on a read-only base) or of the package-less scope, the engine's + // registrations, and the published names. It names the open flow (its label, + // and on a read-only base whether the pair adds it); the flow's own body is + // the load below. Re-read on a publish and on the live pulse (the copilot's + // edits): the open flow keeps its identity across those reads, so a re-read + // never reloads the buffer an author is editing. React.useEffect(() => { let cancelled = false; (async () => { @@ -574,71 +509,49 @@ export function AutomationsPillar({ // Published flows ∪ pending DRAFT flows — `list()` only sees // published/active metadata, so a just-authored flow that hasn't been // published yet (or a fresh writable-base package whose flows are all - // drafts) would render an empty rail even though "Changes · N" shows the - // draft exists. Mirrors the Data / Interfaces / Access pillars, which all - // merge their drafts. Keyed on `publishNonce` too so drafts that go live - // collapse back into the published rail after a package publish. - // objectui#11862 — a draft-only flow reads as the label its `_drafts` - // row carries, resolved in the designer locale. - const packageId = railPackageId; + // drafts) would not be found although "Changes · N" shows the draft + // exists. objectui#11862 — a draft-only flow reads as the label its + // `_drafts` row carries, resolved in the designer locale. + const scope = railPackageId; // objectstack#28572 — on a read-only base with a pair, the pair's - // flows too: the ones the base's list does not hold are the flows the - // pair adds, grouped and dotted from the pair's own reads. A failed - // pair read lists none of them. + // flows too: one the base's list does not hold is a flow the pair adds, + // read from the pair's own registrations. A failed pair read holds none. const pairId = railPairId; const readPair = async () => pairId === null ? null - : Promise.all([ - loadPackageSurfaces(client, 'flow', pairId, locale), - readFlowRegistrations(client, pairId), - readFlowDefinitions(client, pairId), - readObjectLabels(client, pairId, locale), - ]); - const [baseItems, registrations, definitions, objects, pair, publishedNames] = await Promise.all([ - packageId === null - ? loadPackageLessSurfaces(client, 'flow', locale) - : loadPackageSurfaces(client, 'flow', packageId, locale), - readFlowRegistrations(client, packageId), - readFlowDefinitions(client, packageId), - readObjectLabels(client, packageId, locale), + : Promise.all([loadPackageSurfaces(client, 'flow', pairId, locale), readFlowRegistrations(client, pairId)]); + const [baseItems, registrations, pair, publishedNames] = await Promise.all([ + scope === null ? loadPackageLessSurfaces(client, 'flow', locale) : loadPackageSurfaces(client, 'flow', scope, locale), + readFlowRegistrations(client, scope), readPair().catch(() => null), - readPublishedFlowNames(client, [packageId, ...(pairId === null ? [] : [pairId])]), + readPublishedFlowNames(client, [scope, ...(pairId === null ? [] : [pairId])]), ]); if (cancelled) return; const items: Surface[] = withPairItems(baseItems, pair?.[0] ?? [], pairId); - setFlows(items); setPublishedFlowNames(publishedNames); setFlowRegistrations(pair ? { ...pair[1], ...registrations } : registrations); - setFlowDefinitions(pair ? new Map([...pair[2], ...definitions]) : definitions); - setObjectLabels(pair ? new Map([...pair[3], ...objects]) : objects); - const deepLinked = resolveSurfaceDeepLink(items, initialSurface, 'flow'); - // objectui#11553 — a deep link that NAMES a flow this rail does not - // hold opens no other flow in its place: the first flow under the name - // of the one asked for is how the clone's link "redirected to another - // flow". A package-less flow named from a package's pillar is found in - // the package-less scope and opened there, once per mount. - const named = initialSurface?.type === 'flow' ? initialSurface.name : null; - if (named && !deepLinked && packageId !== null && !deepLinkProbedRef.current) { + const named = items.find((f) => f.name === flowName) ?? null; + // objectui#11553 — a package's address naming a package-less flow + // opens it in the package-less scope, once per mount. + if (!named && scope !== null && !deepLinkProbedRef.current) { deepLinkProbedRef.current = true; const packageLess = await loadPackageLessSurfaces(client, 'flow', locale).catch(() => []); if (cancelled) return; - if (packageLess.some((f) => f.name === named)) { - navigate(studioOrgScopePath({ type: 'flow', name: named }), { replace: true }); + if (packageLess.some((f) => f.name === flowName)) { + navigate(studioOrgScopePath({ type: 'flow', name: flowName }), { replace: true }); return; } } - const keepEmpty = keepEmptyAfterDeleteRef.current; - keepEmptyAfterDeleteRef.current = false; - // objectstack#28567 — a copy "New similar" saved in this package opens. - const copied = openAfterListRef.current; - openAfterListRef.current = null; - const copiedFlow = copied ? items.find((f) => f.name === copied) : undefined; - if (copiedFlow) { - setCurrent(copiedFlow); - return; - } - setCurrent((c) => (keepEmpty ? c : (c ?? deepLinked ?? (named ? null : items[0]) ?? null))); + // The open flow keeps its object while it is the same flow at the same + // package: the load below is keyed on it. + setCurrent((c) => + named && c && c.name === named.name && c.addedIn === named.addedIn + ? c.label === named.label + ? c + : { ...c, label: named.label } + : named, + ); } catch (e) { if (!cancelled) setError(plainRefusal(e)); } finally { @@ -648,101 +561,18 @@ export function AutomationsPillar({ return () => { cancelled = true; }; - }, [client, railPackageId, railPairId, publishNonce, metadataRefreshNonce, locale, flowListNonce]); + }, [client, railPackageId, railPairId, publishNonce, metadataRefreshNonce, locale, flowName, navigate]); - const doCreateFlow = React.useCallback( - async (label: string, name: string, trigger: NewFlowTrigger | null) => { - setCreateBusy(true); - setError(null); - setCreateTaken(null); - try { - // A name a flow already holds, published or as a draft, in this - // package or any other, is refused here and nothing is written: over - // a published flow the first-write pin below would write this blank - // skeleton as its pending draft (`findTakenIdentifier`). - const taken = await findTakenIdentifier(client, 'flow', name, locale); - if (taken) { - setCreateTaken({ ...taken, here: flows.some((f) => f.name === name) }); - return; - } - // Minimal valid, autolaunched skeleton: start → end. The designer fills in - // the trigger + nodes; publishing it is a separate, user-initiated step. - // - // objectui#11779 — and it is born switched OFF, as the bar above the - // rail promises ("Off by default · review before enabling"). With no - // `status` the spec's default is `draft`, which the engine arms like - // `active`: the switch read "Enabled" on a flow nobody had reviewed, and - // a package publish armed it as soon as it had a trigger. `obsolete` is - // what the switch itself writes for Off; enabling it is the author's - // own flip. - const skeleton = withStartTrigger( - { - ...buildFlowSkeleton( - name, - label, - t('engine.studio.auto.nodeStart', locale), - t('engine.studio.auto.nodeEnd', locale), - ), - status: 'obsolete', - }, - trigger, - ); - // objectstack#28572 (ADR-0146 D3) — on a read-only base the flow is - // created in its pair, which the ensure door answers (creating it on - // first use, without a prompt). - const target = packageReadOnly && customization ? (await customization.ensurePackage()).packageId : null; - // objectui#11773 — and the door refuses a draft row too (the - // first-write pin), for one that lands between the check above and - // this save. - await client.save('flow', name, skeleton, { - mode: 'draft', - packageId: target ?? railPackageId ?? undefined, - ifNoneMatch: '*', - surface: 'studio', - }); - // objectstack#36511 — and published at once, switched off as it was - // born: no draft is left for a package publish, and the switch arms it. - // objectstack#36726 — pinned `If-None-Match: *`: a flow another writer - // published under the name since the check above is refused, not replaced. - const live = await publishSavedItem( - client, - { type: 'flow', name, packageId: target ?? railPackageId }, - false, - publishCreated, - ); - if (!live.ok) { - if ('error' in live) setError(plainRefusal(live.error)); - return; - } - const item: Surface = target === null ? { type: 'flow', name, label } : { type: 'flow', name, label, addedIn: target }; - setFlows((fs) => [...fs.filter((f) => f.name !== name), item]); - // objectstack#36742 — the engine's row for the new flow is read, as - // after a Save: the snapshot held was taken before the flow existed, - // and its missing row read as 「未发布草稿」 over a published flow. - setStatusNonce((n) => n + 1); - // objectstack#28572 — the rail reads again after the save, so the - // pair's list it reads holds the new flow. - if (target !== null) setFlowListNonce((n) => n + 1); - // objectui#12454 — and groups by what it was born with. - setFlowDefinitions((m) => new Map([...m, [name, skeleton]])); - setCurrent(item); - setHasDraft(false); - setCreating(false); - // objectstack#36742 — its own words: the flow is published, but born - // switched off, so 「已保存并生效」 would promise a run it will not do. - toast.success(tFormat('engine.studio.auto.createdOff', locale, { name: label }), { id: STUDIO_SAVE_TOAST_ID }); - } catch (e) { - // Shown in the create dialog, which prints the message only: kept whole. - setError(plainRefusal(e)); - } finally { - setCreateBusy(false); - } - }, - [client, railPackageId, packageReadOnly, customization, locale, flows], + // The open flow as the load reads it: its name and the package it is read + // at. A re-read that only renames it (its label) is not a new flow. + const openFlowName = current?.name; + const openFlowAddedIn = current?.addedIn; + const openFlow = React.useMemo( + () => (openFlowName === undefined ? null : { name: openFlowName, addedIn: openFlowAddedIn }), + [openFlowName, openFlowAddedIn], ); - React.useEffect(() => { - if (!current) return; + if (!openFlow) return; let cancelled = false; // objectui#11331 — whether this run's load has settled (see the cleanup). let settled = false; @@ -754,7 +584,7 @@ export function AutomationsPillar({ // objectui#11773 — read at the address the flow saves write, so the // version it serves pins the first of them. objectstack#28570 — a // read-only base's flow: its pair, when one is listed. - const pair = flowCustomizing && !current.addedIn ? (customizationRef.current?.pairId ?? null) : null; + const pair = flowCustomizing && !openFlow.addedIn ? (customizationRef.current?.pairId ?? null) : null; const readAt = pair ?? draftPackageId; // objectstack#36726 — the published flow's layers at the address the // Save's publish writes, read FIRST (the server's order for the @@ -764,14 +594,14 @@ export function AutomationsPillar({ // is also the baseline read below. const baselineScope = draftPackageId ? { packageId: draftPackageId } : {}; const layAtReadAt = await client - .layered>('flow', current.name, readAt ? { packageId: readAt } : {}) + .layered>('flow', openFlow.name, readAt ? { packageId: readAt } : {}) .then( (lay) => ({ ok: true as const, lay }), (err: unknown) => ({ ok: false as const, err }), ); if (cancelled) return; const publishedAt = layAtReadAt.ok ? publishedPinOfLayers(layAtReadAt.lay) : null; - const draftRead = await readDraftForSave>(client, 'flow', current.name, readAt); + const draftRead = await readDraftForSave>(client, 'flow', openFlow.name, readAt); if (cancelled) return; // objectstack#29148 — a flow draft the server refused to read is no // absence: no buffer is installed over it (see InterfacesPillar's leaf @@ -798,7 +628,7 @@ export function AutomationsPillar({ if (!layAtReadAt.ok) throw layAtReadAt.err; layRaw = layAtReadAt.lay; } else { - layRaw = await client.layered>('flow', current.name, baselineScope); + layRaw = await client.layered>('flow', openFlow.name, baselineScope); } } if (cancelled) return; @@ -807,7 +637,7 @@ export function AutomationsPillar({ // Served draft as-is, baseline only without one (objectui#10765). setDraft(draftBody ?? baseline); flowStoredRef.current = draftBody ?? baseline; - setDraftFor(`flow:${current.name}`); + setDraftFor(`flow:${openFlow.name}`); flowVerdictSeq.current += 1; setFlowVerdict( editedItemDiagnostics({ @@ -817,10 +647,10 @@ export function AutomationsPillar({ }), ); // objectui#11773 — the next save is pinned to what the draft read served. - recordFlowRead('flow', current.name, readAt, draftRead.pin); + recordFlowRead('flow', openFlow.name, readAt, draftRead.pin); // objectstack#36726 — …and its publish to the published flow the layers served there. - recordFlowPublished('flow', current.name, readAt, publishedAt); - flowReadAtRef.current = { key: `flow:${current.name}`, at: readAt }; + recordFlowPublished('flow', openFlow.name, readAt, publishedAt); + flowReadAtRef.current = { key: `flow:${openFlow.name}`, at: readAt }; setHasDraft(!!draftBody); setFlowDraftChanges(draftBody ? readDraftChanges(draftRead.answer) : null); } catch (e) { @@ -839,7 +669,7 @@ export function AutomationsPillar({ // `loading` it raised, as in InterfacesPillar's draft load. if (!settled) setLoading(false); }; - }, [client, current, draftPackageId, publishNonce, flowReloadNonce, recordFlowRead, recordFlowPublished, flowCustomizing]); + }, [client, openFlow, draftPackageId, publishNonce, flowReloadNonce, recordFlowRead, recordFlowPublished, flowCustomizing]); // objectui#5813 — local dirty flag: auto-save arms only after a real edit. const [autoDirty, setAutoDirty] = React.useState(false); @@ -1100,30 +930,11 @@ export function AutomationsPillar({ } }, [saveFlowDraft, publishFlow, client, current, draft, draftFor, hasDraft, draftPackageId, locale, readOnly, recordFlowRead, rereadFlowVerdict]); - // The rail's "+" — and the empty block's button, which runs this same - // handler (objectui#12514). objectui#11553 — no "New" in the package-less - // scope: new authoring stays package-first, and this scope reaches flows - // that already exist without a package. - const openCreateFlow = - (!packageReadOnly || newInPair) && railPackageId !== null - ? () => { - // objectstack#26845 — the created flow opens at once, and its load - // replaces the buffer a held step lives in: asked before the dialog - // opens, so Cancel costs nothing and the create itself asks nothing. - if (!confirmDropUnsavedWork(flowUnsaved, locale)) return; - setError(null); - setNewTrigger(''); - setNewTriggerObject(''); - setNewChoice(FLOW_PRESETS[0]); - setNewNeeds(null); - setCreateTaken(null); - setCreating(true); - } - : undefined; // #27356 row 19 — Delete flow (`FlowItemMoreMenu`): the autosave disarmed, // the draft (so none is left to publish the flow back) and then the flow - // deleted at the drafts' package, then the empty state over a re-read rail. - // A refusal shows the door's sentence and keeps the flow open. + // deleted at the drafts' package. objectstack#36903 — then the flow list, as + // × opens it (the list's filters kept). A refusal shows the door's sentence + // and keeps the flow open. const deleteOpenFlow = React.useCallback(async () => { if (!current || packageId === null) return; const flow = current; @@ -1139,13 +950,10 @@ export function AutomationsPillar({ setError(plainRefusal(e)); return; } - keepEmptyAfterDeleteRef.current = true; - setCurrent(null); - setFlows((fs) => fs.filter((f) => f.name !== flow.name)); - setFlowListNonce((n) => n + 1); onDraftSaved?.({ type: 'flow', name: flow.name }); toast.success(tFormat('engine.studio.auto.flowDeleted', locale, { item: flow.label || flow.name })); - }, [client, current, packageId, hasDraft, onDraftSaved, locale]); + navigate(detailListHref(location.pathname, searchParams)); + }, [client, current, packageId, hasDraft, onDraftSaved, locale, navigate, location.pathname, searchParams]); // objectstack#28570 (ADR-0146 D2) — "Restore package original" on a flow // the pair overrides: the pair's draft of the flow, then its row, deleted // at the pair. The pair is the door's answer this flow's saves named, else @@ -1189,10 +997,10 @@ export function AutomationsPillar({ ); }, [client, current, reloadFlowDraft, onDraftSaved, locale]); // objectstack#28567 (ADR-0146 D4) — "New similar" saved a copy. It opens - // only where the door's answer says it landed: in this pillar after a - // re-read when that is this package, else that package's Automations pillar - // on the copy (a read-only base's pair, `.custom`). An answer naming - // no package opens nothing and says so; the landing is never derived here. + // only where the door's answer says it landed: objectstack#36903 — on the + // copy's own address in that package (this one, or a read-only base's pair, + // `.custom`), the strip riding the navigation. An answer naming no + // package opens nothing and says so; the landing is never derived here. const onFlowCopied = React.useCallback( (copy: FlowCopied) => { setError(null); @@ -1208,24 +1016,11 @@ export function AutomationsPillar({ noticeCode: copy.noticeCode, }; onDraftSaved?.({ type: 'flow', name: copy.name }); - // objectstack#28572 — the pair's flows are this surface's too. - if (copy.packageId === railPackageId || (railPairId !== null && copy.packageId === railPairId)) { - setFlowCopied(landed); - openAfterListRef.current = copy.name; - setFlowListNonce((n) => n + 1); - // The door stored the copy live and the engine already holds its row; - // the `_status` snapshot this pillar holds predates it, so it is read - // once more, or the copy's header reads the row it lacks as an - // unpublished draft. The other landing remounts the pillar keyed by - // package, and that mount reads `_status` itself. - setStatusNonce((n) => n + 1); - return; - } - navigate(studioPillarItemPath(copy.packageId, 'automations', { type: 'flow', name: copy.name }), { + navigate(studioItemPath(copy.packageId, 'flow', copy.name), { state: { [FLOW_COPIED_ARRIVAL_STATE]: landed }, }); }, - [railPackageId, railPairId, navigate, onDraftSaved], + [navigate, onDraftSaved], ); // A landing is shown on its copy; an answer that names no package, on any flow. const flowCopiedShown = @@ -1269,20 +1064,6 @@ export function AutomationsPillar({ }), ); }, [current, ledgerOn, ledgerWalled, locale]); - // objectstack#26917 — the refusal's way out: the flow holding the identifier - // is on this rail, so it opens instead of a second one being made. The New - // button already asked about a held step (objectstack#26845). - const openTakenFlow = (name: string) => { - const flow = flows.find((f) => f.name === name); - if (!flow) return; - setCreating(false); - setCreateTaken(null); - setCurrent(flow); - }; - // objectui#12514 — a listed package with no flow: one centered block in the - // content column, and no aside while there is nothing to select. - const flowsEmpty = listed && !error && flows.length === 0; - // objectui#12725 — the surface's right slot hosts the Configuration // (`useStudioRightSlot`); `null` in the package-less scope and under an // injected `aiSlot`, where the aside beside the canvas (or, on a folded @@ -1294,8 +1075,8 @@ export function AutomationsPillar({ const inSlot = slot !== null; const claimSlotProps = slot?.claimProps; React.useEffect( - () => (claimSlotProps && !flowsEmpty ? claimSlotProps() : undefined), - [claimSlotProps, flowsEmpty], + () => (claimSlotProps && !flowMissing ? claimSlotProps() : undefined), + [claimSlotProps, flowMissing], ); const flowSelectionKey = selection ? `${selection.kind}:${selection.id}` : ''; const showSlotProps = slot?.showProps; @@ -1476,75 +1257,6 @@ export function AutomationsPillar({ })() : null; - // objectui#12454 — the open flow groups and reads by the draft on screen, so - // an edit to its Start node moves its row as it moves the header's Trigger. - const liveFlowDefinitions = React.useMemo(() => { - if (!current || draftFor !== `flow:${current.name}`) return flowDefinitions; - return new Map([...flowDefinitions, [current.name, draft]]); - }, [flowDefinitions, current, draftFor, draft]); - const railGroups = React.useMemo( - () => - groupFlowsByObject(flows, liveFlowDefinitions, objectLabels, { - noObjectLabel: t('engine.studio.auto.group.noObject', locale), - objectOrder, - locale, - }), - [flows, liveFlowDefinitions, objectLabels, objectOrder, locale], - ); - // objectstack#29786 — the flows other packages ship on the base's objects, - // from the base's one customization read, each in its object's group. - const customizationMarks = customization?.marks; - const contributedFlows = React.useMemo(() => baseContributionsOf(customizationMarks), [customizationMarks]); - const railGroupsShown = React.useMemo( - () => - withContributedFlowGroups(railGroups, contributedFlows, (object) => ({ - key: object, - objectName: object, - label: objectLabels.get(object) || object, - items: [] as Surface[], - })), - [railGroups, contributedFlows, objectLabels], - ); - const openContributor = useOpenContributor(); - const contributedFlowShown = (f: ContributedOnObject) => - !onlyCustomized && - (!railNeedle || f.name.toLowerCase().includes(railNeedle) || f.packageName.toLowerCase().includes(railNeedle)); - - // The legend under the rail: the four trigger glyphs and the dots. Off and - // Refused are named only while some flow in the rail reads so. - const railStatusKinds = new Set( - flows.map((f) => flowRailStatus(flowStatus[f.name], flowRegistrations[f.name], locale)?.status.kind), - ); - const legendDot = (kind: FlowRunStatus, words: string) => ( - - - {words} - - ); - const railLegend = - flows.length > 0 ? ( -
- {FLOW_TRIGGER_GLYPHS.map((glyph) => { - const Glyph = FLOW_GLYPH_ICON[glyph]; - return ( - - - {t(FLOW_GLYPH_LABEL_KEY[glyph], locale)} - - ); - })} - {legendDot({ kind: 'on' }, t('engine.studio.auto.on', locale))} - {legendDot({ kind: 'not-running' }, t('engine.studio.auto.notRunning', locale))} - {railStatusKinds.has('off') && legendDot({ kind: 'off' }, t('engine.studio.auto.off', locale))} - {railStatusKinds.has('refused') && legendDot({ kind: 'refused', message: '' }, t('engine.studio.auto.refused', locale))} -
- ) : undefined; - // objectui#12454 — the item header's meta and tab row over the open flow. // The Status the meta shows is the one the preview's Problems note reads // (objectui#11779): the runtime row while one is in, the draft otherwise. @@ -1562,8 +1274,10 @@ export function AutomationsPillar({ ) => ( setFlowSection(key)} + active={!toolTab && section === key} + onClick={() => { + if (toolTab || key !== section) setFlowSection(key); + }} title={extra?.title} aria-describedby={extra?.describedBy} data-testid={`auto-tab-${key}`} @@ -1582,40 +1296,81 @@ export function AutomationsPillar({ ) : null; /** The flow's ⋯ menu is drawn (objectstack#28567): the header folds into it (objectstack#29693). */ const flowMoreShown = !!current && flowLoaded && packageId !== null; + // objectstack#36903 — the tool tabs need the flow's own buffer (Source edits + // it), so the row waits for the load, as the switch does; the designer's + // sections need its canvas too. + const tabsShown = !!current && flowLoaded; const flowTabsEl = - flowOpen ? ( + tabsShown ? ( <> - {flowTab('canvas', t('engine.studio.if.tabCanvas', locale), { - title: t('engine.studio.auto.canvasHint', locale), - describedBy: canvasHintId, - })} - {flowTab('variables', t('engine.flowPreview.variables', locale))} - {flowHasRuns && flowTab('runs', t('engine.flowPreview.runs', locale), { title: t('engine.flowPreview.runsTitle', locale) })} - {flowTab('problems', t('engine.flowPreview.problems', locale), { - title: t('engine.flowPreview.problemsTitle', locale), - badge: - problemTally.count > 0 ? ( - 0 - ? 'bg-destructive/15 text-destructive' - : 'bg-amber-500/15 text-amber-700 dark:text-amber-300') - } - > - {problemTally.count} - - ) : undefined, - })} - {flowTab('debug', t('engine.flowPreview.debug', locale))} + {flowOpen && ( + <> + {flowTab('canvas', t('engine.studio.if.tabCanvas', locale), { + title: t('engine.studio.auto.canvasHint', locale), + describedBy: canvasHintId, + })} + {flowTab('variables', t('engine.flowPreview.variables', locale))} + {flowHasRuns && flowTab('runs', t('engine.flowPreview.runs', locale), { title: t('engine.flowPreview.runsTitle', locale) })} + {flowTab('problems', t('engine.flowPreview.problems', locale), { + title: t('engine.flowPreview.problemsTitle', locale), + badge: + problemTally.count > 0 ? ( + 0 + ? 'bg-destructive/15 text-destructive' + : 'bg-amber-500/15 text-amber-700 dark:text-amber-300') + } + > + {problemTally.count} + + ) : undefined, + })} + {flowTab('debug', t('engine.flowPreview.debug', locale))} + + )} + {/* objectstack#36903 (decision 8) — the item tools are tabs of the + same row: References, History, Source. */} + { + setSelection(null); + designerTab.selectTool({ tab }); + }} + locale={locale} + /> {autoReadOnlyLinkEl && {autoReadOnlyLinkEl}} ) : undefined; + // objectstack#28567 — New similar on a read-only package's flow and on a + // writable one's (the door picks the pair for a read-only base; a writable + // package is the target); Delete on a writable package's flow only. The + // package-less scope has no pair and no package to name. objectstack#36903 — + // in the header's ⋯, which also takes what a narrow header folds. + const flowMenu = useFlowItemMenu({ + name: current?.name ?? flowName, + label: current?.label ?? flowName, + locale, + disabled: !!saving, + onDelete: readOnly ? undefined : () => void deleteOpenFlow(), + newSimilar: { + target: readOnly ? undefined : (packageId ?? undefined), + blocked: canAuthorFlows ? null : t('engine.edit.capabilityReadOnly', locale), + // The copy opens in place of this flow, which drops a held edit; asked + // before the dialog. + confirmOpen: () => confirmDropUnsavedWork(flowUnsaved, locale), + onCopied: onFlowCopied, + }, + }); + const flowTitle = current ? flowLabels?.flowLabel || current.label || current.name : flowName; return (
{flowConflictDialog} + {flowMenu.dialogs} {/* objectstack#28570 — Restore's confirmation, outside the menu that opens it. */} void restoreFlow()} />
- {isMobile && railOpen && ( -
setRailOpen(false)} - aria-hidden="true" - /> - )} - - } - footer={railLegend} - isMobile={isMobile} - open={railOpen} - > - {/* objectui#12454 — grouped by the object each flow is about, in the - order of the objects' labels, "No object" last; a search filters - within the groups and shows every group that holds a match, - folded or not. Each row: its trigger glyph, its label on one - line (the row's title holds it whole, with its trigger kind and - status words — the redesign trades objectui#11794's wrap for the - 32 px row), and its status dot. */} - {railGroupsShown.map(({ group, contributed: contributedAll }) => { - const items = railNeedle || onlyCustomized ? group.items.filter(flowShown) : group.items; - const contributed = contributedAll.filter(contributedFlowShown); - if (items.length === 0 && contributed.length === 0) return null; - const groupKey = group.key || NO_OBJECT_GROUP_KEY; - return ( - - setFoldedGroups((folded) => { - const next = new Set(folded); - if (!next.delete(groupKey)) next.add(groupKey); - return next; - }) - } - > - {items.map((f) => { - const active = current?.name === f.name; - const glyph = flowTriggerGlyph(liveFlowDefinitions.get(f.name)); - const Glyph = FLOW_GLYPH_ICON[glyph]; - const reading = flowRailStatus(flowStatus[f.name], flowRegistrations[f.name], locale); - return ( - { - // objectstack#26705 — another flow's load replaces the - // buffer the held step lives in; the open one keeps it. - if (!active && !confirmDropUnsavedWork(flowUnsaved, locale)) return; - setCurrent(f); - if (isMobile) setRailOpen(false); - }} - icon={} - trailing={ - <> - - - - } - > - {railLabel(f)} - - ); - })} - {/* objectstack#29786 — the flows another package ships on this - object: greyed, with the package, opening it there. */} - {contributed.map((f) => ( - } - title={contributedItemTitle(f, locale)} - onOpen={() => - openContributor(studioPillarItemPath(f.packageId, 'automations', { type: 'flow', name: f.name })) - } - locale={locale} - /> - ))} - - ); - })} - {flows.length === 0 && (contributedFlows?.flows.length ?? 0) === 0 && !creating && (error || !listed || openCreateFlow) && ( -

- {error - ? t('engine.studio.loadFailed', locale) - : !listed - ? t('engine.studio.loading', locale) - : t('engine.studio.auto.none', locale)} -

- )} -
-
- {/* objectui#11665 — the header names the open flow by its LABEL, - the string its rail row prints, never by `flow · NAME`: the - metadata type word was developer vocabulary inside the - author's own copy (objectui#11659 ruling 6). The API name - moves to the tooltip for the authors who need it, as the - Interfaces caption keeps its internal id (objectui#7254). A - label that resolves to nothing falls back to the name. */} - + {flowTitle} + } + apiName={flowName} + typeLabel={translateMetadataType('flow', locale, 'Flow')} + packageLabel={packageId ?? undefined} + // Esc with a node selected deselects it first (the slot's own Esc, the aside's ✕). + closeOnEscape={!selection} // objectstack#29691 (ADR-0146 D3) — a flow the pair adds, overrides // or is unlocked to customize saves to the base's pair. note={ @@ -1772,31 +1413,11 @@ export function AutomationsPillar({ ) : undefined } - leading={ - - } - icon={current ? Workflow : undefined} - title={current ? flowLabels?.flowLabel || current.label || current.name : t('engine.studio.auto.heading', locale)} - titleProps={ - current - ? { 'data-testid': 'auto-canvas-caption', title: `${t('designer.field.apiName', locale)}: ${current.name}` } - : { className: 'text-[13px] font-normal text-muted-foreground' } - } // objectui#12454 — the open flow's Trigger, Status, Run as and - // version, as the designer's info bar reads them. The canvas hint - // the row printed stays in it for a reader (visually hidden; the - // Canvas tab's description and title), so the row still reads it - // whole as objectui#11665 pins. Without designers the line says - // so, and yields to the label on a narrow row as it did. - // objectstack#36745 — the meta wrapper is a block-level flex, so - // the give-way row inside it reads the slot's whole width. + // version, as the designer's info bar reads them: objectstack#36903 + // — the run status a builder reads here, the list having no column + // for it. The canvas hint stays in it for a reader (visually + // hidden; the Canvas tab's description and title). meta={ isEditable ? ( <> @@ -1813,23 +1434,8 @@ export function AutomationsPillar({ {t('engine.studio.auto.designersMissing', locale)} ) } - chips={ - current?.addedIn ? ( - - ) : flowCustomizable && flowServed.declaration ? ( - // objectstack#28570 — the override the server serves, never a computation. - setRestoreOpen(true) : undefined} - restoreDisabled={restoring || !!saving} - /> - ) : undefined - } status={flowDraftStatus} - actions={ + primaryAction={ <> {/* objectstack#36511 — a Save or a switch flip in flight. */} {saving === 'draft' && ( @@ -1838,6 +1444,19 @@ export function AutomationsPillar({ {t('engine.studio.autoSaving', locale)} )} + {current?.addedIn ? ( + + ) : flowCustomizable && flowServed.declaration ? ( + // objectstack#28570 — the override the server serves, never a computation. + setRestoreOpen(true) : undefined} + restoreDisabled={restoring || !!saving} + /> + ) : null} {/* objectstack#28570 — Customize unlocks the flow's editors; nothing is saved until an edit. */} {current && flowLoaded && flowCustomizable && !flowUnlocked && !flowInPair && ( )} {flowSwitchEl} - {/* objectstack#28239 — the item tools Setup's item page opens. */} - {current && flowLoaded && ( - { - setDraft(next); - setAutoDirty(true); - } - : undefined, - }} - onRolledBack={() => setFlowReloadNonce((n) => n + 1)} - locale={locale} - /> - )} {!flowTabsEl && autoReadOnlyLinkEl} - {/* objectstack#28567 — New similar on a read-only package's - flow and on a writable one's (the door picks the pair for - a read-only base; a writable package is the target); - Delete on a writable package's flow only. The - package-less scope has no pair and no package to name. */} - {flowMoreShown && current && ( - void deleteOpenFlow()} - newSimilar={{ - target: readOnly ? undefined : packageId, - blocked: canAuthorFlows ? null : t('engine.edit.capabilityReadOnly', locale), - // The copy opens in place of this flow, which drops a - // held edit; asked before the dialog, as New is. - confirmOpen: () => confirmDropUnsavedWork(flowUnsaved, locale), - onCopied: onFlowCopied, - }} - /> - )} } + menu={flowMoreShown ? (flowMenu.items ?? undefined) : undefined} tabs={flowTabsEl} /> {/* objectui#12454 — the body is the flow, flush under the tab row: @@ -1972,42 +1550,49 @@ export function AutomationsPillar({ )}
)} - {/* `flex-1 min-h-0` so the canvas fills the pillar's full remaining + {/* `flex-1 min-h-0` so the canvas fills the page's full remaining * height instead of shrinking to FlowCanvas's intrinsic content height. */}
- {!current ? ( - missingFlow ? ( -
- {/* objectui#11553 — a deep link that named a flow this rail - does not hold says so, instead of opening another. */} - {tFormat('engine.studio.auto.deepLinkMissing', locale, { name: missingFlow })} -
- ) : flowsEmpty ? ( + {toolTab && current && flowLoaded ? ( + // objectstack#36903 — References, History and Source, as on + // every item page; Source edits the same buffer the Save sends. + designerTab.selectTool({ tab: toolTab.tab, view })} + type="flow" + name={current.name} + packageId={packageId} + source={{ + value: draft, + onChange: + isEditable && !editLocked + ? (next) => { + setDraft(next); + setAutoDirty(true); + } + : undefined, + }} + onRolledBack={!readOnly && canAuthorFlows ? () => setFlowReloadNonce((n) => n + 1) : undefined} + locale={locale} + className="h-full min-h-0 overflow-auto p-6" + /> + ) : !current ? ( + flowMissing ? (
+ {/* objectui#11553 — an address that named a flow this scope + does not hold says so, instead of opening another. */} - ) - ) - } + testId="auto-flow-missing" + icon={FileQuestion} + sentence={tFormat('engine.studio.auto.deepLinkMissing', locale, { name: flowName })} />
- ) : null + ) : error ? null : ( +
+ {t('engine.studio.loading', locale)} +
+ ) ) : loading || !flowLoaded ? ( // objectui#11272 — nothing of another flow's buffer under this // one; after a failed load, the error above says why. @@ -2018,7 +1603,7 @@ export function AutomationsPillar({ ) ) : Preview ? ( // objectui#11779 — the open flow's runtime row, so the flow - // header and its Problems panel read the run status this rail + // header and its Problems panel read the run status the header // reads: the row, `null` when the engine has none for this flow, // nothing while no runtime answer is in. @@ -2069,7 +1654,9 @@ export function AutomationsPillar({ aside's width; in the right slot the simulator is drawn in the slot itself (the chrome's `debugTarget`). The selection is kept, so leaving Debug brings the aside back as it was. */} - {flowsEmpty || section === 'debug' ? null : configFolded && !inSlot ? ( + {/* objectstack#36903 — nor beside an item tool's tab, which has no + node to configure, nor over a flow the scope does not hold. */} + {flowMissing || toolTab || section === 'debug' ? null : configFolded && !inSlot ? ( // objectui#11795 — the folded row: no aside reserving width beside // the canvas; the selection's configuration opens over it, and // closing the drawer clears the selection, as the aside's ✕ does. @@ -2137,158 +1724,6 @@ export function AutomationsPillar({ })() )}
- - - {createTaken && ( - openTakenFlow(createTaken.name) : undefined} - /> - )} -
- {t('engine.studio.auto.presets', locale)} - {FLOW_PRESETS.map((p) => ( -
- - {newChoice === p && startTrigger.object?.showWhen?.equals.includes(p.triggerType) && ( -
- {/* objectstack#30038 — no expression is legal here: a typed - prefix is never saved as the trigger object. */} - { - setNewTriggerObject(v); - setNewNeeds(null); - }} - locale={locale} - /> -
- )} -
- ))} -
- - {/* objectui#11788 — the trigger, asked for here rather than found - later inside the Start node. The choices, their labels and - which of them watch an object are the Start node's own - trigger field (`fieldsForNodeType('start')`), so the two can - never offer different triggers; what is chosen is written - where that field writes it. */} - {newChoice === 'advanced' && startTrigger.trigger && ( -
- - {startTrigger.trigger.help && ( -

{startTrigger.trigger.help}

- )} - {startTrigger.object && newTrigger && startTrigger.object.showWhen?.equals.includes(newTrigger) && ( - - )} -
- )} -
-
- - } - onSubmit={({ label, name }) => { - if (newChoice === 'advanced') { - void doCreateFlow( - label, - name, - newTrigger - ? { - triggerType: newTrigger, - objectName: - startTrigger.object?.showWhen?.equals.includes(newTrigger) && newTriggerObject.trim() - ? newTriggerObject.trim() - : undefined, - } - : null, - ); - return; - } - // A preset: its trigger, or nothing sent while it waits for its object. - const trigger = flowPresetTrigger(newChoice, startTrigger.object?.showWhen?.equals ?? [], newTriggerObject); - if (!trigger) { - setNewNeeds(t('engine.studio.auto.preset.needsObject', locale)); - return; - } - void doCreateFlow(label, name, trigger); - }} - />
); } 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 b9e7d0d6807..0c2afe61533 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 @@ -66,8 +66,8 @@ afterEach(() => { }); function LocationProbe() { - const { pathname } = useLocation(); - return
{pathname}
; + const { pathname, search } = useLocation(); + return
{`${pathname}${search}`}
; } function renderLanding() { @@ -77,6 +77,8 @@ function renderLanding() { } /> } /> + {/* objectstack#36903 — the scope's flows are its area's list. */} + } /> , ); @@ -96,8 +98,8 @@ describe('Studio home → the package-less scope (objectui#11553)', () => { expect(vi.mocked(loadPackageLessSurfaces)).toHaveBeenCalledWith(expect.anything(), 'flow', expect.any(String)); fireEvent.click(entry); - await waitFor(() => expect(screen.getByTestId('location')).toHaveTextContent('/studio/~org/automations')); - expect(screen.getByTestId('pillar-builder')).toBeInTheDocument(); + await waitFor(() => expect(screen.getByTestId('location')).toHaveTextContent('/studio/~org/metadata/flow?source=runtime')); + expect(screen.getByTestId('area-flow-list')).toBeInTheDocument(); }); it('offers it beside writable packages too, and a package card still opens that package', async () => { diff --git a/ui/packages/app-shell/src/views/studio-design/CreateItemDialog.labels-13128.test.tsx b/ui/packages/app-shell/src/views/studio-design/CreateItemDialog.labels-13128.test.tsx index 149064e1464..d3e2d956c9f 100644 --- a/ui/packages/app-shell/src/views/studio-design/CreateItemDialog.labels-13128.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/CreateItemDialog.labels-13128.test.tsx @@ -115,8 +115,9 @@ describe('Studio create dialogs bind each label to its input (objectui#13128)', }); it('Create app (a sibling dialog on the same component): "App name" and "Identifier" each find their input', async () => { + // objectstack#36903 — the Automations pillar is retired; the sharing overview's page hosts the toolbar. render( - + } /> diff --git a/ui/packages/app-shell/src/views/studio-design/FlowItemMoreMenu.tsx b/ui/packages/app-shell/src/views/studio-design/FlowItemMoreMenu.tsx index 94bec0f81f5..5024378a800 100644 --- a/ui/packages/app-shell/src/views/studio-design/FlowItemMoreMenu.tsx +++ b/ui/packages/app-shell/src/views/studio-design/FlowItemMoreMenu.tsx @@ -1,7 +1,12 @@ // Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. /** - * FlowItemMoreMenu — the Automations pillar's ⋯ menu on an open flow. + * FlowItemMoreMenu — the flow designer's ⋯ menu items, and their dialogs. + * + * objectstack#36903 — the designer is a full-screen item page now, whose + * header (`ResourceDetailHeader`) draws the ⋯ and the items the narrow header + * folds into it; {@link useFlowItemMenu} hands it the flow's own items, and + * the dialogs they open, to draw beside the header. * * - **New similar** (objectstack#28567, ADR-0146 D4 · Q6): the flow clone * door (`POST /api/v1/automation//clone`) under a NEW machine name and @@ -42,20 +47,15 @@ import { DialogFooter, DialogHeader, DialogTitle, - DropdownMenu, - DropdownMenuContent, DropdownMenuItem, - DropdownMenuTrigger, Input, Label, } from '@object-ui/components'; import { actionErrorDetail } from '@object-ui/core'; -import { StudioItemHeaderFoldedItems } from './StudioItemHeader.js'; -import { Copy, Loader2, MoreHorizontal, Trash2 } from 'lucide-react'; +import { Copy, Loader2, Trash2 } from 'lucide-react'; import { t, tFormat, translateMetadataType } from '../metadata-admin/i18n.js'; import { envelopeData, envelopeRefused } from '../setup/packagedFlows.js'; import { apiBase } from '../../utils/apiBase.js'; -import { STUDIO_HEADER_ICON_BUTTON } from './studio-tokens.js'; import { createAuthenticatedFetch } from '@object-ui/auth'; /** The console's authenticated fetch: the stored bearer token beside the session cookie. */ @@ -147,19 +147,25 @@ interface NewSimilarDraft { refusal: string | null; } +/** The flow's ⋯ items (`null` when it has none) and the dialogs they open. */ +export interface FlowItemMenu { + items: React.ReactNode | null; + dialogs: React.ReactNode; +} + /** * `label` is the flow's display label; `disabled` holds the menu's actions * while a save is in flight. `onDelete` draws Delete flow (a writable * package's flow); `newSimilar` draws New similar. */ -export function FlowItemMoreMenu({ name, label, locale, disabled, onDelete, newSimilar }: { +export function useFlowItemMenu({ name, label, locale, disabled, onDelete, newSimilar }: { name: string; label: string; locale: string; disabled?: boolean; onDelete?: () => void; newSimilar?: FlowNewSimilarProps; -}): React.ReactElement { +}): FlowItemMenu { const [confirming, setConfirming] = React.useState(false); const [copy, setCopy] = React.useState(null); const vars = { type: 'flow', name, typeLabel: translateMetadataType('flow', locale), item: label || name }; @@ -198,47 +204,36 @@ export function FlowItemMoreMenu({ name, label, locale, disabled, onDelete, newS newSimilar.onCopied(outcome.copy); }; - return ( - <> - - - - - - {/* objectstack#29693 — what the flow header's title row folded away, on a narrow row. */} - - {newSimilar && ( - - - )} - {onDelete && ( - setConfirming(true)} - > - - )} - - +
); } + if (opens.designer && type === 'flow') { + // objectstack#36903 — the flow designer, full-screen on the flow's + // address. The package-less scope's flows are the organization's own and + // open writable (its area is read-only to the list's create alone). + return ( +
+ +
+ ); + } // objectstack#36905 — a permission set opens its matrix full-screen here. if (opens.designer && host?.packageId) { return ( @@ -247,23 +278,21 @@ function AreaItemOpen({ * A type whose item page is an editor of its own (`registerMetadataResource`'s * `EditPage`: the permission set's matrix) has no tabs on the cross-package * leg, and its History button opens this address there: it keeps the - * standalone history page. So does an item whose address opens a pillar's - * designer, until the designer mounts the tabs. objectstack#36905 — on a - * package's leg the permission set's full-screen page has them; - * objectstack#36904 — so does the object designer (History is its tab). A - * flow keeps the standalone page until its designer moves. + * standalone history page. On a package's leg every designer page has the + * tabs: the permission set's (objectstack#36905), the object's + * (objectstack#36904) and the flow's (objectstack#36903), so their + * `/history` opens that tab like every item's. No pillar designs an item any + * more, so the exemption that kept a pillar item's history on the standalone + * page is gone with the last of them (objectstack#36903). */ function AreaHistoryRedirect(): React.ReactElement { - const { type = '', name = '' } = useParams<{ type: string; name: string }>(); + const { type = '' } = useParams<{ type: string }>(); const { pathname, search } = useLocation(); const host = useMetadataAreaHost(); const params = new URLSearchParams(search); const designerPage = areaItemOpensDesignerPage({ packageId: host?.packageId ?? null, type }); const ownEditor = !designerPage && !!getMetadataResource(type)?.EditPage; - // An item a pillar's designer opens has no tab row yet (its tabs are the - // designers' cards): its history keeps the standalone page too. - const pillarItem = areaItemPillarPath({ packageId: host?.packageId ?? null, type, name, search: params }) !== null; - if (ownEditor || pillarItem) return ; + if (ownEditor) return ; params.set(ITEM_TOOL_TAB_PARAM, 'history'); return ; } @@ -352,12 +381,19 @@ export interface StudioMetadataAreaProps { */ publishRefusalFor?: (type: string, name: string) => StudioRefusal | null; /** - * objectstack#36905, objectstack#36904 — told the open designer page's item - * label (the permission set's, the object's), for the copilot's chip, as a + * objectstack#36903 — the area of the package-less scope (`~org`, with no + * `packageId`): its flows, listed and opened full-screen. It creates nothing + * (`studioScope.ts`), so its host is read-only to the list's create. + */ + orgScope?: boolean; + /** + * objectstack#36905, objectstack#36904, objectstack#36903 — told the open + * designer page's item label (the permission set's, the object's, the + * flow's), for the copilot's chip, as a * pillar tells it. */ onSurfaceLabelChange?: (surface: StudioSurfaceLabel | null) => void; - /** objectstack#36904 — handed to the object designer (`AreaEditorProps`). */ + /** objectstack#36904, objectstack#36903 — handed to the object and flow designers (`AreaEditorProps`). */ onHeldEditChange?: (clause: string | null) => void; onReviewChanges?: () => void; } @@ -368,32 +404,46 @@ export function StudioMetadataArea({ publishNonce = 0, onDraftSaved, publishRefusalFor, + orgScope = false, onHeldEditChange, onSurfaceLabelChange, onReviewChanges, }: StudioMetadataAreaProps): React.ReactElement { const { pathname, search } = useLocation(); const locale = useMetadataLocale(); - const segment = packageId ?? STUDIO_ALL_PACKAGES_SEGMENT; + const segment = packageId ?? (orgScope ? STUDIO_ORG_SCOPE_SEGMENT : STUDIO_ALL_PACKAGES_SEGMENT); const basePath = studioMetadataAreaPath(segment); // The courtesy gate the pillars apply, read for the area from the listed // manifests (see the hook). Unknown stays ungated, as on the pillars: the // server's write gate is the authority, and a failed probe must not lock an // author out of a writable package. const { writable, kernel } = useListedPackageWritable(packageId); - const readOnly = packageId !== null && writable === false; + // objectstack#36903 — the package-less scope creates nothing: read-only to + // the list's create (its designer opens writable, `AreaItemOpen`). + const readOnly = orgScope || (packageId !== null && writable === false); // objectstack#36897 — the list offers a create exactly where `AreaCreate` // opens one in the pair; never on a kernel package, which has none. const pairCreate = readOnly && !kernel && !!customization && !customization.walled; + // objectstack#36903 — the scope's empty flow list keeps the guidance its + // pillar's empty state gave: a packaged flow is changed in its package, with + // New similar (ADR-0146 D11). + const emptyListHint = orgScope ? t('engine.studio.org.none', locale) : undefined; const host = React.useMemo( - () => ({ packageId, readOnly, basePath, ...(pairCreate ? { pairCreate } : {}) }), - [packageId, readOnly, basePath, pairCreate], + () => ({ + packageId, + readOnly, + basePath, + ...(pairCreate ? { pairCreate } : {}), + ...(emptyListHint ? { emptyListHint } : {}), + }), + [packageId, readOnly, basePath, pairCreate, emptyListHint], ); const editor: AreaEditorProps = { customization, publishNonce, onDraftSaved, publishRefusalFor, + orgScope, onHeldEditChange, onSurfaceLabelChange, onReviewChanges, diff --git a/ui/packages/app-shell/src/views/studio-design/StudioPaletteGroups.surfaceScope-36900.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioPaletteGroups.surfaceScope-36900.test.tsx index 5b5e3d49a78..463174cc231 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioPaletteGroups.surfaceScope-36900.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioPaletteGroups.surfaceScope-36900.test.tsx @@ -314,7 +314,7 @@ describe("on a package, the palette lists the left menu and the package's items it('opens a menu entry where the menu entry goes, and the palette closes', async () => { expect(await openedBy('studio-entry type:hook')).toBe('/studio/com.acme.crm/metadata/hook?package=com.acme.crm'); - expect(await openedBy('studio-entry orgFlows')).toBe('/studio/~org/automations'); + expect(await openedBy('studio-entry orgFlows')).toBe('/studio/~org/metadata/flow?source=runtime'); expect(await openedBy('studio-entry owd')).toBe('/studio/com.acme.crm/owd'); expect(await openedBy('studio-entry diagnostics')).toBe('/studio/com.acme.crm/metadata/_diagnostics'); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioRail.noMatches-26733.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioRail.noMatches-26733.test.tsx deleted file mode 100644 index 6ac710880bf..00000000000 --- a/ui/packages/app-shell/src/views/studio-design/StudioRail.noMatches-26733.test.tsx +++ /dev/null @@ -1,371 +0,0 @@ -// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. - -/** - * objectstack#26733 — a Studio rail search that matches nothing says so. - * - * Before: the Data and Access rails (the Access rail retired by objectstack#36905) went blank under a query that matched no - * row, so a mistyped search read as a list that failed to load; the - * Automations rail printed its own sentence and offered no way back but the - * keyboard. Now the shared `StudioRail` draws one state for all three, from the - * match count each pillar hands it: a sentence naming the query, and a "Clear - * search" action that empties the box and puts every row back. - * - * Per rail (the REAL pillars over a mocked metadata client): - * - a query that matches nothing shows the state, naming the query; - * - "Clear search" restores the list and empties (and focuses) the box; - * - a query that matches shows no state; - * - an empty package keeps its own empty sentence, with no no-matches line, - * whether or not a query is typed. - * And the state reads in zh. - */ - -import '@testing-library/jest-dom/vitest'; -import * as React from 'react'; -import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; -import { cleanup, fireEvent, render, screen, waitFor, within } from '@testing-library/react'; -import { MemoryRouter } from 'react-router-dom'; -import { I18nProvider } from '@object-ui/i18n'; - -const PKG = 'com.acme.app'; - -/** What `client.list(type)` answers in the current test, per metadata type. */ -const listed = vi.hoisted(() => ({ rows: {} as Record>> })); - -const mockClient = vi.hoisted(() => ({ - list: vi.fn(async (type: string) => listed.rows[type] ?? []), - listDrafts: vi.fn(async () => [] as Array>), - listTypes: vi.fn(async () => ({ entries: [] })), - get: vi.fn(async () => null), - references: vi.fn(async () => []), - layered: vi.fn(async () => null), - getDraft: vi.fn(async () => null), - save: vi.fn(async () => { - throw new Error('this suite saves nothing'); - }), - publish: vi.fn(async () => ({ success: true })), - reset: vi.fn(async () => ({})), -})); - -vi.mock('../metadata-admin/useMetadata', async (importOriginal) => { - const mod = await importOriginal(); - return { - ...mod, - useMetadataClient: () => mockClient, - useMetadataTypes: () => ({ loading: false, error: null, entries: [] }), - }; -}); -vi.mock('./packages-io', async (importOriginal) => { - const mod = await importOriginal(); - return { ...mod, fetchPackages: vi.fn(async () => []) }; -}); -vi.mock('@object-ui/react', async (importOriginal) => { - const mod = await importOriginal(); - return { ...mod, useAdapter: () => dataSource }; -}); -vi.mock('sonner', () => ({ toast: { success: vi.fn(), error: vi.fn() } })); -vi.mock('../../components/SuggestedBindingsPanel', () => ({ SuggestedBindingsPanel: () => null })); -vi.mock('../metadata-admin/AccessExplainPanel', () => ({ AccessExplainPanel: () => null })); -vi.mock('./StudioAiCopilot', () => ({ StudioChatDock: () => null })); - -// The pillars reach `@objectstack/lint` through a dynamic import; paid here, at collection, not in a case's clock. -import '@objectstack/lint'; -// objectstack#36900 — the surface mounts the command palette, which reaches the -// record preview's `lazy()` detail entry: its first load is paid at collection too. -import '@object-ui/plugin-detail'; -// objectstack#36904, objectstack#36905 — the Data and Access pillars' rails are gone; the Automations rail is left. -import { AutomationsPillar } from './StudioDesignSurface'; -import { StudioRail, StudioRailRow } from './StudioRail'; -import { railAbbreviation } from './railAbbreviation'; -import { - STUDIO_PILLARS_HOST, - STUDIO_RAIL_FLOATING, - STUDIO_RAIL_NARROW_HOST_WIDTH, - STUDIO_RAIL_NARROW_WIDTH, - STUDIO_RAIL_ROW_ABBR, - STUDIO_RAIL_WIDTH, -} from './studio-tokens'; -import * as studioTokens from './studio-tokens'; -import { createEmptyDataSource, failOnAbsorbedFetchError } from './__tests__/emptyDataSource'; -import { t, tFormat } from '../metadata-admin/i18n'; - -// The "Clear search" row lives in `@object-ui/i18n`'s `studio` namespace, whose -// `zh` catalogue is fetched on demand (objectstack#25922). Resident before any -// case, so the zh case reads it synchronously. -import { loadStudioCatalogue } from '@object-ui/i18n/namespaces/studio'; -await loadStudioCatalogue('zh'); - -const dataSource = createEmptyDataSource(); -failOnAbsorbedFetchError(); - -// jsdom has no matchMedia — useIsMobile (rail overlay) needs a stub. -window.matchMedia = ((query: string) => ({ - matches: false, - media: query, - onchange: null, - addEventListener: () => {}, - removeEventListener: () => {}, - addListener: () => {}, - removeListener: () => {}, - dispatchEvent: () => false, -})) as unknown as typeof window.matchMedia; - -const NODES = [ - { id: 'start', type: 'start', label: 'Start' }, - { id: 'end', type: 'end', label: 'End' }, -]; -const EDGES = [{ id: 'e1', source: 'start', target: 'end' }]; - -const ROWS: Record>> = { - object: [ - { name: 'crm_account', label: 'Account' }, - { name: 'crm_contact', label: 'Contact' }, - ], - flow: [ - { name: 'nightly_digest', label: 'Nightly digest', type: 'autolaunched', nodes: NODES, edges: EDGES }, - { name: 'approve_order', label: 'Approve order', type: 'autolaunched', nodes: NODES, edges: EDGES }, - ], - permission: [ - { name: 'sales_rep', label: 'Sales rep' }, - { name: 'support_agent', label: 'Support agent' }, - ], -}; - -beforeEach(() => { - listed.rows = ROWS; - vi.stubGlobal( - 'fetch', - vi.fn(async () => new Response('null', { status: 404, headers: { 'content-type': 'application/json' } })), - ); -}); - -afterEach(() => { - cleanup(); - vi.unstubAllGlobals(); - vi.clearAllMocks(); -}); - -interface RailCase { - name: string; - railTestId: string; - placeholderKey: string; - /** The labels the rail lists for `ROWS`, and a query that matches only the first. */ - labels: [string, string]; - match: string; - /** The sentence the rail shows for an empty package. */ - emptyKey: string; - pillar: () => React.ReactElement; -} - -// objectstack#36904 — the object designer has no rail: objects are listed on -// the area's object list, so the Data rail's cases left this file. -const CASES: RailCase[] = [ - { - name: 'Automations', - railTestId: 'studio-rail-automations', - placeholderKey: 'engine.studio.designer.search', - labels: ['Nightly digest', 'Approve order'], - match: 'digest', - emptyKey: 'engine.studio.auto.none', - pillar: () => , - }, - // objectstack#36905 — the Access rail is gone: a permission set is chosen from its type's list. -]; - -function renderRail(c: RailCase, language: 'en' | 'zh' = 'en') { - render( - - {c.pillar()} - , - ); -} - -/** The rail once its rows have rendered, and its search box. */ -async function loadedRail(c: RailCase, locale: 'en' | 'zh-CN' = 'en') { - const rail = await screen.findByTestId(c.railTestId, undefined, { timeout: 8000 }); - await waitFor(() => expect(within(rail).getByText(c.labels[0])).toBeInTheDocument(), { timeout: 8000 }); - const search = within(rail).getByPlaceholderText(t(c.placeholderKey, locale)) as HTMLInputElement; - return { rail, search }; -} - -describe.each(CASES)('the $name rail: a search that matches nothing (objectstack#26733)', (c) => { - it('names the query, and lists no row', async () => { - renderRail(c); - const { rail, search } = await loadedRail(c); - fireEvent.change(search, { target: { value: ' zzzz ' } }); - - const state = within(rail).getByTestId('studio-rail-no-matches'); - expect(state).toHaveTextContent(tFormat('engine.list.emptyQuery', 'en', { query: 'zzzz' })); - expect(within(state).getByRole('button', { name: t('engine.studio.rail.clearSearch', 'en') })).toBeInTheDocument(); - for (const label of c.labels) expect(within(rail).queryByText(label)).toBeNull(); - // Not the empty-package sentence: the package HAS rows. - expect(within(rail).queryByText(t(c.emptyKey, 'en'))).toBeNull(); - }); - - it('"Clear search" empties the box and puts every row back', async () => { - renderRail(c); - const { rail, search } = await loadedRail(c); - fireEvent.change(search, { target: { value: 'zzzz' } }); - fireEvent.click(within(rail).getByTestId('studio-rail-clear-search')); - - expect(search.value).toBe(''); - expect(search).toHaveFocus(); - expect(within(rail).queryByTestId('studio-rail-no-matches')).toBeNull(); - for (const label of c.labels) expect(within(rail).getByText(label)).toBeInTheDocument(); - }); - - it('control: a query that matches shows its row and no state', async () => { - renderRail(c); - const { rail, search } = await loadedRail(c); - fireEvent.change(search, { target: { value: c.match } }); - - expect(within(rail).getByText(c.labels[0])).toBeInTheDocument(); - expect(within(rail).queryByText(c.labels[1])).toBeNull(); - expect(within(rail).queryByTestId('studio-rail-no-matches')).toBeNull(); - }); - - it('an empty package keeps its own sentence, and no no-matches line even under a query', async () => { - listed.rows = {}; - renderRail(c); - const rail = await screen.findByTestId(c.railTestId, undefined, { timeout: 8000 }); - await waitFor(() => expect(within(rail).getByText(t(c.emptyKey, 'en'))).toBeInTheDocument(), { timeout: 8000 }); - expect(within(rail).queryByTestId('studio-rail-no-matches')).toBeNull(); - - fireEvent.change(within(rail).getByPlaceholderText(t(c.placeholderKey, 'en')), { target: { value: 'zzzz' } }); - expect(within(rail).queryByTestId('studio-rail-no-matches')).toBeNull(); - }); -}); - -describe('the no-matches state in zh (objectstack#26733)', () => { - it('names the query and labels its action in Chinese', async () => { - const c = CASES[0]; - renderRail(c, 'zh'); - const { rail, search } = await loadedRail(c, 'zh-CN'); - fireEvent.change(search, { target: { value: 'zzzz' } }); - - const state = within(rail).getByTestId('studio-rail-no-matches'); - expect(state).toHaveTextContent(tFormat('engine.list.emptyQuery', 'zh-CN', { query: 'zzzz' })); - expect(within(state).getByRole('button')).toHaveTextContent('清除搜索'); - expect(t('engine.studio.rail.clearSearch', 'zh-CN')).toBe('清除搜索'); - }); -}); - -// objectstack#35061 item 1 — the narrow form every rail shares while the right -// slot squeezes the pillars. jsdom evaluates no container query: these pins -// hold the DOM both forms share and the class strings that switch between them. -describe('the rails\' narrow form (objectstack#35061)', () => { - it('abbreviates a name to its first character, upper-cased, a grapheme kept whole', () => { - expect(railAbbreviation('客户', 'zh-CN')).toBe('客'); - expect(railAbbreviation(' account', 'en')).toBe('A'); - expect(railAbbreviation('éclair', 'en')).toBe('É'); - expect(railAbbreviation('👩‍💻 team', 'en')).toBe('👩‍💻'); - // The display locale's case rules: Turkish dotted capital I. - expect(railAbbreviation('istanbul', 'tr')).toBe('İ'); - expect(railAbbreviation(' ', 'en')).toBe(''); - expect(railAbbreviation(undefined, 'en')).toBe(''); - }); - - it('every narrow-form class reads the pillars host, rail and content together, at 900 px', () => { - expect(STUDIO_RAIL_WIDTH).toBe('w-60'); - expect(STUDIO_RAIL_NARROW_HOST_WIDTH).toBe(900); - expect(STUDIO_PILLARS_HOST).toBe('group/studio-pillars @container/studio-pillars'); - const narrow = Object.entries(studioTokens).filter( - ([name, value]) => name.startsWith('STUDIO_RAIL_') && typeof value === 'string' && value.includes('studio-pillars'), - ); - expect(narrow.length).toBeGreaterThanOrEqual(9); - for (const [, value] of narrow) { - for (const cls of (value as string).split(/\s+/).filter((c) => c.includes('studio-pillars'))) { - expect(cls).toContain('group-data-[studio-slot=open]/studio-pillars:'); - expect(cls).toContain(`@max-[${STUDIO_RAIL_NARROW_HOST_WIDTH}px]/studio-pillars:`); - } - } - }); - - describe.each(CASES)('the $name rail', (c) => { - it('keeps its 240 px width class, and narrows by the host alone; each row carries its character and its whole name', async () => { - renderRail(c); - const { rail } = await loadedRail(c); - expect(rail).toHaveClass(STUDIO_RAIL_WIDTH, ...STUDIO_RAIL_NARROW_WIDTH.split(' ')); - expect(rail).toHaveAttribute('data-rail-peek', 'off'); - for (const label of c.labels) { - // The label stays the row's text and its accessible name; the character is generated content. - const row = within(rail).getByRole('button', { name: label }); - expect(row).toHaveAttribute('data-studio-rail-item'); - expect(row).toHaveAttribute('data-abbr', railAbbreviation(label, 'en')); - expect(row).toHaveClass(...STUDIO_RAIL_ROW_ABBR.split(' ')); - expect(row.textContent?.startsWith(label)).toBe(true); - expect(row.getAttribute('title')).toContain(label); - } - }); - - it('「»」 floats the full rail over the content; Escape puts it back and returns focus; so does a picked row', async () => { - renderRail(c); - const { rail } = await loadedRail(c); - const toggle = within(rail).getByTestId('studio-rail-float'); - expect(toggle).toHaveAccessibleName(t('engine.studio.rail.expand', 'en')); - expect(toggle).toHaveAttribute('aria-expanded', 'false'); - - fireEvent.click(toggle); - expect(rail).toHaveAttribute('data-rail-peek', 'on'); - expect(toggle).toHaveAttribute('aria-expanded', 'true'); - expect(toggle).toHaveAccessibleName(t('engine.studio.rail.collapse', 'en')); - expect(toggle.parentElement?.parentElement).toHaveClass(...STUDIO_RAIL_FLOATING.split(' ')); - - const row = within(rail).getByRole('button', { name: c.labels[1] }); - row.focus(); - fireEvent.keyDown(row, { key: 'Escape' }); - expect(rail).toHaveAttribute('data-rail-peek', 'off'); - expect(toggle).toHaveFocus(); - - fireEvent.click(toggle); - fireEvent.click(within(rail).getByRole('button', { name: c.labels[1] })); - expect(rail).toHaveAttribute('data-rail-peek', 'off'); - }); - }); - - it('a click outside puts the floating rail back; a click inside that picks nothing keeps it', () => { - render( -
- - {}, placeholder: 'Search' }}> - Account - -
, - ); - const rail = screen.getByTestId('rail'); - fireEvent.click(within(rail).getByTestId('studio-rail-float')); - fireEvent.pointerDown(within(rail).getByPlaceholderText('Search')); - expect(rail).toHaveAttribute('data-rail-peek', 'on'); - fireEvent.pointerDown(screen.getByRole('button', { name: 'outside' })); - expect(rail).toHaveAttribute('data-rail-peek', 'off'); - }); - - it('a row with no string name keeps its icon in the narrow form; under the mobile breakpoint there is no 「»」', () => { - render( - - }> - Sales rep - - - Support agent - - , - ); - const rail = screen.getByTestId('rail'); - expect(within(rail).queryByTestId('studio-rail-float')).toBeNull(); - expect(rail).not.toHaveClass(...STUDIO_RAIL_NARROW_WIDTH.split(' ')); - const [first, second] = within(rail).getAllByRole('button'); - expect(first).not.toHaveAttribute('data-abbr'); - expect(first).not.toHaveClass(...STUDIO_RAIL_ROW_ABBR.split(' ')); - expect(within(first).getByTestId('glyph').parentElement?.className).toBe('contents'); - expect(second).toHaveAttribute('data-abbr', 'S'); - expect(second).toHaveAttribute('title', 'Support agent'); - expect(second).toHaveTextContent(/^Support agent$/); - }); - - it('reads 「»」 in zh', async () => { - renderRail(CASES[0], 'zh'); - const rail = await screen.findByTestId(CASES[0].railTestId, undefined, { timeout: 8000 }); - expect(within(rail).getByTestId('studio-rail-float')).toHaveAccessibleName('展开完整列表'); - expect(t('engine.studio.rail.collapse', 'zh-CN')).toBe('收回窄栏'); - }); -}); diff --git a/ui/packages/app-shell/src/views/studio-design/__tests__/listFlowCreateHost.tsx b/ui/packages/app-shell/src/views/studio-design/__tests__/listFlowCreateHost.tsx new file mode 100644 index 00000000000..82a6d18bd42 --- /dev/null +++ b/ui/packages/app-shell/src/views/studio-design/__tests__/listFlowCreateHost.tsx @@ -0,0 +1,71 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +/** + * objectstack#36903 — the flow list's 「新建」, for the suites whose subject is + * the New automation dialog. The Automations pillar's own New (its rail's "+") + * is gone with the rail; every flow is created from the list's dialog + * (`MetadataListCreateDialog`), which offers the same starting points, the + * same Advanced trigger form and the same refusals. + * + * The button stands in for the list's 「新建」: it carries the dialog's title, + * as the rail's "+" did, so the suites open the dialog by that title. Each + * press mounts a fresh dialog, as the list does on every open. + */ + +import * as React from 'react'; +import { useNavigate } from 'react-router-dom'; +import { MetadataListCreateDialog } from '../../metadata-admin/MetadataListCreateDialog.js'; +import { t, type SupportedLocale } from '../../metadata-admin/i18n.js'; + +export function ListFlowCreate({ + packageId, + inPair = false, + locale = 'en-US', + onCreated, +}: { + packageId: string; + inPair?: boolean; + locale?: SupportedLocale; + onCreated?: (created: { name: string; packageId: string }) => void; +}): React.ReactElement { + const [opened, setOpened] = React.useState(0); + const [open, setOpen] = React.useState(false); + // As the list does: the dialog's Open on a taken identifier closes it and + // goes to the holder's address. + const navigate = useNavigate(); + const title = t('engine.studio.auto.newTitle', locale); + return ( + <> + + {opened > 0 && ( + { + setOpen(false); + onCreated?.(created); + }} + onOpenExisting={(path) => { + setOpen(false); + navigate(path); + }} + /> + )} + + ); +} diff --git a/ui/packages/app-shell/src/views/studio-design/automationsPillarRedirect.test.ts b/ui/packages/app-shell/src/views/studio-design/automationsPillarRedirect.test.ts new file mode 100644 index 00000000000..c3e497cc57b --- /dev/null +++ b/ui/packages/app-shell/src/views/studio-design/automationsPillarRedirect.test.ts @@ -0,0 +1,43 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +/** + * objectstack#36903 — the retired Automations pillar's addresses land on the + * flow's designer or the flow list, of the package or of the package-less + * scope, their own qualifiers dropped and everything else kept verbatim. + */ + +import { describe, it, expect } from 'vitest'; +import { automationsPillarRedirect } from './automationsPillarRedirect'; + +const PKG = 'com.acme.crm'; + +describe('automationsPillarRedirect', () => { + it('a package\'s flow opens its designer; the bare pillar, the flow list', () => { + expect(automationsPillarRedirect(PKG, '?surface=flow%3Anotify_owner')).toBe(`/studio/${PKG}/metadata/flow/notify_owner`); + expect(automationsPillarRedirect(PKG, '')).toBe(`/studio/${PKG}/metadata/flow`); + // A surface naming another type opens nothing of its own: the list. + expect(automationsPillarRedirect(PKG, '?surface=object%3Aaccount')).toBe(`/studio/${PKG}/metadata/flow`); + }); + + it('drops the pillar\'s qualifiers and keeps the rest verbatim, the server\'s review link included', () => { + expect(automationsPillarRedirect(PKG, '?surface=flow%3Af&view=x&nav=y&changes=review')).toBe( + `/studio/${PKG}/metadata/flow/f?changes=review`, + ); + expect(automationsPillarRedirect(PKG, '?changes=review&package=' + PKG)).toBe( + `/studio/${PKG}/metadata/flow?changes=review&package=${PKG}`, + ); + }); + + it('the package-less scope lands on its own leg, with no package and its source filter once', () => { + expect(automationsPillarRedirect('~org', '')).toBe('/studio/~org/metadata/flow?source=runtime'); + expect(automationsPillarRedirect('~org', '?surface=flow%3Aqa_clone')).toBe('/studio/~org/metadata/flow/qa_clone?source=runtime'); + expect(automationsPillarRedirect('~org', '?surface=flow%3Aqa_clone&package=x&source=artifact&changes=review')).toBe( + '/studio/~org/metadata/flow/qa_clone?source=runtime&changes=review', + ); + }); + + it('a name with reserved characters round-trips', () => { + const to = automationsPillarRedirect(PKG, `?surface=${encodeURIComponent('flow:a b')}`); + expect(to).toBe(`/studio/${PKG}/metadata/flow/a%20b`); + }); +}); diff --git a/ui/packages/app-shell/src/views/studio-design/automationsPillarRedirect.ts b/ui/packages/app-shell/src/views/studio-design/automationsPillarRedirect.ts new file mode 100644 index 00000000000..7cec5f2ce9d --- /dev/null +++ b/ui/packages/app-shell/src/views/studio-design/automationsPillarRedirect.ts @@ -0,0 +1,60 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +/** + * objectstack#36903 (Studio redesign epic #36890, step 3 of the address + * table's switch) — where the retired Automations pillar's address lands. + * + * A flow opens its designer full-screen on its metadata address + * (`/studio//metadata/flow/`), and the package-less scope's + * flows on that scope's own leg (`/studio/~org/metadata/flow/`, + * `studioScope.ts`). The pillar's addresses are bookmarks, test pins and links + * an AI was handed, so each still opens what it named: + * + * - `/automations?surface=flow:` → that flow's designer; + * - `/automations` with no flow named, or naming another type → the flow + * list of the same scope (the pillar opened its first flow; the list is + * where a flow is chosen now, decision 7). + * + * The pillar's own qualifiers go (`?surface=`, and `?view=` and `?nav=`, which + * opened nothing on a flow); everything else is kept verbatim, `?changes=review` + * (the server's draft review link, `studioChangesReviewLink`) included. On a + * package's leg the area adds `?package=` itself (`areaLocationRedirect`). + * + * Pure, so the mapping is pinned without a render. + */ + +import { LIST_SOURCE_PARAM } from '../metadata-admin/metadataListState.js'; +import { DESIGNER_SURFACE_PARAM, parseSurfaceParam } from '../metadata-admin/nav-selection.js'; +import { studioMetadataItemAddress, studioMetadataTypePath } from './studioAddress.js'; +import { isStudioOrgScope, studioOrgScopePath } from './studioScope.js'; +import { DESIGNER_SURFACE_NAV_PARAM, DESIGNER_SURFACE_VIEW_PARAM } from './useSurfaceDeepLink.js'; + +/** The pillar's qualifiers that do not travel to the metadata address. */ +const PILLAR_ONLY_PARAMS: readonly string[] = [DESIGNER_SURFACE_PARAM, DESIGNER_SURFACE_VIEW_PARAM, DESIGNER_SURFACE_NAV_PARAM]; + +function withQuery(path: string, params: URLSearchParams): string { + const query = params.toString(); + if (!query) return path; + return `${path}${path.includes('?') ? '&' : '?'}${query}`; +} + +/** + * Where `/studio//automations` lands. `segment` is the route + * segment as read (a package id, or `~org`); `search` is the URL's query, with + * or without its `?`. + */ +export function automationsPillarRedirect(segment: string, search: string): string { + const params = new URLSearchParams(search); + const target = parseSurfaceParam(params.get(DESIGNER_SURFACE_PARAM)); + const flow = target?.type === 'flow' && target.name ? target.name : null; + for (const key of PILLAR_ONLY_PARAMS) params.delete(key); + if (isStudioOrgScope(segment)) { + // The scope names no package: a `?package=` it was handed is not carried, + // and its own address already carries the scope's source filter. + params.delete('package'); + params.delete(LIST_SOURCE_PARAM); + return withQuery(studioOrgScopePath(flow ? { type: 'flow', name: flow } : undefined), params); + } + if (flow) return studioMetadataItemAddress(segment, 'flow', flow, { query: params }); + return withQuery(studioMetadataTypePath(segment, 'flow'), params); +} diff --git a/ui/packages/app-shell/src/views/studio-design/flowDesignerTabs.test.ts b/ui/packages/app-shell/src/views/studio-design/flowDesignerTabs.test.ts new file mode 100644 index 00000000000..33202daf74b --- /dev/null +++ b/ui/packages/app-shell/src/views/studio-design/flowDesignerTabs.test.ts @@ -0,0 +1,39 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +/** + * objectstack#36903 — the flow designer's tab address: its own sections, then + * the item tools, in `?tab=`; Canvas writes nothing. + */ + +import { describe, it, expect } from 'vitest'; +import { FLOW_DESIGNER_TOOL_TABS, flowDesignerTabAddress, readFlowDesignerTab } from './flowDesignerTabs'; +// The source under test reaches these dynamic imports (the command palette's +// record preview, the drafts panel's lint, the code editor): their first load +// is paid here, at collection, never inside a case's clock (`check:test-source-alias`). +import '@object-ui/plugin-editor'; + +describe('the flow designer\'s tab address', () => { + it('reads each section and writes it back; Canvas is the default and writes nothing', () => { + for (const section of ['variables', 'runs', 'problems', 'debug'] as const) { + const location = readFlowDesignerTab(section, FLOW_DESIGNER_TOOL_TABS); + expect(location).toEqual({ section, tool: null }); + expect(flowDesignerTabAddress(location)).toBe(section); + } + expect(readFlowDesignerTab(null, FLOW_DESIGNER_TOOL_TABS)).toEqual({ section: 'canvas', tool: null }); + expect(flowDesignerTabAddress({ section: 'canvas', tool: null })).toBeNull(); + }); + + it('reads the item tools and their second views, the retired sheets\' values included', () => { + expect(readFlowDesignerTab('history', FLOW_DESIGNER_TOOL_TABS)).toEqual({ section: 'canvas', tool: { tab: 'history' } }); + expect(readFlowDesignerTab('audit', FLOW_DESIGNER_TOOL_TABS)).toEqual({ section: 'canvas', tool: { tab: 'history', view: 'audit' } }); + expect(readFlowDesignerTab('layers', FLOW_DESIGNER_TOOL_TABS)).toEqual({ section: 'canvas', tool: { tab: 'source', view: 'layers' } }); + expect(flowDesignerTabAddress({ section: 'canvas', tool: { tab: 'source', view: 'layers' } })).toBe('layers'); + }); + + it('a tool not offered to this caller, or an unknown value, opens Canvas', () => { + const noTrail = FLOW_DESIGNER_TOOL_TABS.filter((tab) => tab !== 'history'); + expect(readFlowDesignerTab('history', noTrail)).toEqual({ section: 'canvas', tool: null }); + expect(readFlowDesignerTab('details', FLOW_DESIGNER_TOOL_TABS)).toEqual({ section: 'canvas', tool: null }); + expect(readFlowDesignerTab('nonsense', FLOW_DESIGNER_TOOL_TABS)).toEqual({ section: 'canvas', tool: null }); + }); +}); diff --git a/ui/packages/app-shell/src/views/studio-design/flowDesignerTabs.ts b/ui/packages/app-shell/src/views/studio-design/flowDesignerTabs.ts new file mode 100644 index 00000000000..309228fe353 --- /dev/null +++ b/ui/packages/app-shell/src/views/studio-design/flowDesignerTabs.ts @@ -0,0 +1,102 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +/** + * The flow designer's tabs and their address (objectstack#36903, epic + * objectstack#36890 decision 8). + * + * The designer's own sections come first, in the order the flow's header + * drew them: Canvas, Variables, Runs, Problems, Debug (`FlowPreviewSection`). + * The item tools follow as tabs of the same row (`ItemToolTabs`): References, + * History (its audit log inside it) and Source (its layered comparison inside + * it). They replace the item-tools menu and its side sheets. + * + * The open tab is in the address, `?tab=` (the console's reserved `tab`, the + * key every item page writes), so a refresh, a shared link or ‹ › reopens it. + * Canvas is the default and writes nothing. A tool tab writes the + * `ItemToolTabs` value (`history`, `audit`, `source`, `layers`, + * `references`), so `/history` on the area's history address lands on History + * here as on every item page. + */ + +import * as React from 'react'; +import { useSearchParams } from 'react-router-dom'; +import { + ITEM_TOOL_TAB_PARAM, + itemToolAddress, + readItemToolLocation, + type ItemToolLocation, + type ItemToolTab, +} from '../item-tools/ItemToolTabs.js'; +import type { FlowPreviewSection } from '../metadata-admin/previews/FlowPreview.js'; + +/** The designer's own sections, each with its address value. Canvas is the default. */ +export const FLOW_DESIGNER_SECTIONS: readonly FlowPreviewSection[] = ['canvas', 'variables', 'runs', 'problems', 'debug']; + +/** The item tools the designer offers as tabs, after its own sections. */ +export const FLOW_DESIGNER_TOOL_TABS: readonly ItemToolTab[] = ['references', 'history', 'source']; + +/** Where the designer is open: one of its sections, or an item tool (over the canvas's section). */ +export type FlowDesignerLocation = + | { section: FlowPreviewSection; tool: null } + | { section: 'canvas'; tool: ItemToolLocation }; + +/** The location an address value names, or Canvas for a value that opens nothing here. */ +export function readFlowDesignerTab(raw: string | null | undefined, tools: readonly ItemToolTab[]): FlowDesignerLocation { + if (raw && (FLOW_DESIGNER_SECTIONS as readonly string[]).includes(raw)) { + return { section: raw as FlowPreviewSection, tool: null }; + } + const tool = readItemToolLocation(raw, tools); + return tool ? { section: 'canvas', tool } : { section: 'canvas', tool: null }; +} + +/** The address value of a location, `null` on the default (Canvas). */ +export function flowDesignerTabAddress(location: FlowDesignerLocation): string | null { + if (location.tool) return itemToolAddress(location.tool); + return location.section === 'canvas' ? null : location.section; +} + +export interface FlowDesignerTabState { + location: FlowDesignerLocation; + /** The `?tab=` value in force, `null` on Canvas. */ + address: string | null; + selectSection: (section: FlowPreviewSection) => void; + selectTool: (tool: ItemToolLocation) => void; +} + +/** + * The open tab, seeded from the address and written back to it (a replace + * navigation of the router's own location, so the router and the address + * never disagree, and ‹ › and × read the same query). A tool tab not offered + * to this caller (History without the trail capabilities) opens Canvas. + */ +export function useFlowDesignerTab(tools: readonly ItemToolTab[]): FlowDesignerTabState { + const [searchParams, setSearchParams] = useSearchParams(); + const [choice, setChoice] = React.useState(() => searchParams.get(ITEM_TOOL_TAB_PARAM)); + const location = readFlowDesignerTab(choice, tools); + const address = flowDesignerTabAddress(location); + + const inAddress = searchParams.get(ITEM_TOOL_TAB_PARAM); + React.useEffect(() => { + if ((inAddress ?? null) === address) return; + setSearchParams( + (prev) => { + const next = new URLSearchParams(prev); + if (address) next.set(ITEM_TOOL_TAB_PARAM, address); + else next.delete(ITEM_TOOL_TAB_PARAM); + return next; + }, + { replace: true }, + ); + // Keyed on the values alone: `setSearchParams` is re-minted with every + // search change (objectui#8640 — never key on a hook's identity). + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [address, inAddress]); + + const selectSection = React.useCallback((section: FlowPreviewSection) => { + setChoice(flowDesignerTabAddress({ section, tool: null })); + }, []); + const selectTool = React.useCallback((tool: ItemToolLocation) => { + setChoice(itemToolAddress(tool)); + }, []); + return { location, address, selectSection, selectTool }; +} diff --git a/ui/packages/app-shell/src/views/studio-design/metadataArea.test.ts b/ui/packages/app-shell/src/views/studio-design/metadataArea.test.ts index 95f2331d45a..e99689dd1f9 100644 --- a/ui/packages/app-shell/src/views/studio-design/metadataArea.test.ts +++ b/ui/packages/app-shell/src/views/studio-design/metadataArea.test.ts @@ -17,6 +17,7 @@ import { areaDesignerItemOf, areaItemAsksGenericPage, areaItemOpensDesignerPage, + orgScopeFlowOf, areaItemOpensFormEditor, areaItemPillarPath, areaLocationRedirect, @@ -85,10 +86,26 @@ describe('areaLocationRedirect — the query names the leg', () => { }); it('the package-less scope is never written into `?package=`: it lands on its flows (objectstack#36899)', () => { - expect(areaLocationRedirect('~org', '', '')).toBe('/studio/~org/automations'); - expect(areaLocationRedirect('~org', 'flow', '')).toBe('/studio/~org/automations'); - expect(areaLocationRedirect(STUDIO_ALL_PACKAGES_SEGMENT, 'flow', '?package=~org')).toBe('/studio/~org/automations'); - expect(areaLocationRedirect(PKG, 'flow', '?package=~org')).toBe('/studio/~org/automations'); + // objectstack#36903 — on its own leg of the area, with the scope's source filter. + const LIST = '/studio/~org/metadata/flow?source=runtime'; + expect(areaLocationRedirect('~org', '', '')).toBe(LIST); + expect(areaLocationRedirect('~org', 'flow', '')).toBe(LIST); + expect(areaLocationRedirect('~org', 'object', '?source=runtime')).toBe(LIST); + expect(areaLocationRedirect('~org', 'flow/new', '?source=runtime')).toBe(LIST); + expect(areaLocationRedirect(STUDIO_ALL_PACKAGES_SEGMENT, 'flow', '?package=~org')).toBe(LIST); + expect(areaLocationRedirect(PKG, 'flow', '?package=~org')).toBe(LIST); + expect(areaLocationRedirect(PKG, 'flow/f1', '?package=~org&tab=history')).toBe('/studio/~org/metadata/flow/f1?tab=history&source=runtime'); + }); + + it('objectstack#36903 — the scope\'s leg settles on its flows, and re-roots a link naming a package', () => { + expect(areaLocationRedirect('~org', 'flow', '?source=runtime')).toBeNull(); + expect(areaLocationRedirect('~org', 'flow/f1', '?source=runtime&tab=source')).toBeNull(); + expect(areaLocationRedirect('~org', 'flow/f1/history', '?source=runtime')).toBeNull(); + // The filter is the scope's meaning: a URL without it gets it. + expect(areaLocationRedirect('~org', 'flow/f1', '')).toBe('/studio/~org/metadata/flow/f1?source=runtime'); + // A packaged row reached by clearing the filter opens in its package. + expect(areaLocationRedirect('~org', 'flow/f1', `?package=${PKG}`)).toBe(`/studio/${PKG}/metadata/flow/f1?package=${PKG}`); + expect(areaLocationRedirect('~org', 'flow', '?package=all')).toBe('/studio/~all/metadata/flow?package=all'); }); }); @@ -97,47 +114,39 @@ describe('areaItemPillarPath — a pillar type opens its pillar', () => { const open = (type: string, q = '', packageId: string | null = PKG) => areaItemPillarPath({ packageId, type, name: 'n_1', search: search(q) }); - it('flow opens its pillar with `?surface=`', () => { - // objectstack#36905, objectstack#36904 — a permission set and an object no - // longer do (`areaItemOpensDesignerPage`). - const expected: Record = { - flow: 'automations', - }; - expect(AREA_PILLAR_FOR_TYPE).toEqual(expected); - for (const [type, pillar] of Object.entries(expected)) { - const path = open(type); - expect(path, type).not.toBeNull(); - const url = new URL(path!, 'http://x'); - expect(url.pathname).toBe(`/studio/${PKG}/${pillar}`); - expect(parseSurfaceParam(url.searchParams.get('surface'))).toEqual({ type, name: 'n_1' }); - } + it('no type opens a pillar any more', () => { + // objectstack#36905, objectstack#36904, objectstack#36903 — the permission + // set, the object and the flow open their designer page instead + // (`areaItemOpensDesignerPage`). + expect(AREA_PILLAR_FOR_TYPE).toEqual({}); + for (const type of ['object', 'flow', 'permission']) expect(open(type), type).toBeNull(); }); it('every other type opens the generic item page', () => { // objectstack#36502 — page, dashboard, report and view lost their pillar with Interfaces. - // objectstack#36905, objectstack#36904 — a permission set and an object open their designer page instead. - for (const type of ['permission', 'object', 'translation', 'email_template', 'agent', 'position', 'sharing_rule', 'app', 'page', 'dashboard', 'report', 'view']) { + // objectstack#36905, objectstack#36904, objectstack#36903 — the designer types open their designer page instead. + for (const type of ['flow', 'permission', 'object', 'translation', 'email_template', 'agent', 'position', 'sharing_rule', 'app', 'page', 'dashboard', 'report', 'view']) { expect(open(type), type).toBeNull(); } }); it('the cross-package leg, the environment scope and `?review=1` open the generic page', () => { - expect(open('flow', '', null)).toBeNull(); + expect(open('object', '', null)).toBeNull(); expect(open('object', '?scope=environment')).toBeNull(); - expect(open('flow', '?review=1')).toBeNull(); - // Control: the same item without them opens the pillar. - expect(open('flow', '?review=0')).not.toBeNull(); + expect(open('object', '?review=1')).toBeNull(); + // objectstack#36903 — no type opens a pillar, with or without them. + expect(open('object', '?review=0')).toBeNull(); }); }); describe('areaItemOpensDesignerPage — a permission set opens its matrix full-screen (objectstack#36905)', () => { it('on a package\'s leg only', () => { - expect(AREA_DESIGNER_PAGE_TYPES).toEqual(['permission', 'object']); + // objectstack#36904, objectstack#36903 — and the object and flow designers (below). + expect(AREA_DESIGNER_PAGE_TYPES).toEqual(['permission', 'object', 'flow']); expect(areaItemOpensDesignerPage({ packageId: PKG, type: 'permission' })).toBe(true); // The cross-package leg keeps the matrix's environment presentation. expect(areaItemOpensDesignerPage({ packageId: null, type: 'permission' })).toBe(false); - // objectstack#36904 — and an object (pinned below, with the object designer). - for (const type of ['flow', 'position', 'view']) { + for (const type of ['position', 'view']) { expect(areaItemOpensDesignerPage({ packageId: PKG, type }), type).toBe(false); } }); @@ -201,6 +210,54 @@ describe('areaItemOpensFormEditor — a read-only package’s dataset opens its }); }); +describe('areaItemOpensDesignerPage — a flow opens its designer full-screen (objectstack#36903)', () => { + it('the designer list names the flow; a flow on a package\'s leg opens it', () => { + expect(AREA_DESIGNER_PAGE_TYPES).toContain('flow'); + expect(areaItemOpensDesignerPage({ packageId: PKG, type: 'flow' })).toBe(true); + }); + + it('not the cross-package leg; not a type outside the list', () => { + expect(areaItemOpensDesignerPage({ packageId: null, type: 'flow' })).toBe(false); + expect(areaItemOpensDesignerPage({ packageId: PKG, type: 'dashboard' })).toBe(false); + }); + + it('the environment scope and a draft review keep the generic page, as they keep a pillar type\'s', () => { + const asks = (q: string) => areaItemAsksGenericPage(new URLSearchParams(q)); + expect(asks('?scope=environment')).toBe(true); + expect(asks('?review=1')).toBe(true); + // Control: a review value other than the one the item page acts on, and no query. + expect(asks('?review=0')).toBe(false); + expect(asks('')).toBe(false); + }); +}); + +describe('areaDesignerItemOf — the copilot reads the open flow off its address (objectstack#36903)', () => { + it('names the flow of a package\'s designer address, its `/history` too', () => { + expect(areaDesignerItemOf(`/studio/${PKG}/metadata/flow/f_1`, PKG)).toEqual({ type: 'flow', name: 'f_1' }); + expect(areaDesignerItemOf(`/studio/${PKG}/metadata/flow/f_1/history`, PKG)).toEqual({ type: 'flow', name: 'f_1' }); + }); + + it('names nothing for a list, a create, another type, the cross-package leg or a pillar', () => { + expect(areaDesignerItemOf(`/studio/${PKG}/metadata/flow`, PKG)).toBeNull(); + expect(areaDesignerItemOf(`/studio/${PKG}/metadata/flow/new`, PKG)).toBeNull(); + expect(areaDesignerItemOf(`/studio/${PKG}/metadata/dashboard/d`, PKG)).toBeNull(); + expect(areaDesignerItemOf('/studio/~all/metadata/flow/f_1', '~all')).toBeNull(); + expect(areaDesignerItemOf(`/studio/${PKG}/data`, PKG)).toBeNull(); + expect(areaDesignerItemOf(`/studio/${PKG}/metadata/flow/f_1`, undefined)).toBeNull(); + // The package-less scope is not a package's leg: orgScopeFlowOf answers for it. + expect(areaDesignerItemOf('/studio/~org/metadata/flow/f_1', '~org')).toBeNull(); + }); + + it('orgScopeFlowOf names the package-less scope\'s flow, and nothing on any other leg', () => { + expect(orgScopeFlowOf('/studio/~org/metadata/flow/a%3Ab', '~org')).toEqual({ type: 'flow', name: 'a:b' }); + expect(orgScopeFlowOf('/studio/~org/metadata/flow/a/history', '~org')).toEqual({ type: 'flow', name: 'a' }); + expect(orgScopeFlowOf('/studio/~org/metadata/flow', '~org')).toBeNull(); + expect(orgScopeFlowOf('/studio/~org/metadata/flow/new', '~org')).toBeNull(); + expect(orgScopeFlowOf('/studio/~org/metadata/object/o', '~org')).toBeNull(); + expect(orgScopeFlowOf(`/studio/${PKG}/metadata/flow/f_1`, PKG)).toBeNull(); + }); +}); + describe('the object designer on its address, and the retired Data pillar (objectstack#36904)', () => { const at = (q = '', packageId: string | null = PKG, type = 'object') => areaItemOpensDesignerPage({ packageId, type }) && !areaItemAsksGenericPage(new URLSearchParams(q)); @@ -215,8 +272,8 @@ describe('the object designer on its address, and the retired Data pillar (objec expect(at('', null)).toBe(false); expect(at('scope=environment')).toBe(false); expect(at('review=1')).toBe(false); - // CONTROL: another type never opens it. - expect(at('', PKG, 'flow')).toBe(false); + // CONTROL: a type outside the list never opens it. + expect(at('', PKG, 'dashboard')).toBe(false); }); it('the old object address lands on its designer, keeping `?action=` and dropping `?view=` and `?nav=`', () => { diff --git a/ui/packages/app-shell/src/views/studio-design/metadataArea.ts b/ui/packages/app-shell/src/views/studio-design/metadataArea.ts index 1d92baa8ed1..9d334012e88 100644 --- a/ui/packages/app-shell/src/views/studio-design/metadataArea.ts +++ b/ui/packages/app-shell/src/views/studio-design/metadataArea.ts @@ -35,12 +35,15 @@ */ import { CATALOG_SCOPE_PARAM, ENVIRONMENT_SCOPE } from '../metadata-admin/catalog-scope.js'; +import { LIST_SOURCE_PARAM } from '../metadata-admin/metadataListState.js'; import { DESIGNER_SURFACE_PARAM, parseSurfaceParam } from '../metadata-admin/nav-selection.js'; import { STUDIO_ALL_PACKAGES_SEGMENT, STUDIO_ITEM_PILLAR, STUDIO_ITEM_REVIEW_PARAM, STUDIO_ITEM_REVIEW_VALUE, + STUDIO_ORG_SCOPE_SEGMENT, + STUDIO_ORG_SCOPE_TYPE, studioItemPillar, studioMetadataAreaAddress, studioMetadataAreaRoot, @@ -50,7 +53,7 @@ import { type StudioPillarKey, } from './studioAddress.js'; import { DESIGNER_SURFACE_NAV_PARAM, DESIGNER_SURFACE_VIEW_PARAM } from './useSurfaceDeepLink.js'; -import { isStudioOrgScope, studioOrgScopePath } from './studioScope.js'; +import { STUDIO_ORG_SCOPE_SOURCE, isStudioOrgScope, studioOrgScopePath } from './studioScope.js'; // objectstack#36895 — the area's segments are Studio address vocabulary, owned // by `studioAddress.ts`; re-exported under their names here. @@ -125,14 +128,15 @@ export function areaItemAsksGenericPage(search: URLSearchParams): boolean { } /** - * objectstack#36905, objectstack#36904 (Studio redesign epic #36890) — the - * types whose item, on a package's leg, opens its designer full-screen in the - * area rather than the generic item page: the permission set's matrix - * (`StudioPermissionSetPage`) and the object designer (`DataPillar` on one - * object). A designer card adds its type here in the PR that deletes the - * type's row from `STUDIO_ITEM_PILLAR`. + * objectstack#36905, objectstack#36904, objectstack#36903 (Studio redesign + * epic #36890) — the types whose item, on a package's leg, opens its designer + * full-screen in the area rather than the generic item page: the permission + * set's matrix (`StudioPermissionSetPage`), the object designer (`DataPillar` + * on one object) and the flow designer (`AutomationsPillar`, fixed on one + * flow). A designer card adds its type here in the PR that deletes the type's + * row from `STUDIO_ITEM_PILLAR`. */ -export const AREA_DESIGNER_PAGE_TYPES: readonly string[] = Object.freeze(['permission', 'object']); +export const AREA_DESIGNER_PAGE_TYPES: readonly string[] = Object.freeze(['permission', 'object', 'flow']); /** * Whether an item of the area opens its full-screen designer page: a @@ -168,6 +172,27 @@ export function areaDesignerItemOf(pathname: string, segment: string | null | un } } +/** + * objectstack#36903 — the flow the package-less scope's area opens in the flow + * designer, read off its address (`/studio/~org/metadata/flow/[/…]`), or + * `null` for any other URL. The scope's area holds its flows alone + * ({@link orgScopeAreaRedirect}) and names no package, so the shared + * {@link areaDesignerItemOf} (a package's leg) never answers for it. + */ +export function orgScopeFlowOf(pathname: string, segment: string | null | undefined): { type: string; name: string } | null { + if (!isStudioOrgScope(segment)) return null; + const root = `${studioMetadataAreaRoot(STUDIO_ORG_SCOPE_SEGMENT)}/`; + if (!pathname.startsWith(root)) return null; + const [rawType, rawName] = pathname.slice(root.length).split('/'); + if (!rawType || !rawName || rawName === 'new') return null; + try { + const type = decodeURIComponent(rawType); + return type === STUDIO_ORG_SCOPE_TYPE ? { type, name: decodeURIComponent(rawName) } : null; + } catch { + return null; + } +} + /** * objectstack#36904 — where the retired Data pillar's address lands * (`/studio//data`, Studio's old home): the object designer of the @@ -256,15 +281,16 @@ const ALL_PACKAGES_VALUE = 'all'; * names no package lists across packages, and no page repairs one in * (#29566); * - the package-less scope (`~org`, as the segment or as `?package=`) names - * no package, so it is never written into `?package=`: it has no area, and - * lands on its flows, the one leg Studio's menu offers it (#36899). + * no package, so it is never written into `?package=` (#36899). + * objectstack#36903 — it has an area of one type, its flows + * ({@link orgScopeAreaRedirect}). * * `rest` is the path below the area's root as the URL spells it (encoded), * `''` at the root; `search` is the URL's query, with or without its `?`. */ export function areaLocationRedirect(segment: string, rest: string, search: string): string | null { const params = new URLSearchParams(search); - if (isStudioOrgScope(segment) || isStudioOrgScope(params.get('package'))) return studioOrgScopePath(); + if (isStudioOrgScope(segment) || isStudioOrgScope(params.get('package'))) return orgScopeAreaRedirect(segment, rest, params); const allLeg = isStudioAllPackagesScope(segment); const at = (leg: string) => studioMetadataAreaAddress(leg, rest, { query: params }); @@ -283,3 +309,47 @@ export function areaLocationRedirect(segment: string, rest: string, search: stri if (pkg === ALL_PACKAGES_VALUE) return allLeg ? null : at(STUDIO_ALL_PACKAGES_SEGMENT); return pkg === segment ? null : at(pkg); } + +/** + * objectstack#36903 — where a URL of the package-less scope's area belongs, + * or `null` when it is already there. The scope's area serves its flows alone + * (`studioScope.ts`): the list, a flow, and a flow's `/history`, each with the + * scope's source filter (`?source=runtime`) and no `?package=`. + * + * - a link on the scope's leg that names a real package (a packaged row the + * author reached by clearing the list's source filter) re-roots onto that + * package's leg, as a package's own leg does (`?package=all`, the + * cross-package leg); + * - a `?package=~org` link from another leg lands on the scope's leg, on the + * same flow; + * - any other path (the directory, another type, a create — the scope + * creates nothing) lands on the scope's list. + */ +function orgScopeAreaRedirect(segment: string, rest: string, params: URLSearchParams): string | null { + const pkg = params.get('package'); + const onScope = isStudioOrgScope(segment); + if (onScope && pkg && !isStudioOrgScope(pkg)) { + return studioMetadataAreaAddress(pkg === ALL_PACKAGES_VALUE ? STUDIO_ALL_PACKAGES_SEGMENT : pkg, rest, { query: params }); + } + const [rawType = '', rawName = '', ...below] = rest.split('/'); + let type: string; + try { + type = decodeURIComponent(rawType); + } catch { + type = ''; + } + const flowPath = + type === STUDIO_ORG_SCOPE_TYPE && rawName !== 'new' && (below.length === 0 || (below.length === 1 && below[0] === 'history')); + if (!flowPath) return studioOrgScopePath(); + const next = new URLSearchParams(params); + next.delete('package'); + next.delete(CATALOG_SCOPE_PARAM); + next.set(LIST_SOURCE_PARAM, STUDIO_ORG_SCOPE_SOURCE); + const settled = + onScope && + !params.has('package') && + !params.has(CATALOG_SCOPE_PARAM) && + params.get(LIST_SOURCE_PARAM) === STUDIO_ORG_SCOPE_SOURCE; + if (settled) return null; + return studioMetadataAreaAddress(STUDIO_ORG_SCOPE_SEGMENT, rest.replace(/\/+$/, ''), { query: next, segmentEncoding: 'verbatim' }); +} diff --git a/ui/packages/app-shell/src/views/studio-design/studioAddress.test.ts b/ui/packages/app-shell/src/views/studio-design/studioAddress.test.ts index 15a62981f0f..ce37c76c10f 100644 --- a/ui/packages/app-shell/src/views/studio-design/studioAddress.test.ts +++ b/ui/packages/app-shell/src/views/studio-design/studioAddress.test.ts @@ -98,9 +98,9 @@ describe("today's addresses, byte for byte", () => { }); it('an item opens its pillar today when the table names one, else its "All metadata" page', () => { - // objectstack#36904 — an object opens its designer on its metadata address. + // objectstack#36904, objectstack#36903 — an object and a flow open their designer on their metadata address. expect(studioItemPath('crm', 'object', 'account')).toBe('/studio/crm/metadata/object/account'); - expect(studioItemPath('crm', 'flow', 'notify')).toBe('/studio/crm/automations?surface=flow%3Anotify'); + expect(studioItemPath('crm', 'flow', 'notify')).toBe('/studio/crm/metadata/flow/notify'); // objectstack#36905 — a permission set opens its metadata address. expect(studioItemPath('crm', 'permission', 'admin')).toBe('/studio/crm/metadata/permission/admin'); expect(studioItemPath('crm', 'dashboard', 'sales')).toBe('/studio/crm/metadata/dashboard/sales'); @@ -140,13 +140,15 @@ describe("today's addresses, byte for byte", () => { }); it('the repointed module builders keep their addresses', () => { - expect(studioOrgScopePath()).toBe('/studio/~org/automations'); - expect(studioOrgScopePath({ type: 'flow', name: 'a:b' })).toBe('/studio/~org/automations?surface=flow%3Aa%3Ab'); + // objectstack#36903 — the package-less scope's flows, on its leg of the area. + expect(studioOrgScopePath()).toBe('/studio/~org/metadata/flow?source=runtime'); + expect(studioOrgScopePath({ type: 'flow', name: 'a:b' })).toBe('/studio/~org/metadata/flow/a%3Ab?source=runtime'); expect(studioPillarItemPath('crm', 'access', { type: 'permission', name: 'p' })).toBe('/studio/crm/access?surface=permission%3Ap'); expect(studioMetadataItemPath('crm', { type: 'object', name: 'account' })).toBe('/studio/crm/metadata/object/account'); + // objectstack#36903 — the flow was the last pillar type: no item opens a pillar. expect( areaItemPillarPath({ packageId: 'crm', type: 'flow', name: 'notify', search: new URLSearchParams() }), - ).toBe('/studio/crm/automations?surface=flow%3Anotify'); + ).toBeNull(); expect( areaItemPillarPath({ packageId: 'crm', type: 'flow', name: 'notify', search: new URLSearchParams('review=1') }), ).toBeNull(); diff --git a/ui/packages/app-shell/src/views/studio-design/studioAddress.ts b/ui/packages/app-shell/src/views/studio-design/studioAddress.ts index 8c7e2110bb2..877ee216867 100644 --- a/ui/packages/app-shell/src/views/studio-design/studioAddress.ts +++ b/ui/packages/app-shell/src/views/studio-design/studioAddress.ts @@ -62,9 +62,19 @@ export const STUDIO_ALL_PACKAGES_SEGMENT = '~all'; /** The reserved `/studio/` value for the package-less scope (`studioScope.ts`). */ export const STUDIO_ORG_SCOPE_SEGMENT = '~org'; -/** The one pillar the package-less scope offers. */ +/** + * The package-less scope's retired pillar segment. objectstack#36903 — the + * scope's flows are listed and opened in its "All metadata" area + * (`studioOrgScopePath`); this segment only redirects there. + */ export const STUDIO_ORG_SCOPE_PILLAR = 'automations'; +/** + * objectstack#36903 — the one type the package-less scope's area serves: its + * flows, the items that belong to no package (`studioScope.ts`). + */ +export const STUDIO_ORG_SCOPE_TYPE = 'flow'; + /** The retired Interfaces pillar's route segment (objectstack#36502). No pillar answers to it any more. */ export const RETIRED_INTERFACES_SEGMENT = 'interfaces'; @@ -112,9 +122,13 @@ export type StudioPillarKey = 'data' | 'automations' | 'access'; * objectstack#36905 — a permission set opens its metadata address, where the * area draws its matrix full-screen; the Access pillar's addresses redirect * (`accessPillarRedirect.ts`). + * + * objectstack#36903 — a flow opens its designer full-screen on its metadata + * address; the old `/automations?surface=flow:` redirects there + * (`automationsPillarRedirect.ts`). */ export const STUDIO_ITEM_PILLAR: Readonly> = Object.freeze({ - flow: 'automations', + // objectstack#36903 — the last pillar type left: every item opens its designer or the generic page. }); /** The pillar an item of `type` opens in today, or `null` when it opens the area's generic item page. */ diff --git a/ui/packages/app-shell/src/views/studio-design/studioAddressTable.ts b/ui/packages/app-shell/src/views/studio-design/studioAddressTable.ts index 747f4241521..63e759cb86c 100644 --- a/ui/packages/app-shell/src/views/studio-design/studioAddressTable.ts +++ b/ui/packages/app-shell/src/views/studio-design/studioAddressTable.ts @@ -86,12 +86,19 @@ export const STUDIO_ADDRESS_FAMILIES: readonly StudioAddressFamily[] = Object.fr builder: 'studioOwdOverviewPath', meaning: "A package's organization-wide default sharing overview (objectstack#36905), optionally on one object. Not a metadata item and not a pillar.", }, - { id: 'org-scope', today: '/studio/~org/automations', builder: 'studioOrgScopePath', meaning: 'The package-less scope: the organization\'s own flows.' }, + { + id: 'org-scope', + today: '/studio/~org/metadata/flow?source=runtime', + builder: 'studioOrgScopePath', + meaning: + "The package-less scope: the organization's own flows, listed in its own leg of the area (objectstack#36903). The old /studio/~org/automations redirects here.", + }, { id: 'org-scope-item', - today: `/studio/~org/automations?${DESIGNER_SURFACE_PARAM}=flow:`, + today: '/studio/~org/metadata/flow/?source=runtime', builder: 'studioOrgScopePath', - meaning: 'A package-less flow. It has no package, so no metadata address of a package; it moves with the flow designer card.', + meaning: + 'A package-less flow, full-screen in the scope\'s leg of the area (objectstack#36903). The old /studio/~org/automations?surface=flow: redirects here.', }, { id: 'area-root', today: '/studio//metadata', builder: 'studioMetadataAreaRoot', meaning: 'The "All metadata" area of a package, or across packages.' }, { id: 'area-type', today: '/studio//metadata/', builder: 'studioMetadataTypePath', meaning: "A type's list in the area." }, @@ -159,6 +166,9 @@ export const STUDIO_ITEM_TYPES: readonly StudioItemTypeRow[] = Object.freeze([ onMetadataAddress: '/studio//metadata/object/', }, { + // objectstack#36903 — switched: a flow opens its designer on its metadata + // address, and this pillar address redirects there + // (`automationsPillarRedirect.ts`), dropping `?view=` and `?nav=`. type: 'flow', pillar: 'automations', surface: 'flow:', diff --git a/ui/packages/app-shell/src/views/studio-design/studioMenuModel.test.ts b/ui/packages/app-shell/src/views/studio-design/studioMenuModel.test.ts index ff8385ee642..59886dd2708 100644 --- a/ui/packages/app-shell/src/views/studio-design/studioMenuModel.test.ts +++ b/ui/packages/app-shell/src/views/studio-design/studioMenuModel.test.ts @@ -55,7 +55,7 @@ describe('the menu groups (objectstack#36899, ADR-0084 amended)', () => { expect(entry('type:view').count).toBeUndefined(); // ADR-0146 D1 — runtime configuration is Setup's. expect(entry('type:datasource').to).toBe('/apps/setup/metadata/datasource'); - expect(entry('orgFlows').to).toBe('/studio/~org/automations'); + expect(entry('orgFlows').to).toBe('/studio/~org/metadata/flow?source=runtime'); expect(entry('diagnostics').to).toBe(`/studio/${PKG}/metadata/_diagnostics`); // objectstack#36905 — the overview's own route. expect(entry('owd').to).toBe(`/studio/${PKG}/owd`); @@ -98,9 +98,9 @@ describe('the current entry (aria-current)', () => { }); it('a pillar page is the type it designs; the OWD overview\'s route is that entry', () => { - // objectstack#36904 — the object designer is an area page: its type. + // objectstack#36904, objectstack#36903 — the object and flow designers are area pages: their type. expect(current(PKG, `/studio/${PKG}/metadata/object/account`)).toBe('type:object'); - expect(current(PKG, `/studio/${PKG}/automations`)).toBe('type:flow'); + expect(current(PKG, `/studio/${PKG}/metadata/flow/notify`)).toBe('type:flow'); // objectstack#36905 — a permission set and the overview have left the Access pillar. expect(current(PKG, `/studio/${PKG}/metadata/permission/admin`)).toBe('type:permission'); expect(current(PKG, `/studio/${PKG}/owd`)).toBe('owd'); @@ -110,7 +110,8 @@ describe('the current entry (aria-current)', () => { }); it('the package-less scope is its flows; the cross-package leg\'s root is the environment catalog', () => { - expect(current('~org', '/studio/~org/automations')).toBe('orgFlows'); + expect(current('~org', '/studio/~org/metadata/flow')).toBe('orgFlows'); + expect(current('~org', '/studio/~org/metadata/flow/f')).toBe('orgFlows'); expect(current('~all', '/studio/~all/metadata')).toBe('environment'); expect(current('~all', '/studio/~all/metadata/position')).toBe('type:position'); }); diff --git a/ui/packages/app-shell/src/views/studio-design/studioMenuModel.ts b/ui/packages/app-shell/src/views/studio-design/studioMenuModel.ts index f2fa165eefe..8cb276d7aca 100644 --- a/ui/packages/app-shell/src/views/studio-design/studioMenuModel.ts +++ b/ui/packages/app-shell/src/views/studio-design/studioMenuModel.ts @@ -65,7 +65,8 @@ export type StudioMenuGroup = (typeof STUDIO_MENU_GROUPS)[number]; /** * The types a designer creates in: listed on every package, holding one or * not. Named, not read off the pillar map: a type keeps its entry when its - * designer leaves its pillar for the metadata address (objectstack#36905). + * designer leaves its pillar for the metadata address (objectstack#36903, the + * flow; objectstack#36905, the permission set). */ export const STUDIO_MENU_DESIGNER_TYPES: readonly string[] = Object.freeze(['object', 'flow', 'permission']); diff --git a/ui/packages/app-shell/src/views/studio-design/studioScope.test.ts b/ui/packages/app-shell/src/views/studio-design/studioScope.test.ts index df05b7f88d8..fa1faf6d791 100644 --- a/ui/packages/app-shell/src/views/studio-design/studioScope.test.ts +++ b/ui/packages/app-shell/src/views/studio-design/studioScope.test.ts @@ -22,7 +22,6 @@ import { studioOrgScopePath, } from './studioScope'; import { isSpecPackageId, sanitizePackageId } from './packages-io'; -import { parseSurfaceParam } from '../metadata-admin/nav-selection'; describe('the reserved segment cannot name a package (objectui#11553)', () => { it('is refused by the spec manifest-id rule and by the predicate this app judges ids by', () => { @@ -45,17 +44,19 @@ describe('the reserved segment cannot name a package (objectui#11553)', () => { }); }); -describe('studioOrgScopePath', () => { - it('lands on the scope’s one pillar', () => { - expect(studioOrgScopePath()).toBe(`/studio/${STUDIO_ORG_SCOPE_SEGMENT}/${STUDIO_ORG_SCOPE_PILLAR}`); +describe('studioOrgScopePath (objectstack#36903: the scope\'s leg of the area)', () => { + it('lands on the scope’s flow list, filtered to the items of no package', () => { + expect(studioOrgScopePath()).toBe(`/studio/${STUDIO_ORG_SCOPE_SEGMENT}/metadata/flow?source=runtime`); + // The retired pillar segment only redirects now. expect(STUDIO_ORG_SCOPE_PILLAR).toBe('automations'); }); - it('carries a flow as the pillar’s own `?surface=` deep link, round-tripping', () => { + it('opens a flow full-screen on its address, round-tripping its name', () => { const path = studioOrgScopePath({ type: 'flow', name: 'qa_urgent_alert_clone' }); - expect(path).toBe('/studio/~org/automations?surface=flow%3Aqa_urgent_alert_clone'); - const value = new URL(path, 'http://x').searchParams.get('surface'); - expect(parseSurfaceParam(value)).toEqual({ type: 'flow', name: 'qa_urgent_alert_clone' }); + expect(path).toBe('/studio/~org/metadata/flow/qa_urgent_alert_clone?source=runtime'); + const url = new URL(path, 'http://x'); + expect(decodeURIComponent(url.pathname.split('/').pop()!)).toBe('qa_urgent_alert_clone'); + expect(url.searchParams.get('source')).toBe('runtime'); }); }); diff --git a/ui/packages/app-shell/src/views/studio-design/studioScope.ts b/ui/packages/app-shell/src/views/studio-design/studioScope.ts index 7d77d114ddc..85639ce967e 100644 --- a/ui/packages/app-shell/src/views/studio-design/studioScope.ts +++ b/ui/packages/app-shell/src/views/studio-design/studioScope.ts @@ -13,8 +13,10 @@ * * This scope is where such a flow is listed and edited. It is the SAME * `StudioDesignSurface` with no package under it, not a second builder: the - * generic `/studio/:packageId/:tab` route serves `/studio/~org/automations`, - * and the surface reads the reserved segment as "no package". + * area's route serves `/studio/~org/metadata/flow?source=runtime` (the list) + * and `/studio/~org/metadata/flow/?source=runtime` (the designer), and + * the surface reads the reserved segment as "no package". objectstack#36903 — + * the old `/studio/~org/automations` redirects there. * * ## The segment cannot name a package * @@ -26,24 +28,42 @@ * * ## What the scope offers, and what it does not * - * Flows only, which is what the ruling on objectui#11553 asks for: the - * Automations pillar, listing every flow that belongs to no package and opening - * it editable, because it is the organization's own. It offers no "New" flow: - * new authoring stays package-first, and this scope exists to reach flows that - * already exist without a package (a clone is the measured producer). + * Flows only, which is what the ruling on objectui#11553 asks for: every flow + * that belongs to no package, listed and opened editable, because it is the + * organization's own. It offers no "New" flow: new authoring stays + * package-first, and this scope exists to reach flows that already exist + * without a package (a clone is the measured producer). + * + * ## Where it lives (objectstack#36903) + * + * In its own leg of the "All metadata" area, as a package's flows are in + * theirs: the list at `/studio/~org/metadata/flow`, a flow full-screen at + * `/studio/~org/metadata/flow/`. Both carry the list's source filter + * `?source=runtime`: an item with no owning package is the list's `runtime` + * source (`classifyProvenance`, the reading {@link isPackageLessItem} gives + * it), so the list shows the scope's flows and the designer's ‹ › walk them + * and nothing else. The old `/studio/~org/automations` address redirects here + * (`automationsPillarRedirect.ts`). */ import { canonicalMetaUrlType } from '@objectstack/spec/shared'; +import { LIST_SOURCE_PARAM } from '../metadata-admin/metadataListState.js'; import { - STUDIO_ORG_SCOPE_PILLAR, STUDIO_ORG_SCOPE_SEGMENT, - studioPillarItemAddress, - studioPillarPath, + STUDIO_ORG_SCOPE_TYPE, + studioMetadataAreaAddress, + studioMetadataItemAddress, } from './studioAddress.js'; // objectstack#36895 — the scope's reserved segment and its one pillar are // Studio address vocabulary, owned by `studioAddress.ts`; re-exported here. -export { STUDIO_ORG_SCOPE_SEGMENT, STUDIO_ORG_SCOPE_PILLAR } from './studioAddress.js'; +export { STUDIO_ORG_SCOPE_SEGMENT, STUDIO_ORG_SCOPE_PILLAR, STUDIO_ORG_SCOPE_TYPE } from './studioAddress.js'; + +/** + * objectstack#36903 — the list source the scope's addresses carry: the items + * with no owning package (`metadataListState.ts`'s `runtime`). + */ +export const STUDIO_ORG_SCOPE_SOURCE = 'runtime'; /** Whether a `/studio/:packageId` route segment names the package-less scope. */ export function isStudioOrgScope(segment: string | null | undefined): boolean { @@ -51,14 +71,20 @@ export function isStudioOrgScope(segment: string | null | undefined): boolean { } /** - * The package-less scope's Automations pillar, optionally opened on one flow - * through the pillar's `?surface=` deep link. + * The package-less scope's flows (objectstack#36903): its list in the area, + * or one flow's full-screen designer, each with the scope's source filter. */ export function studioOrgScopePath(surface?: { type: string; name: string }): string { // The reserved segment is written as it is, as it always was (`~` is outside // every package-id alphabet, and `encodeURIComponent` leaves it unchanged). - if (!surface) return studioPillarPath(STUDIO_ORG_SCOPE_SEGMENT, STUDIO_ORG_SCOPE_PILLAR, { segmentEncoding: 'verbatim' }); - return studioPillarItemAddress(STUDIO_ORG_SCOPE_SEGMENT, STUDIO_ORG_SCOPE_PILLAR, surface, { segmentEncoding: 'verbatim' }); + const query = `${LIST_SOURCE_PARAM}=${STUDIO_ORG_SCOPE_SOURCE}`; + if (!surface) { + return studioMetadataAreaAddress(STUDIO_ORG_SCOPE_SEGMENT, encodeURIComponent(STUDIO_ORG_SCOPE_TYPE), { + query, + segmentEncoding: 'verbatim', + }); + } + return studioMetadataItemAddress(STUDIO_ORG_SCOPE_SEGMENT, surface.type, surface.name, { query, segmentEncoding: 'verbatim' }); } /** diff --git a/ui/packages/components/src/__tests__/clickableNonControlCensus-13461.test.ts b/ui/packages/components/src/__tests__/clickableNonControlCensus-13461.test.ts index c5ac9c0d225..777660cec55 100644 --- a/ui/packages/components/src/__tests__/clickableNonControlCensus-13461.test.ts +++ b/ui/packages/components/src/__tests__/clickableNonControlCensus-13461.test.ts @@ -227,7 +227,6 @@ const NOT_CONTROLS: Array<[file: string, key: string, reason: string]> = [ ['packages/app-shell/src/views/metadata-admin/previews/PageBlockCanvas.tsx', 'div · handleBgClick', CANVAS], // The read-only tray of a node's regions: it keeps a click from starting a card drag. ['packages/app-shell/src/views/metadata-admin/previews/flow-canvas-parts.tsx', 'div · stopPropagation', GUARD], - ['packages/app-shell/src/views/studio-design/AutomationsPillar.tsx', 'div · setRailOpen', SCRIM], ['packages/app-shell/src/views/studio-design/DataPillar.tsx', 'div · clearFieldSelOnEmpty', CANVAS], ['packages/app-shell/src/views/studio-design/DataPillar.tsx', 'div · clearFieldSelOnEmpty', CANVAS], ['packages/app-shell/src/views/studio-design/StudioRightSlot.tsx', 'div · onOverlayDismiss', SCRIM], diff --git a/ui/packages/i18n/src/namespaces/studio/en.ts b/ui/packages/i18n/src/namespaces/studio/en.ts index 38a687d4054..a7511184640 100644 --- a/ui/packages/i18n/src/namespaces/studio/en.ts +++ b/ui/packages/i18n/src/namespaces/studio/en.ts @@ -2672,7 +2672,6 @@ const STUDIO_EN: Record = { 'engine.studio.auto.nodeEnd': 'End', 'engine.studio.auto.savedDraft': 'Automation “{label}” saved as draft', 'engine.studio.auto.defaultOff': 'Off by default · review before enabling', - 'engine.studio.auto.heading': 'Automations', 'engine.studio.auto.deleteFlow': 'Delete flow', 'engine.studio.auto.flowDeleted': 'Deleted flow "{item}"', // objectstack#28567 (ADR-0146 D4) — "New similar" on a flow: the clone door @@ -2753,8 +2752,6 @@ const STUDIO_EN: Record = { // objectstack#36742 — a new flow is published but born switched off: the create toast says so. 'engine.studio.auto.createdOff': 'Created: {name} (switched off; it runs once you switch it on)', 'engine.studio.auto.newTitle': 'New automation', - 'engine.studio.auto.none': 'No automations yet — click “+” above to create one', - 'engine.studio.auto.emptyMain': 'No automations in this package yet.', 'engine.studio.auto.namePlaceholder': 'Name (e.g. Offer Notice)', 'engine.studio.auto.idPlaceholder': 'Identifier (e.g. offer_notice)', // objectui#11861 — the New automation dialog's starting points (`flowPresets.ts`). @@ -2770,14 +2767,6 @@ const STUDIO_EN: Record = { 'engine.studio.auto.emptyLine2': 'and its configuration appears here.', 'engine.studio.auto.designersMissing': 'No metadata designers are registered in this session, so this flow cannot be designed here.', - // objectui#12454 — the rail's groups and legend: a flow's trigger kind, and - // the trailing group of flows that name no object. - 'engine.studio.auto.group.noObject': 'No object', - 'engine.studio.auto.kind.record': 'Record-triggered', - 'engine.studio.auto.kind.scheduled': 'Scheduled', - 'engine.studio.auto.kind.screen': 'Screen', - 'engine.studio.auto.kind.autolaunched': 'Autolaunched', - 'engine.studio.auto.legend': 'Legend', // Access pillar 'engine.studio.access.created': 'Permission set “{label}” created', 'engine.studio.access.title': 'Permission matrix', diff --git a/ui/packages/i18n/src/namespaces/studio/zh.ts b/ui/packages/i18n/src/namespaces/studio/zh.ts index f90f3f686e1..dc375195bce 100644 --- a/ui/packages/i18n/src/namespaces/studio/zh.ts +++ b/ui/packages/i18n/src/namespaces/studio/zh.ts @@ -2396,7 +2396,6 @@ const STUDIO_ZH: Record = { 'engine.studio.auto.nodeEnd': '结束', 'engine.studio.auto.savedDraft': '自动化「{label}」已存为草稿', 'engine.studio.auto.defaultOff': '默认停用 · 审阅后再启用', - 'engine.studio.auto.heading': '自动化', 'engine.studio.auto.deleteFlow': '删除流程', 'engine.studio.auto.flowDeleted': '已删除流程「{item}」', // objectstack#28567 (ADR-0146 D4) — 流程的「新建类似」:克隆门以新的机器名与标签复制, @@ -2461,8 +2460,6 @@ const STUDIO_ZH: Record = { // objectstack#36742 — a new flow is published but born switched off: the create toast says so. 'engine.studio.auto.createdOff': '已创建:{name}(已停用,启用后才会运行)', 'engine.studio.auto.newTitle': '新建自动化', - 'engine.studio.auto.none': '还没有自动化 — 点上方的「+」新建', - 'engine.studio.auto.emptyMain': '这个软件包还没有自动化。', 'engine.studio.auto.namePlaceholder': '名称(如:录用通知)', 'engine.studio.auto.idPlaceholder': '标识符(如:offer_notice)', 'engine.studio.auto.presets': '何时运行', @@ -2476,12 +2473,6 @@ const STUDIO_ZH: Record = { 'engine.studio.auto.emptyLine1': '在画布里点选一个节点,', 'engine.studio.auto.emptyLine2': '它的配置会在这里显示。', 'engine.studio.auto.designersMissing': '本次会话没有注册任何元数据设计器,因此无法在这里设计该流程。', - 'engine.studio.auto.group.noObject': '无对象', - 'engine.studio.auto.kind.record': '记录触发', - 'engine.studio.auto.kind.scheduled': '定时', - 'engine.studio.auto.kind.screen': '交互页面', - 'engine.studio.auto.kind.autolaunched': '自动启动', - 'engine.studio.auto.legend': '图例', // Access pillar 'engine.studio.access.created': '权限集「{label}」已创建', 'engine.studio.access.title': '权限矩阵',