From 04b2019715c2d7c023cf01bd8689f6926a87e6c9 Mon Sep 17 00:00:00 2001 From: Lucas Oliveira <62335616+lucaseduoli@users.noreply.github.com> Date: Thu, 15 May 2025 09:13:35 -0300 Subject: [PATCH] fix: filter Update All components to not include edited ones, changed Node Toolbar to show Restore for edited componetns (#8050) * Updated updateAllComponents to not include user edited components * Changed GenericNode to display isOutdated to node toolbar if user edited * Changed Restore color --------- Co-authored-by: Edwin Jose --- src/frontend/src/CustomNodes/GenericNode/index.tsx | 3 ++- .../pages/FlowPage/components/UpdateAllComponents/index.tsx | 3 ++- .../pages/FlowPage/components/nodeToolbarComponent/index.tsx | 4 +++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/frontend/src/CustomNodes/GenericNode/index.tsx b/src/frontend/src/CustomNodes/GenericNode/index.tsx index a37489700..9c1f21660 100644 --- a/src/frontend/src/CustomNodes/GenericNode/index.tsx +++ b/src/frontend/src/CustomNodes/GenericNode/index.tsx @@ -119,6 +119,7 @@ function GenericNode({ state.componentsToUpdate.find((component) => component.id === data.id), ), ); + const { outdated: isOutdated, breakingChange: hasBreakingChange, @@ -330,7 +331,7 @@ function GenericNode({ openAdvancedModal={false} onCloseAdvancedModal={() => {}} updateNode={() => handleUpdateCode()} - isOutdated={isOutdated && dismissAll} + isOutdated={isOutdated && (dismissAll || isUserEdited)} isUserEdited={isUserEdited} hasBreakingChange={hasBreakingChange} /> diff --git a/src/frontend/src/pages/FlowPage/components/UpdateAllComponents/index.tsx b/src/frontend/src/pages/FlowPage/components/UpdateAllComponents/index.tsx index 29c447ce0..d9fb532d6 100644 --- a/src/frontend/src/pages/FlowPage/components/UpdateAllComponents/index.tsx +++ b/src/frontend/src/pages/FlowPage/components/UpdateAllComponents/index.tsx @@ -48,7 +48,8 @@ export default function UpdateAllComponents({}: {}) { const componentsToUpdateFiltered = useMemo( () => componentsToUpdate.filter( - (component) => !dismissedNodes.includes(component.id), + (component) => + !dismissedNodes.includes(component.id) && !component.userEdited, ), [componentsToUpdate, dismissedNodes], ); diff --git a/src/frontend/src/pages/FlowPage/components/nodeToolbarComponent/index.tsx b/src/frontend/src/pages/FlowPage/components/nodeToolbarComponent/index.tsx index 125c3dd2b..866f086f5 100644 --- a/src/frontend/src/pages/FlowPage/components/nodeToolbarComponent/index.tsx +++ b/src/frontend/src/pages/FlowPage/components/nodeToolbarComponent/index.tsx @@ -606,7 +606,9 @@ const NodeToolbarComponent = memo( shortcuts.find((obj) => obj.name === "Update") ?.shortcut! } - style={hasBreakingChange ? "text-warning" : ""} + style={ + hasBreakingChange ? "text-accent-amber-foreground" : "" + } value={isUserEdited ? "Restore" : "Update"} icon={isUserEdited ? "RefreshCcwDot" : "CircleArrowUp"} dataTestId="update-button-modal"