-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Removed unused function and fixed tags initial value * Added post save flow * Added update flow patch * removed unused import * created useAddFlow hook to substitute AddFlow function on flowsManager store * fixed post save flow to handle endpoint name as undefined * Fixed add flow hook to use post save flow mutation * removed unused line * changed addFlow to use hook in all components that use addFlow * Removed unused code * removed addFlow of useDuplicateFlows call * made newProject default as true * removed unused variables from addFlow * fixed url of requests of flows * passed functions directly * fix app to display loading on top of the router * fixed promise of addFlow * Added upload flow hook with a lot of modularity * Fixed addFlow naming * Added helper functions for file uploading * Changed upload flow to use helper functions * removed refresh on post * changed paste function to handle when chatinput node exists on paste * Used helper function to create input on FileInput * Used helper function to create input on InputFileComponent * Used helper function to create input on folder upload, and used uploadFlow hook * used uploadFlow hook on dropdown options * used addFlow instead of addComponent on node toolbar * changed upload flow on headerComponent to use hook * Changed pageComponent to use uploadFlow hook * removed useFileDrop dependency * Fixed onFileDrop to use uploadFlow * removed useDropdown dependency * removed unused add and upload functions from flowsManagerStore * Clean flows and refetch when flow change, added loader when is fetching * change name of delete flows api * created useDeleteFlow hook * used delete flow on useAddFlow * Used useDeleteFlow hook in places that used removeFlow and deleteComponent * deleted useDeleteMultiple hook * removed removeFlows and deleteComponent functions of flowsManagerStore * Deleted API flows delete call from API file
- Loading branch information
1 parent
4d66bf3
commit f0bbf12
Showing
10 changed files
with
94 additions
and
202 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { useDeleteDeleteFlows } from "@/controllers/API/queries/flows/use-delete-delete-flows"; | ||
import useFlowsManagerStore from "@/stores/flowsManagerStore"; | ||
import { useTypesStore } from "@/stores/typesStore"; | ||
import { | ||
extractFieldsFromComponenents, | ||
processFlows, | ||
} from "@/utils/reactflowUtils"; | ||
|
||
const useDeleteFlow = () => { | ||
const flows = useFlowsManagerStore((state) => state.flows); | ||
const setFlows = useFlowsManagerStore((state) => state.setFlows); | ||
const setIsLoading = useFlowsManagerStore((state) => state.setIsLoading); | ||
|
||
const { mutate } = useDeleteDeleteFlows(); | ||
|
||
const deleteFlow = async ({ | ||
id, | ||
}: { | ||
id: string | string[]; | ||
}): Promise<void> => { | ||
return new Promise<void>((resolve, reject) => { | ||
if (!Array.isArray(id)) { | ||
id = [id]; | ||
} | ||
mutate( | ||
{ flow_ids: id }, | ||
{ | ||
onSuccess: () => { | ||
const { data, flows: myFlows } = processFlows( | ||
flows.filter((flow) => !id.includes(flow.id)), | ||
); | ||
setFlows(myFlows); | ||
setIsLoading(false); | ||
useTypesStore.setState((state) => ({ | ||
data: { ...state.data, ["saved_components"]: data }, | ||
ComponentFields: extractFieldsFromComponenents({ | ||
...state.data, | ||
["saved_components"]: data, | ||
}), | ||
})); | ||
|
||
resolve(); | ||
}, | ||
onError: (e) => reject(e), | ||
}, | ||
); | ||
}); | ||
}; | ||
|
||
return deleteFlow; | ||
}; | ||
|
||
export default useDeleteFlow; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 0 additions & 54 deletions
54
src/frontend/src/pages/MainPage/components/componentsComponent/hooks/use-delete-multiple.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.