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 <edwin.jose@datastax.com>
This commit is contained in:
Lucas Oliveira 2025-05-15 09:13:35 -03:00 committed by GitHub
commit 04b2019715
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 7 additions and 3 deletions

View file

@ -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}
/>

View file

@ -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],
);

View file

@ -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"