Skip to content

Commit d770b15

Browse files
feat(studio): the organization-flows publish toast names the flows that went live (#27882)
domain:ui#3 · os-bill · session_01Utp6CaJoinvGQSbHeDaWBe <!-- claude-projects-attribution: {"github_login":"os-bill"} --> _Requested by **Bill** · [project thread](https://claude.ai/code/project/chan_016iMXWSZDzqWRWvWzdNo8wg?thread=cmsg_016iMXWSZDzqWRWvWzdNo8wg4i9JiKjEjwtuVzd4gKy9hB)_ ## 维护者速读 - 改了什么:Studio「组织流程」范围(不属于任何软件包的流程)发布草稿后,toast 不再写「Published 1 package-less flow draft」:一个流程时写 Published flow "流程标签",多个时写 Published N flows,并在下方列出名字。 - 为什么改:HotCRM 浏览器走查(#27356 第 18 行)指出 toast 不说是哪个流程,"package-less" 也不是业务用语。 - 风险与回滚:只改提示文字,不改发布逻辑;回滚就是 revert 本 PR。 - 先看:`StudioDesignSurface.tsx` 里组织范围发布成功的那段 toast,以及 studio 命名空间 en/zh 的两条文案。 - 两分钟验证:`pnpm --dir ui exec vitest run packages/app-shell/src/views/studio-design/StudioDesignSurface.publishCount-11807.test.tsx`,应见 8 passed。 - 需要你做的:无,席位落地。 Part of #27356 (row 18, hotcrm#2320 Studio S7: the publish toast names the flow) Clause-②: no Metadata-protocol: none ## What changes Row 18 has three parts; this PR is the Studio one. - **The toast names the flow.** On Studio's Organization flows scope, a publish that put every pending flow draft live toasted `Published {count} package-less flow draft(s)`. Now one flow reads `Published flow "{label}"` (the draft's served label resolved for the locale, else its machine name) and several read `Published {count} flows` with the names, comma-separated, as the toast's description. A refusal, a partial failure and the nothing-pending answer are unchanged. - **i18n.** The values of `engine.studio.publishedAllFlows` and `engine.studio.publishedAllFlowsOne` change in en and zh (the studio namespace's two packs; `check:i18n-drift` reads the zh row as followed). `publishedAllFlowsOne` now takes `{label}` instead of `{count}`. No key added, renamed or removed. The other two parts are not Studio's: - **The clone notice** is server prose: `FLOW_CLONE_NOTICE` in `packages/runtime/src/flow-clone.ts`, returned by the flow clone door and shown verbatim on Setup › Packaged automation. Shortening it is a server change, reported to the seat as a card. - **The "switch the original off" button** already exists: after a clone, Packaged automation offers `Switch "{label}" off` (`packagedAutomation.cloneSwitchSourceOff`). ## Tests - `StudioDesignSurface.publishCount-11807.test.tsx` gains two cases on the real surface and client, with the server stubbed at `fetch`: one package-less draft with a label toasts the label; two drafts (one labelled, one not) toast the count row with `QA alert (copy), qa_digest_clone` as the description. The existing two-draft case still pins the count row. <details><summary>Readings (head 69fa4a7, branch rebuilt from origin/main 7f80732 after #27832 merged)</summary> - `StudioDesignSurface.publishCount-11807`, `.packageLessFlows-11553`, `.homeLoop-12513` and the whole `packages/i18n/`: 93 files, 1408 passed / 13 skipped. - `pnpm --filter @object-ui/app-shell --filter @object-ui/i18n run type-check`: both Done, exit 0. - Ablation through `scripts/ablation-replace.mjs` (anchor 1 to 0): the names read `d.name` only, never the label: 2 failed / 6 passed (both new cases red); restored blob = HEAD blob `45453952912c`, `git diff HEAD` empty. vitest resolves `@object-ui/*` to source, so no rebuild leg. - `pnpm --dir ui run check:i18n-drift`: 0 pack values changed; the designer table's 2 changed en values both followed by zh. </details> ## Acceptance notes - The description lists every name the publish read, with no cap. A long list was not measured. - Row 18's other half, the clone notice (`FLOW_CLONE_NOTICE` in `packages/runtime/src/flow-clone.ts`), is a server-lane change: filed by the seat as #27886, not done here. ## Verification On head `69fa4a77`: `dispatch-gates --commands` derived 34 families for this diff; all 34 were run locally, each exit 0, and `--ran` reconciled 34 run, 0 NOT-MEASURED, 0 UNRUN (`node scripts/check-sdui-manifest.mjs` among them). `check:new-line-citations`: 0 new. CI check-runs were in progress when this was opened. --- _Generated by [Claude Code](https://claude.ai/code/session_01Utp6CZrsFMFmWFsxTaq2Bu)_ Co-authored-by: Claude <noreply@anthropic.com>
1 parent ff784ef commit d770b15

5 files changed

Lines changed: 46 additions & 12 deletions

File tree

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
'@object-ui/app-shell': patch
3+
'@object-ui/i18n': patch
4+
---
5+
6+
feat(studio): publishing the organization's own flows names them in the toast
7+
8+
Clause-②: no
9+
Metadata-protocol: none
10+
11+
On Studio's Organization flows scope (flows in no package), publishing drafts used to toast "Published 1 package-less flow draft", which said neither which flow went live nor in plain words. One published flow now reads `Published flow "Lead follow-up"`, by its label (its machine name when it has none). Several read `Published 3 flows` with their names listed under it. A refusal and the nothing-pending answer are unchanged.

‎ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.publishCount-11807.test.tsx‎

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ const published = (...names: string[]) =>
114114
names.map((name, i) => ({ type: 'object', name, version: `sha256:${i}` }));
115115

116116
let batchBody: unknown;
117-
let orgDrafts: Array<{ type: string; name: string; packageId: null }> = [];
117+
let orgDrafts: Array<{ type: string; name: string; packageId: null; label?: string }> = [];
118118
/** Every publish request the surface sent: the batch door and the by-reference one. */
119119
const posts: string[] = [];
120120

@@ -241,6 +241,26 @@ describe('the package-less publish names its count, and its zero is no success (
241241
expect(toasts().success).toEqual([tFormat('engine.studio.publishedAllFlows', 'en', { count: 2 })]);
242242
});
243243

