Fix setting [object Object] in global search bar on typing in local search field
authorDaniel Kos <daniel.kos@contractors.roche.com>
Sun, 4 Nov 2018 21:53:40 +0000 (22:53 +0100)
committerDaniel Kos <daniel.kos@contractors.roche.com>
Sun, 4 Nov 2018 21:53:40 +0000 (22:53 +0100)
Bug #14432

Arvados-DCO-1.1-Signed-off-by: Daniel Kos <daniel.kos@contractors.roche.com>

src/store/data-explorer/data-explorer-action.ts
src/store/data-explorer/data-explorer-middleware.test.ts
src/store/data-explorer/data-explorer-middleware.ts
src/store/data-explorer/data-explorer-reducer.ts
src/views-components/data-explorer/data-explorer.tsx
src/views-components/search-bar/search-bar-autocomplete-view.tsx

index e637043dacde193f4af1983706289f1dc4b3255c..a58d20edb17eea49270caf32a5cc959bef7ecb82 100644 (file)
@@ -16,7 +16,7 @@ export const dataExplorerActions = unionize({
     SET_ROWS_PER_PAGE: ofType<{ id: string, rowsPerPage: number }>(),
     TOGGLE_COLUMN: ofType<{ id: string, columnName: string }>(),
     TOGGLE_SORT: ofType<{ id: string, columnName: string }>(),
-    SET_SEARCH_VALUE: ofType<{ id: string, searchValue: string }>(),
+    SET_EXPLORER_SEARCH_VALUE: ofType<{ id: string, searchValue: string }>(),
 });
 
 export type DataExplorerAction = UnionOf<typeof dataExplorerActions>;
@@ -40,6 +40,6 @@ export const bindDataExplorerActions = (id: string) => ({
         dataExplorerActions.TOGGLE_COLUMN({ ...payload, id }),
     TOGGLE_SORT: (payload: { columnName: string }) =>
         dataExplorerActions.TOGGLE_SORT({ ...payload, id }),
-    SET_SEARCH_VALUE: (payload: { searchValue: string }) =>
-        dataExplorerActions.SET_SEARCH_VALUE({ ...payload, id }),
+    SET_EXPLORER_SEARCH_VALUE: (payload: { searchValue: string }) =>
+        dataExplorerActions.SET_EXPLORER_SEARCH_VALUE({ ...payload, id }),
 });
index 2a88817cecc8ad9256b6ee9f33b3c212df83a78b..814d5855c0b6a45b0ee0224d73e382f13b561560 100644 (file)
@@ -169,7 +169,7 @@ describe("DataExplorerMiddleware", () => {
         };
         const next = jest.fn();
         const middleware = dataExplorerMiddleware(service)(api)(next);
-        middleware(dataExplorerActions.SET_SEARCH_VALUE({ id: service.getId(), searchValue: "" }));
+        middleware(dataExplorerActions.SET_EXPLORER_SEARCH_VALUE({ id: service.getId(), searchValue: "" }));
         expect(api.dispatch).toHaveBeenCalledTimes(2);
     });
 
index 3491862d49ce2f81d2156dbafeffdb42e0f62291..f90f9a6ce39d1ceddff638959544d1ec24c1d06c 100644 (file)
@@ -32,7 +32,7 @@ export const dataExplorerMiddleware = (service: DataExplorerMiddlewareService):
             TOGGLE_SORT: handleAction(() => {
                 api.dispatch(actions.REQUEST_ITEMS());
             }),
-            SET_SEARCH_VALUE: handleAction(() => {
+            SET_EXPLORER_SEARCH_VALUE: handleAction(() => {
                 api.dispatch(actions.RESET_PAGINATION());
                 api.dispatch(actions.REQUEST_ITEMS());
             }),
index d059d37af4639110170f848cf1badf4be411154a..141d1a9f20657e1a4a462dbe32b8dd583f817341 100644 (file)
@@ -50,7 +50,7 @@ export const dataExplorerReducer = (state: DataExplorerState = {}, action: DataE
         SET_ROWS_PER_PAGE: ({ id, rowsPerPage }) =>
             update(state, id, explorer => ({ ...explorer, rowsPerPage })),
 
-        SET_SEARCH_VALUE: ({ id, searchValue }) =>
+        SET_EXPLORER_SEARCH_VALUE: ({ id, searchValue }) =>
             update(state, id, explorer => ({ ...explorer, searchValue })),
 
         TOGGLE_SORT: ({ id, columnName }) =>
index 17f2c77b0a44fdd3b235b1625c9d0ddf39ba430f..59555707d11a2e509d886abf978b3ab4a2972580 100644 (file)
@@ -33,7 +33,7 @@ const mapDispatchToProps = () => {
         },
 
         onSearch: (searchValue: string) => {
-            dispatch(dataExplorerActions.SET_SEARCH_VALUE({ id, searchValue }));
+            dispatch(dataExplorerActions.SET_EXPLORER_SEARCH_VALUE({ id, searchValue }));
         },
 
         onColumnToggle: (column: DataColumn<any>) => {
index 4dab5db0890ab97acd5f46e69b29815504711903..e45197dd37280c710d28f3f2daf29130d396d3a8 100644 (file)
@@ -39,7 +39,6 @@ type SearchBarAutocompleteViewProps = SearchBarAutocompleteViewDataProps & Searc
 
 export const SearchBarAutocompleteView = withStyles(styles)(
     ({ classes, searchResults, searchValue, navigateTo, selectedItem }: SearchBarAutocompleteViewProps) => {
-        console.log(searchValue, selectedItem);
         return <Paper className={classes.searchView}>
             <List component="nav" className={classes.list}>
                 <ListItem button className={classes.listItem} selected={!selectedItem || searchValue === selectedItem.id}>