feat: add description text to operators and extract the useFetchModelId to logicHooks.ts and drag the operator to the canvas and initialize the form data #918 (#1379)

### What problem does this PR solve?

feat: add description text to operators #918 
feat: drag the operator to the canvas and initialize the form data #918
feat: extract the useFetchModelId to logicHooks.ts
### Type of change


- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
balibabu
2024-07-04 19:18:02 +08:00
committed by GitHub
parent 306108fe0e
commit 25a8c076bf
12 changed files with 171 additions and 102 deletions

View File

@@ -2,11 +2,11 @@ import { DSLComponents } from '@/interfaces/database/flow';
import { removeUselessFieldsFromValues } from '@/utils/form';
import dagre from 'dagre';
import { humanId } from 'human-id';
import { curry, isEmpty } from 'lodash';
import { curry } from 'lodash';
import pipe from 'lodash/fp/pipe';
import { Edge, Node, Position } from 'reactflow';
import { v4 as uuidv4 } from 'uuid';
import { NodeMap, Operator, initialFormValuesMap } from './constant';
import { NodeMap, Operator } from './constant';
import { ICategorizeItemResult, NodeData } from './interface';
const buildEdges = (
@@ -143,17 +143,17 @@ const removeUselessDataInTheOperator = curry(
},
);
// initialize data for operators without parameters
const initializeOperatorParams = curry((operatorName: string, values: any) => {
if (isEmpty(values)) {
return initialFormValuesMap[operatorName as Operator];
}
return values;
});
// const initializeOperatorParams = curry((operatorName: string, values: any) => {
// if (isEmpty(values)) {
// return initialFormValuesMap[operatorName as Operator];
// }
// return values;
// });
const buildOperatorParams = (operatorName: string) =>
pipe(
removeUselessDataInTheOperator(operatorName),
initializeOperatorParams(operatorName), // Final processing, for guarantee
// initializeOperatorParams(operatorName), // Final processing, for guarantee
);
// construct a dsl based on the node information of the graph