{parameter.title}:
-
{parameter.default?.toString()}
+
{parameter.value?.toString()}
))
}
diff --git a/frontend/src/stores/GraphStores/GraphLibrary/GraphLibraryStore.ts b/frontend/src/stores/GraphStores/GraphLibrary/GraphLibraryStore.ts
index 6becb915..adedf1f0 100644
--- a/frontend/src/stores/GraphStores/GraphLibrary/GraphLibraryStore.ts
+++ b/frontend/src/stores/GraphStores/GraphLibrary/GraphLibraryStore.ts
@@ -73,6 +73,16 @@ export const graphLibrarySlice = createSlice({
reducers: {
setAllGraphs: (state, action) => {
state.allGraphs = action.payload;
+
+ const applyDefaultValue = (workflow?: GraphMap) =>
+ Object.values(workflow || {}).map(graph => {
+ Object.values(graph.parameters || {}).map(parameter =>
+ parameter.value = parameter.default
+ );
+ graph.nodes && applyDefaultValue(graph.nodes);
+ });
+
+ applyDefaultValue(state.allGraphs);
},
setSelectedWorkflowName: (state, action) => {
state.selectedWorkflowName = action.payload;
@@ -94,7 +104,7 @@ export const graphLibrarySlice = createSlice({
},
setNodeParameter: (state, action: PayloadAction<{
paramKey: string
- newValue: boolean | number | string | string[]
+ newValue: boolean | number | string | string[] | undefined
nodeId?: string
selectedWorkflowName?: string
subgraphBreadcrumbs: string[]
@@ -114,7 +124,7 @@ export const graphLibrarySlice = createSlice({
}
if (graph.parameters)
- graph.parameters[paramKey].default = newValue;
+ graph.parameters[paramKey].value = newValue;
},
setErrorObject: (state, action) => {
state.errorObject = action.payload;
diff --git a/frontend/src/stores/GraphStores/GraphLibrary/actions.ts b/frontend/src/stores/GraphStores/GraphLibrary/actions.ts
index 6192ded7..ef22d8fc 100644
--- a/frontend/src/stores/GraphStores/GraphLibrary/actions.ts
+++ b/frontend/src/stores/GraphStores/GraphLibrary/actions.ts
@@ -120,7 +120,7 @@ export const submitWorkflow = () => async (dispatch: RootDispatch, getState: ()
if (!params) return transformedParams;
for (const key in params) {
- transformedParams = { ...transformedParams, [key]: params[key].default };
+ transformedParams = { ...transformedParams, [key]: params[key].value };
}
return transformedParams;
};
@@ -168,7 +168,7 @@ export const submitWorkflow = () => async (dispatch: RootDispatch, getState: ()
}
};
-export const setGraphNodeParameter = (paramKey: string, newValue: boolean | number | string | string[], nodeId?: string) =>
+export const setGraphNodeParameter = (paramKey: string, newValue: boolean | number | string | string[] | undefined, nodeId?: string) =>
(dispatch: RootDispatch, getState: () => RootState) => {
const subgraphBreadcrumbs = getSubgraphBreadcrumbs(getState());
const selectedWorkflowName = getSelectedWorkflowName(getState());
diff --git a/frontend/src/stores/NodesStore/NodesStore.ts b/frontend/src/stores/NodesStore/NodesStore.ts
index 00aa8e45..a9ac8581 100644
--- a/frontend/src/stores/NodesStore/NodesStore.ts
+++ b/frontend/src/stores/NodesStore/NodesStore.ts
@@ -109,11 +109,16 @@ export const nodesSlice = createSlice({
},
setAllNodes: (state, action) => {
state.allNodes = action.payload;
+ Object.values(state.allNodes || {}).map((node) =>
+ Object.values(node.parameters || {}).map(parameter =>
+ parameter.value = parameter.default
+ )
+ );
},
setNodeParameter: (state, action) => {
const { nodeKey, paramKey, newValue } = action.payload;
if (state.allNodes && state.allNodes[nodeKey].parameters)
- state.allNodes[nodeKey].parameters[paramKey].default = newValue;
+ state.allNodes[nodeKey].parameters[paramKey].value = newValue;
},
setIsNodeRunning: (state, action) => {
state.isNodeRunning = action.payload;
diff --git a/frontend/src/stores/NodesStore/actions.ts b/frontend/src/stores/NodesStore/actions.ts
index 2619a364..81fde078 100644
--- a/frontend/src/stores/NodesStore/actions.ts
+++ b/frontend/src/stores/NodesStore/actions.ts
@@ -190,10 +190,10 @@ const formatDate = (date: Date) => {
const transformInputParameters = (parameters: InputParameter) => {
return Object.entries(parameters).reduce(
(acc, [key, parameter]) => {
- acc[key] = parameter.default ?? null;
+ acc[key] = parameter.value ?? null;
return acc;
},
- {} as { [key: string]: boolean | number | string | null | string[] }
+ {} as { [key: string]: boolean | number | string | null | string[] | undefined }
);
};
diff --git a/frontend/src/stores/NodesStore/api/NodesAPI.tsx b/frontend/src/stores/NodesStore/api/NodesAPI.tsx
index 50efe764..017e12f2 100644
--- a/frontend/src/stores/NodesStore/api/NodesAPI.tsx
+++ b/frontend/src/stores/NodesStore/api/NodesAPI.tsx
@@ -30,7 +30,7 @@ export class NodesApi extends Api {
static submitNodeParameters(
nodeName: string,
inputParameter: {
- [key: string]: string | number | boolean | null | string[];
+ [key: string]: string | number | boolean | null | string[] | undefined;
}
): Promise