diff --git a/packages/plugins/@nocobase/plugin-workflow/src/client/WorkflowProvider.tsx b/packages/plugins/@nocobase/plugin-workflow/src/client/WorkflowProvider.tsx
index 97681f499..8de70eb31 100644
--- a/packages/plugins/@nocobase/plugin-workflow/src/client/WorkflowProvider.tsx
+++ b/packages/plugins/@nocobase/plugin-workflow/src/client/WorkflowProvider.tsx
@@ -5,7 +5,7 @@ import {
SchemaComponentContext,
SettingsCenterProvider,
} from '@nocobase/client';
-import { Card, Tooltip } from 'antd';
+import { Card } from 'antd';
import React, { useContext } from 'react';
import { ExecutionLink } from './ExecutionLink';
import { ExecutionResourceProvider } from './ExecutionResourceProvider';
@@ -15,7 +15,7 @@ import expressionField from './interfaces/expression';
import { lang } from './locale';
import { instructions } from './nodes';
import { workflowSchema } from './schemas/workflows';
-import { triggers } from './triggers';
+import { getTriggersOptions, triggers } from './triggers';
import { ExecutionStatusSelect } from './components/ExecutionStatusSelect';
// registerField(expressionField.group, 'expression', expressionField);
@@ -34,13 +34,15 @@ function WorkflowPane() {
diff --git a/packages/plugins/@nocobase/plugin-workflow/src/client/index.tsx b/packages/plugins/@nocobase/plugin-workflow/src/client/index.tsx
index e31a1db92..5049f93e7 100644
--- a/packages/plugins/@nocobase/plugin-workflow/src/client/index.tsx
+++ b/packages/plugins/@nocobase/plugin-workflow/src/client/index.tsx
@@ -19,7 +19,7 @@ export class WorkflowPlugin extends Plugin {
this.addRoutes();
this.addScopes();
this.addComponents();
- this.app.use(WorkflowProvider);
+ this.app.addProvider(WorkflowProvider);
}
addScopes() {
diff --git a/packages/plugins/@nocobase/plugin-workflow/src/client/nodes/manual/WorkflowTodo.tsx b/packages/plugins/@nocobase/plugin-workflow/src/client/nodes/manual/WorkflowTodo.tsx
index eb072480b..4f4040a50 100644
--- a/packages/plugins/@nocobase/plugin-workflow/src/client/nodes/manual/WorkflowTodo.tsx
+++ b/packages/plugins/@nocobase/plugin-workflow/src/client/nodes/manual/WorkflowTodo.tsx
@@ -529,7 +529,9 @@ function FooterStatus() {
>
{dayjs(updatedAt).format('YYYY-MM-DD HH:mm:ss')}
- {compile(statusOption.label)}
+
+ {compile(statusOption.label)}
+
) : null;
}
@@ -565,7 +567,7 @@ function Drawer() {
content: {
type: 'void',
'x-component': 'FooterStatus',
- }
+ },
},
},
},
@@ -586,7 +588,7 @@ function Decorator({ params = {}, children }) {
sort: ['-createdAt'],
...params,
appends: ['user', 'node', 'workflow'],
- except: ['node.config', 'workflow.config'],
+ except: ['node.config', 'workflow.config', 'workflow.options'],
},
rowKey: 'id',
showIndex: true,
diff --git a/packages/plugins/@nocobase/plugin-workflow/src/client/nodes/manual/forms/custom.tsx b/packages/plugins/@nocobase/plugin-workflow/src/client/nodes/manual/forms/custom.tsx
index 6f5f7c19c..ca1751ff9 100644
--- a/packages/plugins/@nocobase/plugin-workflow/src/client/nodes/manual/forms/custom.tsx
+++ b/packages/plugins/@nocobase/plugin-workflow/src/client/nodes/manual/forms/custom.tsx
@@ -104,6 +104,10 @@ function CustomFormBlockInitializer({ insert, ...props }) {
'x-component': 'ActionBar',
'x-component-props': {
layout: 'one-column',
+ style: {
+ marginTop: '1.5em',
+ flexWrap: 'wrap',
+ },
},
'x-initializer': 'AddActionButton',
properties: {
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 7437e560b..d9f84ef70 100644
--- a/packages/plugins/@nocobase/plugin-workflow/src/client/schemas/workflows.ts
+++ b/packages/plugins/@nocobase/plugin-workflow/src/client/schemas/workflows.ts
@@ -3,7 +3,7 @@ import { message } from 'antd';
import { useTranslation } from 'react-i18next';
import { useActionContext, useRecord, useResourceActionContext, useResourceContext } from '@nocobase/client';
import { NAMESPACE } from '../locale';
-import { triggers } from '../triggers';
+// import { triggers } from '../triggers';
import { executionSchema } from './executions';
const collection = {
@@ -27,13 +27,11 @@ const collection = {
uiSchema: {
title: `{{t("Trigger type", { ns: "${NAMESPACE}" })}}`,
type: 'string',
- 'x-component': 'Select',
'x-decorator': 'FormItem',
- enum: Array.from(triggers.getEntities()).map(([value, { title }]) => ({
- value,
- label: title,
- color: 'gold',
- })),
+ 'x-component': 'Select',
+ 'x-component-props': {
+ options: `{{getTriggersOptions()}}`,
+ },
required: true,
} as ISchema,
},
@@ -136,7 +134,6 @@ export const workflowSchema: ISchema = {
resource: 'workflows',
action: 'list',
params: {
- pageSize: 20,
filter: {
current: true,
},
@@ -221,27 +218,6 @@ export const workflowSchema: ISchema = {
},
},
},
- sync: {
- type: 'void',
- title: `{{t("Sync", { ns: "${NAMESPACE}" })}}`,
- 'x-decorator': 'Tooltip',
- 'x-decorator-props': {
- title: `{{ t("Sync enabled status of all workflows from database", { ns: "${NAMESPACE}" }) }}`,
- },
- 'x-component': 'Action',
- 'x-component-props': {
- useAction() {
- const { t } = useTranslation();
- const { resource } = useResourceContext();
- return {
- async run() {
- await resource.sync();
- message.success(t('Operation succeeded'));
- },
- };
- },
- },
- },
delete: {
type: 'void',
title: '{{t("Delete")}}',
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 6cf5c17ed..9a40045de 100644
--- a/packages/plugins/@nocobase/plugin-workflow/src/client/triggers/index.tsx
+++ b/packages/plugins/@nocobase/plugin-workflow/src/client/triggers/index.tsx
@@ -325,3 +325,11 @@ export function useTrigger() {
const { workflow } = useFlowContext();
return triggers.get(workflow.type);
}
+
+export function getTriggersOptions() {
+ return Array.from(triggers.getEntities()).map(([value, { title }]) => ({
+ value,
+ label: title,
+ color: 'gold',
+ }));
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow/src/client/variable.tsx b/packages/plugins/@nocobase/plugin-workflow/src/client/variable.tsx
index 5b188aa64..a44cdb5be 100644
--- a/packages/plugins/@nocobase/plugin-workflow/src/client/variable.tsx
+++ b/packages/plugins/@nocobase/plugin-workflow/src/client/variable.tsx
@@ -192,13 +192,13 @@ export function useWorkflowVariableOptions(options: OptionsOfUseVariableOptions
const opts = Object.assign(options, { fieldNames });
const compile = useCompile();
const result = [scopeOptions, nodesOptions, triggerOptions, systemOptions].map((item: any) => {
- const children = item.useOptions(opts).filter(Boolean);
+ const children = item.useOptions?.(opts)?.filter(Boolean);
return {
[fieldNames.label]: compile(item.label),
[fieldNames.value]: item.value,
key: item[fieldNames.value],
[fieldNames.children]: children,
- disabled: children && !children.length,
+ disabled: !children || !children.length,
};
});