19865: Reset search values on panel loading. 19865-search-clearing-fix
authorLucas Di Pentima <lucas.dipentima@curii.com>
Thu, 12 Jan 2023 21:41:54 +0000 (18:41 -0300)
committerLucas Di Pentima <lucas.dipentima@curii.com>
Thu, 12 Jan 2023 21:41:54 +0000 (18:41 -0300)
I really tried to avoid doing this duplicate work by implementing some smart
behavior on DataExplorer itself, but enough time has been wasted so I'm going
with the more straightforward way.

Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas.dipentima@curii.com>

src/store/all-processes-panel/all-processes-panel-action.ts
src/store/favorite-panel/favorite-panel-action.ts
src/store/groups-panel/groups-panel-actions.ts
src/store/project-panel/project-panel-action.ts
src/store/public-favorites-panel/public-favorites-action.ts
src/store/shared-with-me-panel/shared-with-me-panel-actions.ts
src/store/trash-panel/trash-panel-action.ts
src/store/users/users-actions.ts

index 3d30eaec46dcc58ebdf9aeb485bbdd968314c302..c33cd823cff8bda05787bcd0c78e4af8c02ac58e 100644 (file)
@@ -2,9 +2,13 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
+import { Dispatch } from "redux";
 import { bindDataExplorerActions } from "../data-explorer/data-explorer-action";
 
 export const ALL_PROCESSES_PANEL_ID = "allProcessesPanel";
 export const allProcessesPanelActions = bindDataExplorerActions(ALL_PROCESSES_PANEL_ID);
 
-export const loadAllProcessesPanel = () => allProcessesPanelActions.REQUEST_ITEMS();
+export const loadAllProcessesPanel = () => (dispatch: Dispatch) => {
+    dispatch(allProcessesPanelActions.RESET_EXPLORER_SEARCH_VALUE());
+    dispatch(allProcessesPanelActions.REQUEST_ITEMS());
+}
index 067d5ceedb90bbbdc6f947d5b6b2afe5fe2fbf00..85ede867044d2d4bccd1340283f0a735b7391139 100644 (file)
@@ -2,9 +2,13 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
+import { Dispatch } from "redux";
 import { bindDataExplorerActions } from "../data-explorer/data-explorer-action";
 
 export const FAVORITE_PANEL_ID = "favoritePanel";
 export const favoritePanelActions = bindDataExplorerActions(FAVORITE_PANEL_ID);
 
-export const loadFavoritePanel = () => favoritePanelActions.REQUEST_ITEMS();
+export const loadFavoritePanel = () => (dispatch: Dispatch) => {
+    dispatch(favoritePanelActions.RESET_EXPLORER_SEARCH_VALUE());
+    dispatch(favoritePanelActions.REQUEST_ITEMS());
+};
\ No newline at end of file
index 6e63702e57ec676a009d21ceb691da519f1e480b..203bf44658f77e1bb600edccbbb114ff4980d392 100644 (file)
@@ -25,7 +25,10 @@ export const GROUP_REMOVE_DIALOG = 'groupRemoveDialog';
 
 export const GroupsPanelActions = bindDataExplorerActions(GROUPS_PANEL_ID);
 
