diff --git a/.changeset/37454-studio-package-overview.md b/.changeset/37454-studio-package-overview.md new file mode 100644 index 00000000000..dc01a0f0e07 --- /dev/null +++ b/.changeset/37454-studio-package-overview.md @@ -0,0 +1,20 @@ +--- +'@object-ui/app-shell': patch +'@object-ui/i18n': patch +--- + +feat(studio): a package's 概览 Overview page, with its Info and Pending tabs, and the package's ⋯ menu in its header + +Clause-②: no +Metadata-protocol: none + +Studio has a page for the open package itself, 概览 Overview, at `/studio//overview` (ADR-0084, amended 2026-11-26). It is drawn in the frame an item's page has, a header and a row of tabs: + +- The header shows the package's name, a chip that reads 系统自带 (Built-in, with a lock) on a read-only package or 可写 (Writable), a chip that reads 使用中 (In use) or 已停用 (Disabled), and the description. The chips come from the package list's own answer (`writable`, `enabled`); a row that does not say draws no chip. +- The ⋯ package menu moved here from the top bar's left end. Its six rows are unchanged: edit info, export, duplicate, revert to last publish, adopt loose items, and Manage in Setup…. Disabling, enabling and deleting a package stay in Setup → Packages. +- 信息 Info lists the name, description, source, version and the package's app, read-only. The id, namespace and type are folded under 技术信息 (Technical details). +- 待发布 Pending (`?tab=pending`) is the pending-changes panel drawn in place, with its Publish all. It publishes through the same request, with the same review, notes, refusals and read-only rule as the top bar's Publish, which stays for now. Its tab shows how many drafts wait. + +The Studio menu's first row, above its groups, is 概览 Overview. While drafts wait for a publish it carries their count as a badge, and one click on the badge opens the Pending tab. A search lists it when its name matches. + +`DraftChangesPanel` takes two optional props, `embedded` (draw the panel in place instead of as a sheet) and `reloadKey` (read the drafts again when it changes); without them it behaves as before. New locale keys in the studio catalogue (en, zh): `engine.studio.menu.overview`, `engine.studio.menu.overviewPending` and `engine.studio.overview.*`. diff --git a/ui/packages/app-shell/src/preview/DraftChangesPanel.tsx b/ui/packages/app-shell/src/preview/DraftChangesPanel.tsx index c5c177446e0..5a64aa4c683 100644 --- a/ui/packages/app-shell/src/preview/DraftChangesPanel.tsx +++ b/ui/packages/app-shell/src/preview/DraftChangesPanel.tsx @@ -1497,6 +1497,22 @@ export interface DraftChangesPanelProps { * ({@link customizationEnvironmentText}, objectstack#30119). */ customizationOf?: string; + /** + * objectstack#37454 (ADR-0084, amended 2026-11-26, 概览 Overview) — drawn in + * place, as the Pending tab of Studio's package overview, instead of as a + * sheet: the same list, checks, note and Publish all, with no overlay. + * `open` still says whether it is shown (it loads on each open), and + * `onOpenChange` is never called. Opening clears no toast: a page in place + * covers nothing, and a remount after a publish would clear the publish's + * own answer. + */ + embedded?: boolean; + /** + * Read the drafts again whenever this value changes while open. The sheet + * re-reads at each open; an embedded panel stays open, so its host passes + * what moves when the drafts do (a publish, a new pending count). + */ + reloadKey?: unknown; } export type DraftChangesPosture = 'review' | 'confirm'; @@ -1518,6 +1534,8 @@ export function DraftChangesPanel({ posture = 'review', renderEntryNote, customizationOf, + embedded = false, + reloadKey, }: DraftChangesPanelProps) { const { t, language } = useObjectTranslation(); const [entries, setEntries] = useState(null); @@ -1762,7 +1780,7 @@ export function DraftChangesPanel({ useEffect(() => { if (open) void load(); - }, [open, load]); + }, [open, load, reloadKey]); /** * Clear the toast stack when this panel opens (`add10d8f9`). @@ -1788,7 +1806,9 @@ export function DraftChangesPanel({ * a toast this panel's OWN publish raises is untouched. */ useEffect(() => { - if (open) toast.dismiss(); + if (open && !embedded) toast.dismiss(); + // Keyed on the open transition; `embedded` is fixed for a host's mount. + // eslint-disable-next-line react-hooks/exhaustive-deps }, [open]); const noChangeText = t('preview.changes.detailNone', { @@ -1810,6 +1830,382 @@ export function DraftChangesPanel({ byType.set(entry.type, bucket); } + const titleText = t('preview.changes.title', { defaultValue: 'Pending changes' }); + const descriptionText = t('preview.changes.description', { + defaultValue: 'What publishing will change. New items are added; updates overwrite the live version.', + }); + const headerNotes = ( + <> + {customizationOf ? ( +

+ {savedToCustomizationText(t, customizationOf)} +

+ ) : null} + {/* objectstack#30119 (ADR-0146 D2) — and where they live: this + * environment's database, as items of the pair (`packageId`, the + * pair the host reviews), moved only by `os package export`. */} + {customizationOf && packageId ? ( +

+ {customizationEnvironmentText(t, packageId)} +

+ ) : null} + + ); + const body = ( + <> + {posture === 'confirm' && entries && entries.length > 0 && !error ? ( + // objectui#12517 — what the publish carries, counted off the same + // per-type grouping the headings below read. +

+ {[ + t('preview.changes.summaryItems', { count: entries.length, defaultValue: '{{count}} items' }), + ...[...byType.entries()].map(([type, items]) => summaryTypeSegment(t, type, items.length)), + ].join(' · ')} +

+ ) : null} +
+ {error ? ( +

+ {t('preview.changes.loadFailed', { defaultValue: 'Could not load pending changes:' })}{' '} + {error} +

+ ) : entries === null ? ( +
+ + {t('preview.changes.loading', { defaultValue: 'Loading pending changes…' })} +
+ ) : entries.length === 0 ? ( +

+ {t('preview.changes.empty', { defaultValue: 'Nothing pending — every draft has been published.' })} +

+ ) : ( + [...byType.entries()].map(([type, items]) => ( +
+

+ {summaryTypeSegment(t, type, items.length)} +

+
    + {items.map((entry) => { + const key = entryKey(entry); + const isExpanded = expanded.has(key); + // objectui#11807 — the drill-in found nothing this publish + // changes: not an UPDATE, whatever the name list said. + const isUnchanged = unchanged.has(key); + // objectui#11862 — the row's label leads, in the console + // language, for a NEW row and an UPDATE row alike: the one + // `_drafts` serves, so this list never chooses between a + // published and a draft label. The name follows as + // secondary text, or is the row's text when there is no + // label. + const labelText = resolveI18nLabel(entry.label, language)?.trim() ?? ''; + const note = renderEntryNote?.(entry); + return ( +
  • + + {note ? ( +
    + {note} +
    + ) : null} + {isExpanded && ( +
    + markCompared(key, same)} + backfill={backfillControl} + /> +
    + )} +
  • + ); + })} +
+
+ )) + )} +
+ {checks.length > 0 && !error && ( +
+

+ + {t('preview.changes.flowChecksTitle', { + defaultValue: 'Before you publish — the publish check will report these', + })} +

+
    + {draftChecksByItem(checks).map(({ type, name, items }) => { + const entry = entries?.find((e) => e.type === type && e.name === name); + const heading = resolveI18nLabel(entry?.label, language)?.trim() || name; + return ( +
  • + {/* The flow by the label its row shows, opening its designer + where a host publishes the surface channel (Studio), plain + text elsewhere — the security block's rule, below. */} + {openSurface ? ( + + ) : ( + {heading} + )} +
      + {items.map((c, i) => ( +
    • + {c.message} +
    • + ))} +
    +
  • + ); + })} +
+
+ )} + {problems.length > 0 && !error && ( +
+

+ + {t('preview.changes.securityBlockTitle', { + count: problems.length, + defaultValue: 'Publishing will be refused — {{count}} item(s) need a decision first', + })} +

+
    + {problems.map((p) => ( +
  • + {/* `type/name`, the way the server's own publish refusal names + the item (`object/crmext_visit: …`) — and, unlike a bare + name, text that cannot collide with the same draft's row in + the list above. + + Clickable ONLY where a host publishes the surface channel, + i.e. inside Studio. This sheet is shared with the Home / + draft-preview bar, where the designer is not a reachable + destination at all: there `openSurface` is null and the + name stays the plain prose it has always been, because a + link that goes nowhere is worse than the sentence below + telling you where to go. */} + {openSurface ? ( + + ) : ( + + {p.type}/{p.name} + + )}{' '} + — {securityProblemText(t, p)} +
  • + ))} +
+

+ {t('preview.changes.securityBlockWhere', { + defaultValue: 'Fix it on the object under Settings → Who can see which records, then publish again.', + })} +

+
+ )} + {onPublish && (entries?.length ?? 0) > 0 && !error && ( +
+

+ {/* objectui#11591 — the note states what THIS scope's Publish + does. Only a package publishes as one atomic batch (`POST + /packages/:id/publish-drafts`); with no package there is no + batch door, so the caller promotes each draft by itself and a + draft that fails stays pending while the others go live. */} + {packageId + ? t('preview.changes.confirmNote', { + count: entries!.length, + defaultValue: + 'Publishing releases all {{count}} pending drafts of this package together: all of them go live, or none do.', + }) + : t('preview.changes.confirmNoteSeparate', { + count: entries!.length, + defaultValue: + 'Publishing releases the {{count}} pending drafts one at a time: a draft that fails stays pending while the others go live.', + })} +

+ {packageId && ( + // ADR-0146 D1 — the change note. Offered only where the footer + // publishes one package as a batch: only that door carries a + // `message` to every history row it writes. +
+ +