Add flow pool management functions to flowStore and remove duplicate functions from flowIOStore
This commit is contained in:
parent
103dd29380
commit
383152aa4b
3 changed files with 17 additions and 8 deletions
|
|
@ -41,6 +41,20 @@ const useFlowStore = create<FlowStoreType>((set, get) => ({
|
||||||
inputTypes: [],
|
inputTypes: [],
|
||||||
inputIds: [],
|
inputIds: [],
|
||||||
outputIds: [],
|
outputIds: [],
|
||||||
|
setFlowPool: (flowPool) => {
|
||||||
|
set({ flowPool });
|
||||||
|
},
|
||||||
|
addDataToFlowPool: (data: any, nodeId: string) => {
|
||||||
|
let newFlowPool = cloneDeep({ ...get().flowPool });
|
||||||
|
if (!newFlowPool[nodeId]) newFlowPool[nodeId] = [data];
|
||||||
|
else {
|
||||||
|
newFlowPool[nodeId].push(data);
|
||||||
|
}
|
||||||
|
get().setFlowPool(newFlowPool);
|
||||||
|
},
|
||||||
|
CleanFlowPool: () => {
|
||||||
|
get().setFlowPool({});
|
||||||
|
},
|
||||||
setPending: (isPending) => {
|
setPending: (isPending) => {
|
||||||
set({ isPending });
|
set({ isPending });
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,9 @@ export type FlowStoreType = {
|
||||||
outputTypes: string[];
|
outputTypes: string[];
|
||||||
inputIds: string[];
|
inputIds: string[];
|
||||||
outputIds: string[];
|
outputIds: string[];
|
||||||
|
setFlowPool: (flowPool: FlowPoolType) => void;
|
||||||
|
addDataToFlowPool: (data: any, nodeId: string) => void;
|
||||||
|
CleanFlowPool: () => void;
|
||||||
updateSSEData: (sseData: object) => void;
|
updateSSEData: (sseData: object) => void;
|
||||||
sseData: object;
|
sseData: object;
|
||||||
isBuilding: boolean;
|
isBuilding: boolean;
|
||||||
|
|
|
||||||
|
|
@ -23,19 +23,11 @@ export type FlowPoolType = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export type flowIOStoreType = {
|
export type flowIOStoreType = {
|
||||||
flowPool: FlowPoolType;
|
|
||||||
inputTypes: string[];
|
|
||||||
outputTypes: string[];
|
|
||||||
inputIds: string[];
|
|
||||||
outputIds: string[];
|
|
||||||
setFlowPool: (flowPool: FlowPoolType) => void;
|
|
||||||
setOutputTypes: (outputTypes: string[]) => void;
|
setOutputTypes: (outputTypes: string[]) => void;
|
||||||
setInputTypes: (inputTypes: string[]) => void;
|
setInputTypes: (inputTypes: string[]) => void;
|
||||||
setInputIds: (inputIds: string[]) => void;
|
setInputIds: (inputIds: string[]) => void;
|
||||||
setOutputIds: (outputIds: string[]) => void;
|
setOutputIds: (outputIds: string[]) => void;
|
||||||
updateFlowPoolNodes: (nodes: NodeType[]) => void;
|
updateFlowPoolNodes: (nodes: NodeType[]) => void;
|
||||||
addDataToFlowPool: (data: any, nodeId: string) => void;
|
|
||||||
CleanFlowPool: () => void;
|
|
||||||
checkInputandOutput: (flow?: FlowType) => boolean;
|
checkInputandOutput: (flow?: FlowType) => boolean;
|
||||||
getInputTypes: (flow?: FlowType) => string[];
|
getInputTypes: (flow?: FlowType) => string[];
|
||||||
getOutputTypes: (flow?: FlowType) => string[];
|
getOutputTypes: (flow?: FlowType) => string[];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue