From 3cef678fbf8c8fb803653b87191fc2325af13e04 Mon Sep 17 00:00:00 2001 From: Lior Keren Date: Tue, 26 Mar 2024 15:55:52 +0200 Subject: [PATCH 1/3] fix(RHINENG-4108): Filter reset when AddSystemsToGroupModal closes Link to issue: https://issues.redhat.com/browse/RHINENG-4108 --- src/components/GroupSystems/GroupSystems.js | 2 +- src/components/InventoryGroups/Modals/AddSystemsToGroupModal.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/GroupSystems/GroupSystems.js b/src/components/GroupSystems/GroupSystems.js index 905714306..eb288b6f1 100644 --- a/src/components/GroupSystems/GroupSystems.js +++ b/src/components/GroupSystems/GroupSystems.js @@ -141,7 +141,7 @@ const GroupSystems = ({ groupName, groupId }) => { hostGroupFilter, lastSeenFilter ); - }, []); + }, [addToGroupModalOpen]); const bulkSelectConfig = useBulkSelectConfig( selected, diff --git a/src/components/InventoryGroups/Modals/AddSystemsToGroupModal.js b/src/components/InventoryGroups/Modals/AddSystemsToGroupModal.js index 494ff874a..03efdd010 100644 --- a/src/components/InventoryGroups/Modals/AddSystemsToGroupModal.js +++ b/src/components/InventoryGroups/Modals/AddSystemsToGroupModal.js @@ -107,11 +107,11 @@ const AddSystemsToGroupModal = ({ const calculateSelected = () => (selected ? selected.size : 0); const handleModalClose = () => { - setIsModalOpen(false); if (calculateSelected() > 0) { dispatch(selectEntity(-1, false)); } dispatch(clearFilters()); + setIsModalOpen(false); }; const edgeParityInventoryListEnabled = useFeatureFlag( From 6c2368abd4f6e8766accbaa47275357330e3df2a Mon Sep 17 00:00:00 2001 From: Lior Keren Date: Tue, 26 Mar 2024 15:58:14 +0200 Subject: [PATCH 2/3] feat(AddSystemsToGroupModal): Remove unnecessary onClick function creations --- .../InventoryGroups/Modals/AddSystemsToGroupModal.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/components/InventoryGroups/Modals/AddSystemsToGroupModal.js b/src/components/InventoryGroups/Modals/AddSystemsToGroupModal.js index 03efdd010..77aa82c60 100644 --- a/src/components/InventoryGroups/Modals/AddSystemsToGroupModal.js +++ b/src/components/InventoryGroups/Modals/AddSystemsToGroupModal.js @@ -190,7 +190,7 @@ const AddSystemsToGroupModal = ({ setConfirmationModalOpen(false); setSystemSelectModalOpen(true); // switch back to the systems table modal }} - onCancel={() => handleModalClose()} + onCancel={handleModalClose} hostsNumber={alreadyHasGroup.length} /> {/** hosts selection modal */} @@ -214,7 +214,7 @@ const AddSystemsToGroupModal = ({ } isOpen={systemsSelectModalOpen} - onClose={() => handleModalClose()} + onClose={handleModalClose} footer={ {showWarning && ( @@ -244,11 +244,7 @@ const AddSystemsToGroupModal = ({ > Add systems - From f7ae6d74807517310e33e4819e9a09fe241cf7d3 Mon Sep 17 00:00:00 2001 From: Lior Keren Date: Tue, 26 Mar 2024 15:59:20 +0200 Subject: [PATCH 3/3] feat(AddSystemsToGroupModal): Remove unnecessary function creation --- .../InventoryGroups/Modals/AddSystemsToGroupModal.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/InventoryGroups/Modals/AddSystemsToGroupModal.js b/src/components/InventoryGroups/Modals/AddSystemsToGroupModal.js index 77aa82c60..f339a954d 100644 --- a/src/components/InventoryGroups/Modals/AddSystemsToGroupModal.js +++ b/src/components/InventoryGroups/Modals/AddSystemsToGroupModal.js @@ -104,10 +104,10 @@ const AddSystemsToGroupModal = ({ [isModalOpen] ); - const calculateSelected = () => (selected ? selected.size : 0); + const numOfSelectedSystems = selected ? selected.size : 0; const handleModalClose = () => { - if (calculateSelected() > 0) { + if (numOfSelectedSystems > 0) { dispatch(selectEntity(-1, false)); } dispatch(clearFilters());