244+
// #27356 row 18 (hotcrm#2320 Studio S7): the toast names what went live.
245+
it('one package-less flow draft: the toast names it by its label', async () => {
246+
orgDrafts = [{ type: 'flow', name: 'qa_alert_clone', packageId: null, label: 'QA alert (copy)' }];
247+
await publishAt('/studio/~org/automations', 1);
248+
await waitFor(() => expect(toast.success).toHaveBeenCalled());
249+
expect(toasts().success).toEqual([tFormat('engine.studio.publishedAllFlowsOne', 'en', { label: 'QA alert (copy)' })]);
250+
expect(toasts().success[0]).toContain('QA alert (copy)');
251+
});
252+
253+
it('several: the count row, the flows named in the description (label, else name)', async () => {
254+
orgDrafts = [
255+
{ type: 'flow', name: 'qa_alert_clone', packageId: null, label: 'QA alert (copy)' },
256+
{ type: 'flow', name: 'qa_digest_clone', packageId: null },
257+
];
258+
await publishAt('/studio/~org/automations', 2);
259+
await waitFor(() => expect(toast.success).toHaveBeenCalled());
260+
const description = (vi.mocked(toast.success).mock.calls[0][1] as { description?: string } | undefined)?.description;
261+
expect(description).toBe('QA alert (copy), qa_digest_clone');
262+
});
263+
244264
it('none pending by the time of the read: no success claimed', async () => {
245265
orgDrafts = [];
246266
await publishAt('/studio/~org/automations', 0);

‎ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.tsx‎

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1765,14 +1765,17 @@ export function StudioDesignSurface({ aiSlot }: StudioDesignSurfaceProps): React
17651765
} else {
17661766
// objectui#11807 — how many went live: every draft read above, as
17671767
// none failed.
1768+
// The toast names what went live: one flow in its title, several
1769+
// by count with their names in the description.
17681770
setPublishRefusals(NO_PUBLISH_REFUSALS);
1769-
toast.success(
1770-
tFormat(
1771-
pending.length === 1 ? 'engine.studio.publishedAllFlowsOne' : 'engine.studio.publishedAllFlows',
1772-
locale,
1773-
{ count: pending.length },
1774-
),
1775-
);
1771+
const names = pending.map((d) => resolveI18nLabel(d.label, locale)?.trim() || d.name);
1772+
if (names.length === 1) {
1773+
toast.success(tFormat('engine.studio.publishedAllFlowsOne', locale, { label: names[0] }));
1774+
} else {
1775+
toast.success(tFormat('engine.studio.publishedAllFlows', locale, { count: names.length }), {
1776+
description: names.join(', '),
1777+
});
1778+
}
17761779
setChangesOpen(false);
17771780
}
17781781
setPublishNonce((n) => n + 1);

‎ui/packages/i18n/src/namespaces/studio/en.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3141,8 +3141,8 @@ const STUDIO_EN: Record<string, string> = {
31413141
'engine.studio.org.none': 'No flows outside a package yet. Clone a packaged flow in Setup › Packaged automation to edit the copy here.',
31423142
// objectui#12513 — the empty block's way to that Setup list: a link, since this scope creates nothing.
31433143
'engine.studio.org.openSetup': 'Open in Setup',
3144-
'engine.studio.publishedAllFlows': 'Published {count} package-less flow drafts',
3145-
'engine.studio.publishedAllFlowsOne': 'Published {count} package-less flow draft',
3144+
'engine.studio.publishedAllFlows': 'Published {count} flows',
3145+
'engine.studio.publishedAllFlowsOne': 'Published flow "{label}"',
31463146
'engine.studio.designer.search': 'Search…',
31473147
'engine.studio.designer.select': 'Select…',
31483148
'engine.studio.designer.pickDate': 'Pick a date…',

‎ui/packages/i18n/src/namespaces/studio/zh.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2789,8 +2789,8 @@ const STUDIO_ZH: Record<string, string> = {
27892789
'engine.studio.org.description': '本组织自有、不属于任何软件包的流程,例如软件包流程的克隆副本。可直接编辑。',
27902790
'engine.studio.org.none': '还没有不属于软件包的流程。在 设置 › 打包自动化 中克隆一个软件包流程,即可在这里编辑副本。',
27912791
'engine.studio.org.openSetup': '在设置中打开',
2792-
'engine.studio.publishedAllFlows': '已发布 {count} 个不属于软件包的流程草稿',
2793-
'engine.studio.publishedAllFlowsOne': '已发布 {count} 个不属于软件包的流程草稿',
2792+
'engine.studio.publishedAllFlows': '已发布 {count} 个流程',
2793+
'engine.studio.publishedAllFlowsOne': '已发布流程「{label}」',
27942794
'engine.studio.designer.search': '搜索…',
27952795
'engine.studio.designer.select': '请选择…',
27962796
'engine.studio.designer.pickDate': '选择日期…',

0 commit comments

Comments
 (0)