feat: fetch flow (#1068)

### What problem does this PR solve?
feat: fetch flow #918 
feat: save graph

### Type of change


- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
balibabu
2024-06-06 11:01:14 +08:00
committed by GitHub
parent b6980d8a16
commit 72c6784ff8
22 changed files with 241 additions and 90 deletions

View File

@ -1,5 +1,6 @@
import { IModalProps } from '@/interfaces/common';
import { Drawer } from 'antd';
import { Drawer, Form } from 'antd';
import { useEffect } from 'react';
import { Node } from 'reactflow';
import AnswerForm from '../answer-form';
import BeginForm from '../begin-form';
@ -26,8 +27,16 @@ const FlowDrawer = ({
}: IModalProps<any> & IProps) => {
const operatorName: Operator = node?.data.label;
const OperatorForm = FormMap[operatorName];
const [form] = Form.useForm();
const { handleValuesChange } = useHandleFormValuesChange(node?.id);
useEffect(() => {
if (visible) {
form.setFieldsValue(node?.data?.form);
}
}, [visible, form, node?.data?.form]);
return (
<Drawer
title={node?.data.label}
@ -39,7 +48,10 @@ const FlowDrawer = ({
width={470}
>
{visible && (
<OperatorForm onValuesChange={handleValuesChange}></OperatorForm>
<OperatorForm
onValuesChange={handleValuesChange}
form={form}
></OperatorForm>
)}
</Drawer>
);