-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: optimize flow saving functionality and implement manual sav…
…ing (#3283) * fixed patch update flow * fixed update flow patch to receive id by payload * created save flow hook with auto save and manual save functions * fix poetry lock * added auto save check with environment variable * removed unused user * separated autosave and put the flow as a creation with nodes and edges * removed set nodes that skipped saving * implemented auto save hook * removed autosave from setNodes and setEdges * added auto save hook and saved on viewport move and added useEffect to save on nodes and edges changed * changed type of setNodes * removed unused var * removed deletion of empty flow * Added saving of flow on button when autoSave is disabled * disable saving when the nodes are empty * removed save loading as false when the access token is renewed * implemented useDebounce * added save loading to save flow hook * removed setting nodes and edges on fetching, since they are set when the current flow is updated * removed unused var * use debounce hook to save flow * set nodes and edges on current flow id change * removed useplaygroundeffect * removed unused import * put set save loading before the If * removed flow cleaning and inputs setting, since the inputs and outputs are set on the ResetFlow function * updated to use ResetFlow function to update everything regarding flow * removed flow pool get on resetFlow, for it to be fetched only if the user is inside the flow * updated packagelock * Changed router to outlet on app.tsx to use createRouter * Created authSettingsGuard to guard the general settings * Fixed routes to use createBrowserRouter to allow the use of useBlocker * Changed index.tsx to use RouterProvider and the router just created * Changed flowStore to have a local flow state * Implemented setting the current flow state when saving the flow * Added the update of current flow when auto saving * changed current flow to use the current flow from Flow Store instead of Flows Manager Store * Changed codeTabsComponent Tweaks check to show if its checked * Removed unused variables * Removed browser router from context wrapper * Removed unused console.log * Changed initialSetup to just run when opening the modal * changed confirmationModal to have destructiveCancel and to only call onCancel if the other buttons were not pressed * Created a SaveChangesModal that confirms if the user wants to save their changes * Get folder by id when folder id changes too * Changed reset flow calls to store whole flow * Added check if user is exiting page to prevent him when there are unsaved changes * Added new types on ConfirmationModalType * Implement save on clicking the save button on the header * added save component shortcut to use save shortcut as save flow * added save component shortcut on shortcutsStore type * changed save shortcut to save component on node toolbar * added save shortcut to header menubar * changed shortcuts name to be compatible with existing ones * changed shortcuts to be backwards compatible * changed save to changes to maintain retrocompatibility * changed save_component to save to maintain retrocompatibility * Changed time difference to unsaved changes * changed the toolbar select item to get the right save shortcut * Changed save flow to use current flow from useFlowStore instead of the previous saved flow * changed changesNotSaved to include flow name and metadata * Added way of saving the flow settings just locally instead of directly to database * Changed shareModal to save flow with hook * removed old auto saving on connect * Removed save functions from flowsManagerStore * refactor: Remove unused imports and state variables in EditFlowSettings component * use current flow not saved one and refactored page to not receive flow * added check of isFlowPage to display the menubar * Added checks to render playground if API key is valid and if Flows exists * Added check to not display X on chat on playground page * Updated flows variable to be undefined by start to prevent things from loading before flows initialize * Implemented log builds parameter to not allow the builds to be logged if user not on flowPage
- Loading branch information
1 parent
7a93a70
commit 7264028
Showing
62 changed files
with
731 additions
and
787 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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,19 @@ | ||
import FeatureFlags from "@/../feature-config.json"; | ||
import useAuthStore from "@/stores/authStore"; | ||
import { useStoreStore } from "@/stores/storeStore"; | ||
import { Navigate } from "react-router-dom"; | ||
|
||
export const AuthSettingsGuard = ({ children }) => { | ||
const autoLogin = useAuthStore((state) => state.autoLogin); | ||
const hasStore = useStoreStore((state) => state.hasStore); | ||
|
||
// Hides the General settings if there is nothing to show | ||
const showGeneralSettings = | ||
FeatureFlags.ENABLE_PROFILE_ICONS || hasStore || !autoLogin; | ||
|
||
if (showGeneralSettings) { | ||
return children; | ||
} else { | ||
return <Navigate replace to="global-variables" />; | ||
} | ||
}; |
27 changes: 0 additions & 27 deletions
27
src/frontend/src/components/cardComponent/hooks/use-playground-effect.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
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
Oops, something went wrong.