19865: Adds search value reset action to DataExplorer.
authorLucas Di Pentima <lucas.dipentima@curii.com>
Thu, 12 Jan 2023 21:35:12 +0000 (18:35 -0300)
committerLucas Di Pentima <lucas.dipentima@curii.com>
Thu, 12 Jan 2023 21:35:12 +0000 (18:35 -0300)
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 <lucas.dipentima@curii.com>

src/components/data-explorer/data-explorer.tsx
src/store/data-explorer/data-explorer-action.ts
src/store/data-explorer/data-explorer-reducer.ts

index ff0b6fc7179c58b565197fe18c059589352e59e7..0785f2e6cd8b7c1f3fd7402408db671cc684852d 100644 (file)
@@ -172,7 +172,7 @@ export const DataExplorer = withStyles(styles)(
                                         {!hideSearchInput && <SearchInput
                                             label={searchLabel}
                                             value={searchValue}
-                                            selfClearProp={this.props.currentRoute || ''}
+                                            selfClearProp={''}
                                             onSearch={onSearch} />}
                                     </div>}
                                     {actions}
index 7ba8225d5b6a7c3754f1f45c5f2657f9644516ea..7ee3962c38b6c437c07591d8a6184c1ea40fe5f0 100644 (file)
@@ -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 })
 });
index 1e875054b7bb9a4c18dc578438c8a662ee6a1abc..68f80b3cfcff16f13269cf267c49dbb530ec1bef 100644 (file)
@@ -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 })),