-export const loadGroupsPanel = () => GroupsPanelActions.REQUEST_ITEMS();
+export const loadGroupsPanel = () => (dispatch: Dispatch) => {
+    dispatch(GroupsPanelActions.RESET_EXPLORER_SEARCH_VALUE());
+    dispatch(GroupsPanelActions.REQUEST_ITEMS());
+};
 
 export const openCreateGroupDialog = () =>
     (dispatch: Dispatch, getState: () => RootState) => {
@@ -113,7 +116,7 @@ export const createGroup = ({ name, users = [], description }: ProjectUpdateForm
             }
             dispatch(dialogActions.CLOSE_DIALOG({ id: PROJECT_CREATE_FORM_NAME }));
             dispatch(reset(PROJECT_CREATE_FORM_NAME));
-            dispatch(loadGroupsPanel());
+            dispatch<any>(loadGroupsPanel());
             dispatch(snackbarActions.OPEN_SNACKBAR({
                 message: `${newGroup.name} group has been created`,
                 kind: SnackbarKind.SUCCESS
index 3079e0ec220e7bdc380735b00ff6672030b8146a..3b30f4aab5e3577fdc5c3f3632b7fb0dd60f9f50 100644 (file)
@@ -16,10 +16,11 @@ export const projectPanelActions = bindDataExplorerActions(PROJECT_PANEL_ID);
 export const openProjectPanel = (projectUuid: string) =>
     (dispatch: Dispatch) => {
         dispatch(propertiesActions.SET_PROPERTY({ key: PROJECT_PANEL_CURRENT_UUID, value: projectUuid }));
+        dispatch(projectPanelActions.RESET_EXPLORER_SEARCH_VALUE());
         dispatch(projectPanelActions.REQUEST_ITEMS());
     };
 
 export const getProjectPanelCurrentUuid = (state: RootState) => getProperty<string>(PROJECT_PANEL_CURRENT_UUID)(state.properties);
 
-export const setIsProjectPanelTrashed = (isTrashed: boolean) => 
+export const setIsProjectPanelTrashed = (isTrashed: boolean) =>
     propertiesActions.SET_PROPERTY({ key: IS_PROJECT_PANEL_TRASHED, value: isTrashed });
index bc0fc3297d574630db28f515ff7cf32673fcad8b..6e36e1f8b92e2200536bf646f4e3a827a52ac234 100644 (file)
@@ -2,9 +2,13 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
+import { Dispatch } from "redux";
 import { bindDataExplorerActions } from "store/data-explorer/data-explorer-action";
 
 export const PUBLIC_FAVORITE_PANEL_ID = "publicFavoritePanel";
 export const publicFavoritePanelActions = bindDataExplorerActions(PUBLIC_FAVORITE_PANEL_ID);
 
-export const loadPublicFavoritePanel = () => publicFavoritePanelActions.REQUEST_ITEMS();
\ No newline at end of file
+export const loadPublicFavoritePanel = () => (dispatch: Dispatch) => {
+    dispatch(publicFavoritePanelActions.RESET_EXPLORER_SEARCH_VALUE());
+    dispatch(publicFavoritePanelActions.REQUEST_ITEMS());
+};
\ No newline at end of file
index c8731ae68e55e9455eb00cbbd13915d464022eb3..616bd005de301c801fddd8c32b6f8f9c1666c3ff 100644 (file)
@@ -2,8 +2,12 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
+import { Dispatch } from "redux";
 import { bindDataExplorerActions } from "../data-explorer/data-explorer-action";
 
 export const SHARED_WITH_ME_PANEL_ID = "sharedWithMePanel";
 export const sharedWithMePanelActions = bindDataExplorerActions(SHARED_WITH_ME_PANEL_ID);
-export const loadSharedWithMePanel = () => sharedWithMePanelActions.REQUEST_ITEMS();
+export const loadSharedWithMePanel = () => (dispatch: Dispatch) => {
+    dispatch(sharedWithMePanelActions.RESET_EXPLORER_SEARCH_VALUE());
+    dispatch(sharedWithMePanelActions.REQUEST_ITEMS());
+};
\ No newline at end of file
index 80321b040402c567f276c323468a7be3d09e3894..78b1a9729dc441c3bc94ef9bb10fbd68599b621d 100644 (file)
@@ -2,9 +2,13 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
+import { Dispatch } from "redux";
 import { bindDataExplorerActions } from "store/data-explorer/data-explorer-action";
 
 export const TRASH_PANEL_ID = "trashPanel";
 export const trashPanelActions = bindDataExplorerActions(TRASH_PANEL_ID);
 
-export const loadTrashPanel = () => trashPanelActions.REQUEST_ITEMS();
+export const loadTrashPanel = () => (dispatch: Dispatch) => {
+    dispatch(trashPanelActions.RESET_EXPLORER_SEARCH_VALUE());
+    dispatch(trashPanelActions.REQUEST_ITEMS());
+};
\ No newline at end of file
index b553b324e5aea7298f26845485ab75f3fe1f0f32..4c789dbeede4fda3f97f61b6ed32286f120a5d2c 100644 (file)
@@ -148,6 +148,7 @@ export const toggleIsAdmin = (uuid: string) =>
 
 export const loadUsersPanel = () =>
     (dispatch: Dispatch) => {
+        dispatch(userBindedActions.RESET_EXPLORER_SEARCH_VALUE());
         dispatch(userBindedActions.REQUEST_ITEMS());
     };