diff --git a/packages/core/client/src/schema-component/antd/form-v2/Form.tsx b/packages/core/client/src/schema-component/antd/form-v2/Form.tsx
index b1b708249..c89be9ec5 100644
--- a/packages/core/client/src/schema-component/antd/form-v2/Form.tsx
+++ b/packages/core/client/src/schema-component/antd/form-v2/Form.tsx
@@ -141,7 +141,7 @@ const WithForm = (props) => {
form.removeEffects(id);
};
}, [linkageRules]);
- return fieldSchema['x-decorator'] === 'Form' ? : ;
+ return fieldSchema['x-decorator'] === 'FormV2' ? : ;
};
const WithoutForm = (props) => {
@@ -159,7 +159,7 @@ const WithoutForm = (props) => {
}),
[],
);
- return fieldSchema['x-decorator'] === 'Form' ? (
+ return fieldSchema['x-decorator'] === 'FormV2' ? (
) : (
diff --git a/packages/plugins/workflow/src/client/WorkflowCanvas.tsx b/packages/plugins/workflow/src/client/WorkflowCanvas.tsx
index 1fae40614..e9c8e0262 100644
--- a/packages/plugins/workflow/src/client/WorkflowCanvas.tsx
+++ b/packages/plugins/workflow/src/client/WorkflowCanvas.tsx
@@ -52,12 +52,11 @@ export function WorkflowCanvas() {
setTitle?.(`${lang('Workflow')}${title ? `: ${title}` : ''}`);
}, [data?.data]);
- if (!data?.data && !loading) {
- return
{lang('Load failed')}
;
+ if (!data?.data) {
+ return {loading ? lang('Loading') : lang('Load failed')}
;
}
const { nodes = [], revisions = [], ...workflow } = data?.data ?? {};
-
linkNodes(nodes);
const entry = nodes.find((item) => !item.upstream);
diff --git a/packages/plugins/workflow/src/client/triggers/index.tsx b/packages/plugins/workflow/src/client/triggers/index.tsx
index 1bee28ebb..bba55d2ad 100644
--- a/packages/plugins/workflow/src/client/triggers/index.tsx
+++ b/packages/plugins/workflow/src/client/triggers/index.tsx
@@ -1,9 +1,9 @@
-import React, { useState, useEffect } from 'react';
+import React, { useState, useEffect, useMemo } from 'react';
import { css, cx } from '@emotion/css';
+import { createForm } from '@formily/core';
import { ISchema, useForm } from '@formily/react';
import { Registry } from '@nocobase/utils/client';
import { message, Tag, Alert, Button, Input } from 'antd';
-import { useTranslation } from 'react-i18next';
import { InfoOutlined } from '@ant-design/icons';
import {
@@ -13,7 +13,6 @@ import {
useActionContext,
useAPIClient,
useCompile,
- useRequest,
useResourceActionContext,
} from '@nocobase/client';
@@ -148,10 +147,19 @@ export const TriggerConfig = () => {
}
}, [workflow]);
+ const form = useMemo(
+ () =>
+ createForm({
+ values: workflow?.config,
+ disabled: workflow?.executed,
+ }),
+ [workflow],
+ );
+
if (!workflow || !workflow.type) {
return null;
}
- const { title, type, config, executed } = workflow;
+ const { title, type, executed } = workflow;
const trigger = triggers.get(type);
const { fieldset, scope, components } = trigger;
typeTitle = trigger.title;
@@ -205,6 +213,7 @@ export const TriggerConfig = () => {
{
type: 'void',
title: titleText,
'x-component': 'Action.Drawer',
- 'x-decorator': 'Form',
+ 'x-decorator': 'FormV2',
'x-decorator-props': {
- disabled: workflow.executed,
- useValues(options) {
- return useRequest(
- () =>
- Promise.resolve({
- data: config,
- }),
- options,
- );
- },
+ form,
},
properties: {
...(executed
diff --git a/packages/plugins/workflow/src/client/triggers/schedule/ScheduleConfig.tsx b/packages/plugins/workflow/src/client/triggers/schedule/ScheduleConfig.tsx
index e3eeea2ae..644068489 100644
--- a/packages/plugins/workflow/src/client/triggers/schedule/ScheduleConfig.tsx
+++ b/packages/plugins/workflow/src/client/triggers/schedule/ScheduleConfig.tsx
@@ -5,7 +5,7 @@ import { css } from '@emotion/css';
import { SchemaComponent } from '@nocobase/client';
-import { collection } from '../../schemas/collection';
+import { appends, collection } from '../../schemas/collection';
import { OnField } from './OnField';
import { EndsByField } from './EndsByField';
import { RepeatField } from './RepeatField';
@@ -141,6 +141,19 @@ const ModeFieldsets = {
min: 0,
},
},
+ appends: {
+ ...appends,
+ 'x-reactions': [
+ {
+ dependencies: ['mode', 'collection'],
+ fulfill: {
+ state: {
+ visible: `{{$deps[0] === ${SCHEDULE_MODE.COLLECTION_FIELD} && $deps[1]}}`,
+ },
+ },
+ },
+ ],
+ },
},
};
diff --git a/packages/plugins/workflow/src/client/triggers/schedule/index.tsx b/packages/plugins/workflow/src/client/triggers/schedule/index.tsx
index 775d4b21a..76e9813d9 100644
--- a/packages/plugins/workflow/src/client/triggers/schedule/index.tsx
+++ b/packages/plugins/workflow/src/client/triggers/schedule/index.tsx
@@ -5,7 +5,6 @@ import { SCHEDULE_MODE } from './constants';
import { NAMESPACE, useWorkflowTranslation } from '../../locale';
import { CollectionBlockInitializer } from '../../components/CollectionBlockInitializer';
import { useCollectionFieldOptions } from '../../variable';
-import { appends } from '../../schemas/collection';
import { FieldsSelect } from '../../components/FieldsSelect';
export default {
@@ -17,19 +16,6 @@ export default {
'x-component': 'ScheduleConfig',
'x-component-props': {},
},
- appends: {
- ...appends,
- 'x-reactions': [
- {
- dependencies: ['mode', 'collection'],
- fulfill: {
- state: {
- visible: `{{$deps[0] === ${SCHEDULE_MODE.COLLECTION_FIELD} && $deps[1]}}`,
- },
- },
- },
- ],
- },
},
scope: {
useCollectionDataSource,