balibabu
commited on
Commit
·
76468f0
1
Parent(s):
1d9d2fb
Feat: When saving the canvas, other dls parameters passed from the backend are spliced into the dsl parameters #3355 (#3558)
Browse files### What problem does this PR solve?
Feat: When saving the canvas, other dls parameters passed from the
backend are spliced into the dsl parameters #3355
#3556
### Type of change
- [x] New Feature (non-breaking change which adds functionality)
web/src/pages/flow/canvas/node/popover.tsx
CHANGED
@@ -35,10 +35,10 @@ export function NextNodePopover({ children, nodeId, name }: IProps) {
|
|
35 |
|
36 |
const inputs: Array<{ component_id: string; content: string }> = get(
|
37 |
component,
|
38 |
-
['obj', '
|
39 |
[],
|
40 |
);
|
41 |
-
const output = get(component, ['obj', '
|
42 |
const { replacedOutput } = useReplaceIdWithText(output);
|
43 |
const stopPropagation: MouseEventHandler = useCallback((e) => {
|
44 |
e.stopPropagation();
|
|
|
35 |
|
36 |
const inputs: Array<{ component_id: string; content: string }> = get(
|
37 |
component,
|
38 |
+
['obj', 'inputs'],
|
39 |
[],
|
40 |
);
|
41 |
+
const output = get(component, ['obj', 'output'], {});
|
42 |
const { replacedOutput } = useReplaceIdWithText(output);
|
43 |
const stopPropagation: MouseEventHandler = useCallback((e) => {
|
44 |
e.stopPropagation();
|
web/src/pages/flow/hooks.tsx
CHANGED
@@ -268,6 +268,7 @@ export const useSaveGraph = () => {
|
|
268 |
const dslComponents = buildDslComponentsByGraph(
|
269 |
currentNodes ?? nodes,
|
270 |
edges,
|
|
|
271 |
);
|
272 |
return setFlow({
|
273 |
id,
|
|
|
268 |
const dslComponents = buildDslComponentsByGraph(
|
269 |
currentNodes ?? nodes,
|
270 |
edges,
|
271 |
+
data.dsl.components,
|
272 |
);
|
273 |
return setFlow({
|
274 |
id,
|
web/src/pages/flow/utils.ts
CHANGED
@@ -119,6 +119,7 @@ const buildOperatorParams = (operatorName: string) =>
|
|
119 |
export const buildDslComponentsByGraph = (
|
120 |
nodes: Node<NodeData>[],
|
121 |
edges: Edge[],
|
|
|
122 |
): DSLComponents => {
|
123 |
const components: DSLComponents = {};
|
124 |
|
@@ -129,6 +130,7 @@ export const buildDslComponentsByGraph = (
|
|
129 |
const operatorName = x.data.label;
|
130 |
components[id] = {
|
131 |
obj: {
|
|
|
132 |
component_name: operatorName,
|
133 |
params:
|
134 |
buildOperatorParams(operatorName)(
|
|
|
119 |
export const buildDslComponentsByGraph = (
|
120 |
nodes: Node<NodeData>[],
|
121 |
edges: Edge[],
|
122 |
+
oldDslComponents: DSLComponents,
|
123 |
): DSLComponents => {
|
124 |
const components: DSLComponents = {};
|
125 |
|
|
|
130 |
const operatorName = x.data.label;
|
131 |
components[id] = {
|
132 |
obj: {
|
133 |
+
...(oldDslComponents[id]?.obj ?? {}),
|
134 |
component_name: operatorName,
|
135 |
params:
|
136 |
buildOperatorParams(operatorName)(
|