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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .changeset/34796-studio-label-first-panels.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
'@object-ui/app-shell': patch
'@object-ui/i18n': patch
'@object-ui/console': patch
---

feat(studio): flow node and list-view panels lead with labels, node delete moves to the header menu, navigation kinds read in words

Clause-②: no
Metadata-protocol: none

Studio's Automations and Interfaces panels name things the way the author named them and keep machine names out of the way:

- **Flow node panel.** The first field is the node's Label. The node id moves into a "Developer info" section that starts collapsed. "Remove node" moves from the full-width footer button into the header's "···" menu; in Studio that menu sits in the automation panel's title bar. The removal itself is unchanged: neither the menu item nor the canvas Delete key asks to confirm, and both still refuse while a boundary event or an expression names the node.
- **Objects by label.** In the node panel, the sentences that name an object ("Targets the … record that started this flow", "Fields of …") use the object's label. The object picker shows the label and keeps the machine name on its hover title.
- **"Formula", not "CEL expression".** The node panel's value toggle, its placeholders and the blank-formula notice and the zh help rows of the trigger, Decision, record, loop, map, HTTP, action, screen, subflow and notify nodes say 公式 / "formula". The Update Records filter help no longer names `recordId`. The zh panel also gains the Update Records "update every matching record" row, which used to show in English.
- **New automation dialog.** The first field is "Automation name" (自动化名称), matching the dialog title and the Automations list.
- **List-view panel.** No `object.view` machine name under the title. The not-yet-created notice is one sentence: "Changes save as a draft first." Column rows show the field label, with the field name on hover. The Setup designers' column rows are unchanged.
- **Navigation edit mode.** Each entry's kind badge reads the kind the navigation list shows (对象 / 视图 / 仪表盘 / 页面 …). An object entry that opens a named view, such as a kanban, reads 视图. The Setup designer keeps the raw type.

`@object-ui/i18n`: two new `studio` namespace keys (`engine.inspector.flowNode.moreActions`, `engine.inspector.flowNode.developerInfo`). Some existing `studio` values are reworded in en and zh.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
* node inspector are real.
*/

