fix(plugin-workflow): fix trigger config (#997)

This commit is contained in:
Junyi 2022-11-01 10:00:24 +08:00 committed by GitHub
parent 7d73194c0d
commit b167794290
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 5 deletions

View File

@ -96,7 +96,7 @@ export function ExecutionCanvas() {
</aside>
</div>
<div className="workflow-canvas">
<TriggerConfig workflow={workflow} />
<TriggerConfig />
<div className={branchBlockClass}>
<Branch entry={entry} />
</div>

View File

@ -144,7 +144,7 @@ export function WorkflowCanvas() {
</aside>
</div>
<div className="workflow-canvas">
<TriggerConfig workflow={workflow} />
<TriggerConfig />
<div className={branchBlockClass}>
<Branch entry={entry} />
</div>

View File

@ -6,7 +6,7 @@ import React from "react";
import { useTranslation } from "react-i18next";
import { InfoOutlined } from '@ant-design/icons';
import { SchemaComponent, useActionContext, useAPIClient, useCompile, useResourceActionContext } from '@nocobase/client';
import { SchemaComponent, useActionContext, useAPIClient, useCompile, useRequest, useResourceActionContext } from '@nocobase/client';
import { nodeCardClass, nodeHeaderClass, nodeMetaClass, nodeTitleClass } from "../style";
import { useFlowContext } from "../FlowContext";
@ -128,9 +128,10 @@ function TriggerExecution() {
);
}
export const TriggerConfig = ({ workflow }) => {
export const TriggerConfig = () => {
const { t } = useTranslation();
const compile = useCompile();
const { workflow } = useFlowContext();
if (!workflow || !workflow.type) {
return null;
}
@ -161,7 +162,11 @@ export const TriggerConfig = ({ workflow }) => {
'x-component': 'Action.Drawer',
'x-decorator': 'Form',
'x-decorator-props': {
initialValue: { config }
useValues(options) {
return useRequest(() => Promise.resolve({
data: { config },
}), options);
},
},
properties: {
config: {