From fab044518170a23fe2455b8ac10e15fc91d58aea Mon Sep 17 00:00:00 2001 From: Lucas Di Pentima Date: Thu, 12 Jan 2023 18:35:12 -0300 Subject: [PATCH] 19865: Adds search value reset action to DataExplorer. Also, reverts the use of the 'selfClearProp' property on SearchInput to avoid unnecessary requests made from the inner component. Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima --- src/components/data-explorer/data-explorer.tsx | 2 +- src/store/data-explorer/data-explorer-action.ts | 3 +++ src/store/data-explorer/data-explorer-reducer.ts | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/components/data-explorer/data-explorer.tsx b/src/components/data-explorer/data-explorer.tsx index ff0b6fc7..0785f2e6 100644 --- a/src/components/data-explorer/data-explorer.tsx +++ b/src/components/data-explorer/data-explorer.tsx @@ -172,7 +172,7 @@ export const DataExplorer = withStyles(styles)( {!hideSearchInput && } } {actions} diff --git a/src/store/data-explorer/data-explorer-action.ts b/src/store/data-explorer/data-explorer-action.ts index 7ba8225d..7ee3962c 100644 --- a/src/store/data-explorer/data-explorer-action.ts +++ b/src/store/data-explorer/data-explorer-action.ts @@ -27,6 +27,7 @@ export const dataExplorerActions = unionize({ TOGGLE_COLUMN: ofType<{ id: string, columnName: string }>(), TOGGLE_SORT: ofType<{ id: string, columnName: string }>(), SET_EXPLORER_SEARCH_VALUE: ofType<{ id: string, searchValue: string }>(), + RESET_EXPLORER_SEARCH_VALUE: ofType<{ id: string }>(), SET_REQUEST_STATE: ofType<{ id: string, requestState: DataTableRequestState }>(), }); @@ -59,6 +60,8 @@ export const bindDataExplorerActions = (id: string) => ({ dataExplorerActions.TOGGLE_SORT({ ...payload, id }), SET_EXPLORER_SEARCH_VALUE: (payload: { searchValue: string }) => dataExplorerActions.SET_EXPLORER_SEARCH_VALUE({ ...payload, id }), + RESET_EXPLORER_SEARCH_VALUE: () => + dataExplorerActions.RESET_EXPLORER_SEARCH_VALUE({ id }), SET_REQUEST_STATE: (payload: { requestState: DataTableRequestState }) => dataExplorerActions.SET_REQUEST_STATE({ ...payload, id }) }); diff --git a/src/store/data-explorer/data-explorer-reducer.ts b/src/store/data-explorer/data-explorer-reducer.ts index 1e875054..68f80b3c 100644 --- a/src/store/data-explorer/data-explorer-reducer.ts +++ b/src/store/data-explorer/data-explorer-reducer.ts @@ -97,6 +97,9 @@ export const dataExplorerReducer = ( SET_EXPLORER_SEARCH_VALUE: ({ id, searchValue }) => update(state, id, (explorer) => ({ ...explorer, searchValue })), + RESET_EXPLORER_SEARCH_VALUE: ({ id }) => + update(state, id, (explorer) => ({ ...explorer, searchValue: '' })), + SET_REQUEST_STATE: ({ id, requestState }) => update(state, id, (explorer) => ({ ...explorer, requestState })), -- 2.30.2