// Paid at collection, not inside a clocked case (check:test-source-alias).
import '@objectstack/lint';
import '@testing-library/jest-dom/vitest';
import * as React from 'react';
import { describe, it, expect, vi, afterEach, beforeEach } from 'vitest';
Expand Down Expand Up @@ -177,8 +179,8 @@ async function openAndSelect(type: string, name: string, host: MetadataAreaHost

/** The node inspector's reason, as its accessible description resolves. */
async function nodeInspectorReason(): Promise<string | null> {
// The inspector is mounted once its Remove-node control is.
await screen.findByRole('button', { name: t('engine.inspector.flowNode.remove', 'en-US') });
// The inspector is mounted once its "···" menu (it holds Remove node) is.
await screen.findByRole('button', { name: t('engine.inspector.flowNode.moreActions', 'en-US') });
const group = document.querySelector<HTMLElement>('[data-testid="flow-node-readonly-reason"]');
if (!group) return null;
const id = group.getAttribute('aria-describedby');
Expand All @@ -189,7 +191,7 @@ describe('the metadata editor page names the read-only cause to the scoped inspe
it('a writable flow: the node inspector is editable and carries no reason', async () => {
await openAndSelect('flow', 'close_case');
expect(await nodeInspectorReason()).toBeNull();
expect(screen.getByRole('button', { name: t('engine.inspector.flowNode.remove', 'en-US') })).toBeEnabled();
expect(screen.getByRole('button', { name: t('engine.inspector.flowNode.moreActions', 'en-US') })).toBeEnabled();
});

it("a read-only package's area: the package is the reason, as Studio's Automations pillar says it", async () => {
Expand Down
36 changes: 20 additions & 16 deletions ui/packages/app-shell/src/views/metadata-admin/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ const FLOW_FIELD_ZH: Record<string, Record<string, FlowFieldZh>> = {
objectName: { label: '对象', help: '其记录变更会启动此流程的对象。' },
condition: {
label: '进入条件',
help: 'CEL 表达式 —— 仅当其为 true 时流程才运行(相对时间扫描时对每条匹配记录做门控)。留空则每次事件都运行。',
help: '公式 —— 仅当其为 true 时流程才运行(相对时间扫描时对每条匹配记录做门控)。留空则每次事件都运行。',
},
'schedule.expression': {
label: 'Cron 表达式',
Expand Down Expand Up @@ -350,18 +350,18 @@ const FLOW_FIELD_ZH: Record<string, Record<string, FlowFieldZh>> = {
decision: {
conditions: {
label: '分支',
help: '每个分支包含标签、CEL 表达式和目标节点。表达式为 “true” 的分支即默认 / else 路径。选择目标会接线该分支的出边(创建或更新),清空则断开该边。',
help: '每个分支包含标签、公式和目标节点。公式为 “true” 的分支即默认 / else 路径。选择目标会接线该分支的出边(创建或更新),清空则断开该边。',
cols: {
label: {
label: '标签',
help: '分支的标签;成立的分支沿同名标签的出边继续(都不成立时走标为默认、或标签为 default 的出边)。',
placeholder: '如 有商机',
},
expression: { label: '表达式', help: '决定是否走这个分支的 CEL 条件(不加 {{ }})。' },
expression: { label: '公式', help: '决定是否走这个分支的公式(不加 {{ }})。' },
target: { label: '目标节点', placeholder: '下一个节点' },
},
},
condition: { label: '单一条件', help: '旧的单分支条件(CEL)。建议使用上方“分支”;每条边的条件也可写在出边上。' },
condition: { label: '单一条件', help: '旧的单分支条件(公式)。建议使用上方“分支”;每条边的条件也可写在出边上。' },
// objectstack#34818 — was English in the zh panel.
mode: {
label: '分支方式',
Expand All @@ -370,19 +370,19 @@ const FLOW_FIELD_ZH: Record<string, Record<string, FlowFieldZh>> = {
},
},
assignment: {
assignments: { label: '赋值', help: '设置变量:每个键为一个变量,值为表达式或字面量。' },
assignments: { label: '赋值', help: '设置变量:每个键为一个变量,值为公式或字面量。' },
},
loop: {
collection: {
label: '集合',
help: '要遍历的列表:求值为列表的 CEL 表达式(如 leadList),或以 JSON 数组写出的各项。没有循环体区域的循环改为读取列表变量的裸名称。',
help: '要遍历的列表:求值为列表的公式(如 leadList),或以 JSON 数组写出的各项。没有循环体区域的循环改为读取列表变量的裸名称。',
},
iteratorVariable: { label: '当前项变量', help: '存放当前项的循环变量。' },
indexVariable: { label: '索引变量', help: '存放当前索引的可选循环变量。' },
maxIterations: { label: '最大迭代次数' },
},
map: {
collection: { label: '集合', help: '要逐项处理的列表:求值为列表的 CEL 表达式(如 items),或以 JSON 数组写出的各项。' },
collection: { label: '集合', help: '要逐项处理的列表:求值为列表的公式(如 items),或以 JSON 数组写出的各项。' },
flowName: { label: '每项子流程', help: '为每一项运行的子流程 —— 它可以暂停(如审批)。' },
iteratorVariable: { label: '当前项变量' },
itemObject: { label: '项对象', help: '当项为记录时,它们所属的对象(将每项暴露为子流程的记录)。' },
Expand All @@ -395,24 +395,28 @@ const FLOW_FIELD_ZH: Record<string, Record<string, FlowFieldZh>> = {
},
update_record: {
objectName: { label: '对象' },
filter: { label: '筛选', help: '标识待更新记录的字段 / 值对。每个值是字面量,或 CEL 表达式(如 id → 以表达式写的 recordId)。' },
filter: { label: '筛选', help: '标识待更新记录的字段 / 值对。每个值是字面量,或公式(如 id 一栏用公式指向触发记录)。' },
fields: { label: '字段值', help: '要写入的字段值。' },
multi: {
label: '更新所有匹配的记录',
help: '声明批量更新:更新筛选匹配到的每一条记录。关闭(默认)时,筛选必须按 id 指向一条记录 —— 没有开启这一项的按条件更新会被数据引擎拒绝。',
},
},
delete_record: {
objectName: { label: '对象' },
filter: { label: '筛选', help: '标识待删除记录的字段 / 值对。每个值是字面量,或 CEL 表达式。' },
filter: { label: '筛选', help: '标识待删除记录的字段 / 值对。每个值是字面量,或公式。' },
},
get_record: {
objectName: { label: '对象' },
filter: { label: '筛选', help: '待匹配的字段 / 值对(如 status → active)。每个值是字面量,或 CEL 表达式。像 {"$ne": null} 这样的运算符值会被保留。' },
filter: { label: '筛选', help: '待匹配的字段 / 值对(如 status → active)。每个值是字面量,或公式。像 {"$ne": null} 这样的运算符值会被保留。' },
limit: { label: '数量上限' },
outputVariable: { label: '输出变量' },
},
http: {
method: { label: '方法' },
url: { label: 'URL', help: '请求 URL。会渲染 {{ }} 占位。' },
headers: { label: '请求头', help: '请求头(如 Authorization、Content-Type)。每个值都会渲染 {{ }} 占位。' },
body: { label: '请求体', help: '请求负载:按原样发送的 JSON,或求值为负载的 CEL 表达式。' },
body: { label: '请求体', help: '请求负载:按原样发送的 JSON,或求值为负载的公式。' },
// objectui#11968 — no `outputVariable` overlay: the `http` contract declares
// no such key, so neither form offers a field for it.
durable: { label: '持久化(异步)', help: '通过持久化队列即发即忘(异步投递)。' },
Expand All @@ -426,7 +430,7 @@ const FLOW_FIELD_ZH: Record<string, Record<string, FlowFieldZh>> = {
opts: { invoke_function: '调用函数', email: '邮件', slack: 'Slack' },
},
function: { label: '函数', help: '要调用的已注册函数 —— 经 defineStack({ functions }) 声明。优先于动作类型。' },
inputs: { label: '输入', help: '传给函数的值。每个值是字面量,或按流程变量求值的 CEL 表达式。' },
inputs: { label: '输入', help: '传给函数的值。每个值是字面量,或按流程变量求值的公式。' },
outputVariable: { label: '输出变量', help: '绑定函数返回值的流程变量,供后续步骤使用。' },
template: { label: '模板', help: '消息模板 id。' },
recipients: { label: '收件人', help: '每行一个收件人(用户 id、字段引用或地址)。' },
Expand Down Expand Up @@ -458,7 +462,7 @@ const FLOW_FIELD_ZH: Record<string, Record<string, FlowFieldZh>> = {
objectName: { label: '对象表单', help: '渲染该对象完整的新建 / 编辑表单(含主从),而非扁平字段列表。' },
idVariable: { label: '保存记录变量', help: '仅对象表单:绑定到已保存记录 id 的变量,供后续步骤使用。' },
mode: { label: '表单模式', help: '仅对象表单。', opts: { create: '新建', edit: '编辑' } },
defaults: { label: '表单默认值', help: '仅对象表单:预填值。每个值是字面量,或 CEL 表达式(如 account → 以表达式写的 account_id)。' },
defaults: { label: '表单默认值', help: '仅对象表单:预填值。每个值是字面量,或公式(如 account → 以公式写的 account_id)。' },
},
approval: {
approvers: {
Expand Down Expand Up @@ -538,7 +542,7 @@ const FLOW_FIELD_ZH: Record<string, Record<string, FlowFieldZh>> = {
},
subflow: {
flowName: { label: '流程' },
input: { label: '输入映射', help: '传给子流程输入变量的值。每个值是字面量,或在本流程中求值的 CEL 表达式。' },
input: { label: '输入映射', help: '传给子流程输入变量的值。每个值是字面量,或在本流程中求值的公式。' },
outputVariable: { label: '输出变量' },
timeoutMs: { label: '超时(毫秒)' },
},
Expand Down Expand Up @@ -567,7 +571,7 @@ const FLOW_FIELD_ZH: Record<string, Record<string, FlowFieldZh>> = {
topic: { label: '主题', help: '事件主题(默认 "notify")。' },
severity: { label: '级别', help: 'info | warning | critical' },
sourceObject: { label: '来源对象', help: '通知所关联记录的对象名。' },
sourceId: { label: '来源记录', help: '通知链接到的记录 id(需配合来源对象):以文本写出的 id,或 CEL 表达式(如 record.id)。' },
sourceId: { label: '来源记录', help: '通知链接到的记录 id(需配合来源对象):以文本写出的 id,或公式(如 record.id)。' },
actorId: { label: '触发用户', help: '引发该事件的用户 id。' },
// objectui#11968 — keyed `actionUrl`, the key the contract declares and both
// forms now write; the `url` spelling is the converted alias.
Expand All @@ -582,7 +586,7 @@ const FLOW_FIELD_ZH: Record<string, Record<string, FlowFieldZh>> = {
},
templateData: {
label: '模板数据',
help: '填入模板 {{变量}} 占位的值:每个值是字面量,或每次运行时求值的 CEL 表达式。只能与邮件模板一起使用。',
help: '填入模板 {{变量}} 占位的值:每个值是字面量,或每次运行时求值的公式。只能与邮件模板一起使用。',
},
},
// The engine-published `save_notice` descriptor's one field.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
* second case, a map with no value toggle.
*/

// Paid at collection, not inside a clocked case (check:test-source-alias).
import '@objectstack/lint';
import { describe, it, expect, afterEach, vi } from 'vitest';
import { render, screen, cleanup } from '@testing-library/react';

Expand All @@ -27,7 +29,7 @@ import type { FlowConfigField } from './flow-node-config';

afterEach(cleanup);

const TOGGLE = 'Write as a CEL expression';
const TOGGLE = 'Write as a formula';
const REMOVE = /remove/i;
const LONG_FIELD = 'customer_satisfaction_score';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
* field path read against the spec's expression ledger.
*/

// Paid at collection, not inside a clocked case (check:test-source-alias).
import '@objectstack/lint';
import { describe, it, expect, afterEach, vi } from 'vitest';
import { render, screen, cleanup, fireEvent } from '@testing-library/react';
import {
Expand All @@ -20,7 +22,7 @@ import { t } from '../i18n';

afterEach(cleanup);

const TOGGLE = 'Write as a CEL expression';
const TOGGLE = 'Write as a formula';

const ASSIGNMENTS: FlowConfigField = {
id: 'assignments',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { isUnsetFieldValue, unsetNoticeApplies } from './flow-node-config.js';
import type { FlowConfigField, InactiveRetainedKind } from './flow-node-config.js';
import { t, tFormat } from '../i18n.js';
import { useObjectFields } from '../previews/useObjectFields.js';
import { useObjectDisplayName } from './ObjectPicker.js';
import { WIDGETS, OBJECTUI_SECRET_MASK } from '../widgets.js';
import {
InspectorNumberField,
Expand Down Expand Up @@ -124,6 +125,8 @@ function FieldValueMapField({
}: FlowKeyValueFieldProps & { objectName: string; byLabel: boolean; locale?: string }) {
// The same field source the reference picker's `object-field` kind reads.
const { fields } = useObjectFields(objectName || undefined);
// The hint names the object by its label, not its machine name.
const objectLabel = useObjectDisplayName(objectName || undefined);
const keyOptions = React.useMemo(
() =>
fields.map((f) => ({
Expand All @@ -141,7 +144,7 @@ function FieldValueMapField({
keysByLabel={byLabel}
keyHint={
objectName
? tFormat('engine.inspector.reference.fieldsOf', locale, { object: objectName })
? tFormat('engine.inspector.reference.fieldsOf', locale, { object: objectLabel })
: t('engine.inspector.fieldMap.chooseObject', locale)
}
/>
Expand Down Expand Up @@ -214,10 +217,12 @@ function TriggeringRecordTarget({
disabled?: boolean;
locale?: string;
}) {
// The sentence names the object by its label, not its machine name.
const objectLabel = useObjectDisplayName(objectName);
if (isTriggeringRecordFilter(value)) {
return (
<p className="text-[11px] leading-snug text-muted-foreground" data-testid="flow-triggering-record-target">
{tFormat('engine.inspector.flowNode.triggeringRecord.active', locale, { object: objectName })}
{tFormat('engine.inspector.flowNode.triggeringRecord.active', locale, { object: objectLabel })}
</p>
);
}
Expand All @@ -235,7 +240,7 @@ function TriggeringRecordTarget({
{t('engine.inspector.flowNode.triggeringRecord.use', locale)}
</Button>
<p className="text-[11px] leading-snug text-muted-foreground">
{tFormat('engine.inspector.flowNode.triggeringRecord.hint', locale, { object: objectName })}
{tFormat('engine.inspector.flowNode.triggeringRecord.hint', locale, { object: objectLabel })}
</p>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
* declares none).
*/

// Paid at collection, not inside a clocked case (check:test-source-alias).
import '@objectstack/lint';
import * as React from 'react';
import { describe, it, expect, vi, afterEach } from 'vitest';
import { render, screen, cleanup, fireEvent, waitFor, within } from '@testing-library/react';
Expand All @@ -36,7 +38,7 @@ afterEach(() => {
vi.unstubAllGlobals();
});

const TOGGLE = 'Write as a CEL expression';
const TOGGLE = 'Write as a formula';

const SLACK_POST_MESSAGE = {
type: 'object',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
* `FlowNodeInspector.updateRecordTarget-27834.test.tsx`.
*/

// Paid at collection, not inside a clocked case (check:test-source-alias).
import '@objectstack/lint';
import * as React from 'react';
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
import { render, screen, cleanup, fireEvent, within } from '@testing-library/react';
Expand Down Expand Up @@ -146,15 +148,15 @@ describe('objectui#11788 — record field-value keys are picked from the target
fireEvent.click(within(fields).getByRole('button', { name: 'Add entry' }));
const key = within(fields).getByPlaceholderText('Key');
expect(keySuggestions(key)).toEqual(['status', 'owner']);
expect(within(fields).getByText('Fields of ticket.')).toBeInTheDocument();
expect(within(fields).getByText('Fields of “ticket”.')).toBeInTheDocument();
fireEvent.change(key, { target: { value: 'status' } });
fireEvent.blur(key);
const val = within(fields).getByPlaceholderText('Value');
fireEvent.change(val, { target: { value: 'done' } });
fireEvent.blur(val);
expect(config().fields).toEqual({ status: 'done' });
// The value cell keeps the slot's own dialect: the text / CEL toggle.
expect(within(fields).getByRole('button', { name: 'Write as a CEL expression' })).toBeInTheDocument();
expect(within(fields).getByRole('button', { name: 'Write as a formula' })).toBeInTheDocument();
});
}

Expand Down
Loading
Loading