diff --git a/packages/plugins/@nocobase/plugin-workflow/src/client/CanvasContent.tsx b/packages/plugins/@nocobase/plugin-workflow/src/client/CanvasContent.tsx index 22a15f044..68b9850a6 100644 --- a/packages/plugins/@nocobase/plugin-workflow/src/client/CanvasContent.tsx +++ b/packages/plugins/@nocobase/plugin-workflow/src/client/CanvasContent.tsx @@ -1,16 +1,20 @@ -import { cx } from '@nocobase/client'; -import { Tag } from 'antd'; +import { Alert } from 'antd'; import React from 'react'; import { Branch } from './Branch'; import { lang } from './locale'; import useStyles from './style'; import { TriggerConfig } from './triggers'; +import { useFlowContext } from './FlowContext'; export function CanvasContent({ entry }) { const { styles } = useStyles(); + const { workflow } = useFlowContext(); return (
+ {workflow?.executed ? ( + + ) : null}
diff --git a/packages/plugins/@nocobase/plugin-workflow/src/client/WorkflowLink.tsx b/packages/plugins/@nocobase/plugin-workflow/src/client/WorkflowLink.tsx index 2610a7dc0..9da303bd5 100644 --- a/packages/plugins/@nocobase/plugin-workflow/src/client/WorkflowLink.tsx +++ b/packages/plugins/@nocobase/plugin-workflow/src/client/WorkflowLink.tsx @@ -10,7 +10,7 @@ export const WorkflowLink = () => { const { setVisible } = useActionContext(); return ( setVisible(false)}> - {t('View')} + {t('Configure')} ); }; diff --git a/packages/plugins/@nocobase/plugin-workflow/src/client/__tests__/e2e/createFormEvent.test.ts b/packages/plugins/@nocobase/plugin-workflow/src/client/__tests__/e2e/createFormEvent.test.ts index ae355b0ff..e57feb1eb 100644 --- a/packages/plugins/@nocobase/plugin-workflow/src/client/__tests__/e2e/createFormEvent.test.ts +++ b/packages/plugins/@nocobase/plugin-workflow/src/client/__tests__/e2e/createFormEvent.test.ts @@ -29,7 +29,7 @@ test.describe('workflow manage', () => { await page.getByTestId('filter-action').click(); await page.getByRole('textbox').fill(workFlowName); await page.getByRole('button', { name: 'Submit' }).click(); - await page.getByRole('cell', { name: 'View Edit Duplicate Delete' }).getByTestId('delete-action').click(); + await page.getByRole('cell', { name: 'Configure Edit Duplicate Delete' }).getByTestId('delete-action').click(); await page.getByRole('button', { name: 'OK' }).click(); await expect(page.getByText(workFlowName)).toBeHidden(); }); diff --git a/packages/plugins/@nocobase/plugin-workflow/src/client/__tests__/e2e/editFormEvent.test.ts b/packages/plugins/@nocobase/plugin-workflow/src/client/__tests__/e2e/editFormEvent.test.ts index 6ca9fc93a..cdab11b82 100644 --- a/packages/plugins/@nocobase/plugin-workflow/src/client/__tests__/e2e/editFormEvent.test.ts +++ b/packages/plugins/@nocobase/plugin-workflow/src/client/__tests__/e2e/editFormEvent.test.ts @@ -36,7 +36,7 @@ test.describe('workflow manage', () => { await page.getByTestId('filter-action').click(); await page.getByRole('textbox').fill(workFlowName); await page.getByRole('button', { name: 'Submit' }).click(); - await page.getByRole('cell', { name: 'View Edit Duplicate Delete' }).getByTestId('delete-action').click(); + await page.getByRole('cell', { name: 'Configure Edit Duplicate Delete' }).getByTestId('delete-action').click(); await page.getByRole('button', { name: 'OK' }).click(); await expect(page.getByText(workFlowName)).toBeHidden(); }); diff --git a/packages/plugins/@nocobase/plugin-workflow/src/client/__tests__/e2e/triggerCollectionEvent.test.ts b/packages/plugins/@nocobase/plugin-workflow/src/client/__tests__/e2e/triggerCollectionEvent.test.ts index 93868260a..6355403a2 100644 --- a/packages/plugins/@nocobase/plugin-workflow/src/client/__tests__/e2e/triggerCollectionEvent.test.ts +++ b/packages/plugins/@nocobase/plugin-workflow/src/client/__tests__/e2e/triggerCollectionEvent.test.ts @@ -37,7 +37,7 @@ test.describe('trigger collection events', () => { //配置工作流触发器 await page - .getByRole('row', { name: '1 ' + workFlowName + ' Collection event Off 0 View Edit Duplicate Delete' }) + .getByRole('row', { name: '1 ' + workFlowName + ' Collection event Off 0 Configure Edit Duplicate Delete' }) .getByRole('link') .click(); await page.getByRole('button', { name: 'Configure' }).click(); @@ -48,7 +48,7 @@ test.describe('trigger collection events', () => { await page.getByTestId('submit-action').click(); await page.getByRole('link', { name: 'Workflow' }).click(); await page - .getByRole('row', { name: '1 ' + workFlowName + ' Collection event Off 0 View Edit Duplicate Delete' }) + .getByRole('row', { name: '1 ' + workFlowName + ' Collection event Off 0 Configure Edit Duplicate Delete' }) .getByTestId('update-action') .click(); await page.getByTestId('enabled-item').getByLabel('On').check(); @@ -99,7 +99,7 @@ test.describe('trigger collection events', () => { await page.getByTestId('filter-action').click(); await page.getByRole('textbox').fill(workFlowName); await page.getByRole('button', { name: 'Submit' }).click(); - await page.getByRole('cell', { name: 'View Edit Duplicate Delete' }).getByTestId('delete-action').click(); + await page.getByRole('cell', { name: 'Configure Edit Duplicate Delete' }).getByTestId('delete-action').click(); await page.getByRole('button', { name: 'OK' }).click(); await expect(page.getByText(workFlowName)).toBeHidden(); }); diff --git a/packages/plugins/@nocobase/plugin-workflow/src/client/index.tsx b/packages/plugins/@nocobase/plugin-workflow/src/client/index.tsx index 4a23925f9..e2ee32909 100644 --- a/packages/plugins/@nocobase/plugin-workflow/src/client/index.tsx +++ b/packages/plugins/@nocobase/plugin-workflow/src/client/index.tsx @@ -2,7 +2,7 @@ export * from './constants'; export * from './Branch'; export * from './FlowContext'; export * from './nodes'; -export { triggers, getTriggersOptions } from './triggers'; +export { triggers, useTrigger, getTriggersOptions } from './triggers'; export { useWorkflowVariableOptions } from './variable'; import { Plugin } from '@nocobase/client'; diff --git a/packages/plugins/@nocobase/plugin-workflow/src/client/nodes/index.tsx b/packages/plugins/@nocobase/plugin-workflow/src/client/nodes/index.tsx index 8a50c8389..15a3e98a5 100644 --- a/packages/plugins/@nocobase/plugin-workflow/src/client/nodes/index.tsx +++ b/packages/plugins/@nocobase/plugin-workflow/src/client/nodes/index.tsx @@ -383,24 +383,7 @@ export function NodeDefaultView(props) { }, }, properties: { - ...(workflow.executed - ? { - alert: { - type: 'void', - 'x-component': Alert, - 'x-component-props': { - type: 'warning', - showIcon: true, - message: `{{t("Node in executed workflow cannot be modified", { ns: "${NAMESPACE}" })}}`, - className: css` - width: 100%; - font-size: 85%; - margin-bottom: 2em; - `, - }, - }, - } - : instruction.description + ...(instruction.description ? { description: { type: 'void', diff --git a/packages/plugins/@nocobase/plugin-workflow/src/client/schemas/workflows.ts b/packages/plugins/@nocobase/plugin-workflow/src/client/schemas/workflows.ts index d9f84ef70..c6b7f0bb9 100644 --- a/packages/plugins/@nocobase/plugin-workflow/src/client/schemas/workflows.ts +++ b/packages/plugins/@nocobase/plugin-workflow/src/client/schemas/workflows.ts @@ -311,7 +311,7 @@ export const workflowSchema: ISchema = { split: '|', }, properties: { - view: { + configure: { type: 'void', 'x-component': 'WorkflowLink', }, diff --git a/packages/plugins/@nocobase/plugin-workflow/src/client/style.tsx b/packages/plugins/@nocobase/plugin-workflow/src/client/style.tsx index 601cda54e..3c18eb836 100644 --- a/packages/plugins/@nocobase/plugin-workflow/src/client/style.tsx +++ b/packages/plugins/@nocobase/plugin-workflow/src/client/style.tsx @@ -44,6 +44,11 @@ const useStyles = createStyles(({ css, token }) => { align-items: center; padding: 2em; + > .ant-alert { + margin-bottom: 2em; + font-size: 85%; + } + .end { cursor: default; diff --git a/packages/plugins/@nocobase/plugin-workflow/src/client/triggers/index.tsx b/packages/plugins/@nocobase/plugin-workflow/src/client/triggers/index.tsx index 9a40045de..5c5c1778c 100644 --- a/packages/plugins/@nocobase/plugin-workflow/src/client/triggers/index.tsx +++ b/packages/plugins/@nocobase/plugin-workflow/src/client/triggers/index.tsx @@ -242,23 +242,7 @@ export const TriggerConfig = () => { form, }, properties: { - ...(executed - ? { - alert: { - 'x-component': Alert, - 'x-component-props': { - type: 'warning', - showIcon: true, - message: `{{t("Trigger in executed workflow cannot be modified", { ns: "${NAMESPACE}" })}}`, - className: css` - width: 100%; - font-size: 85%; - margin-bottom: 2em; - `, - }, - }, - } - : trigger.description + ...(trigger.description ? { description: { type: 'void', diff --git a/packages/plugins/@nocobase/plugin-workflow/src/locale/zh-CN.ts b/packages/plugins/@nocobase/plugin-workflow/src/locale/zh-CN.ts index 58aa19259..e7265c36e 100644 --- a/packages/plugins/@nocobase/plugin-workflow/src/locale/zh-CN.ts +++ b/packages/plugins/@nocobase/plugin-workflow/src/locale/zh-CN.ts @@ -248,8 +248,7 @@ export default { Distinct: '去重', 'Query result': '查询结果', - 'Trigger in executed workflow cannot be modified': '已经执行过工作流的触发器不能被修改', - 'Node in executed workflow cannot be modified': '已经执行过工作流中的节点不能被修改', + 'Executed workflow cannot be modified': '已经执行过的工作流不能被修改', 'Can not delete': '无法删除', 'The result of this node has been referenced by other nodes ({{nodes}}), please remove the usage before deleting.': '该节点的执行结果已被其他节点({{nodes}})引用,删除前请先移除引用。',