[ARVADOS-WORKBENCH2] updated: 1.2.0-679-g2faacbe

Git user git at public.curoverse.com
Tue Oct 16 09:09:06 EDT 2018


Summary of changes:
 src/store/search-bar/search-bar-actions.ts         | 26 +++++++++++++++++++---
 .../search-bar/search-bar-view.tsx                 |  3 ++-
 src/views-components/search-bar/search-bar.tsx     |  4 +++-
 3 files changed, 28 insertions(+), 5 deletions(-)

       via  2faacbe1f132f9349420e52e829d884044550fa4 (commit)
      from  bbae3d0a495137dcce657f889c7f4cd4b50a55ff (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 2faacbe1f132f9349420e52e829d884044550fa4
Author: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>
Date:   Tue Oct 16 15:08:54 2018 +0200

    autocomplete fixed
    
    Feature #14277
    
    Arvados-DCO-1.1-Signed-off-by: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>

diff --git a/src/store/search-bar/search-bar-actions.ts b/src/store/search-bar/search-bar-actions.ts
index e73db64..2541e7a 100644
--- a/src/store/search-bar/search-bar-actions.ts
+++ b/src/store/search-bar/search-bar-actions.ts
@@ -47,21 +47,21 @@ export const loadRecentQueries = () =>
         return recentSearchQueries || [];
     };
 
-    // Todo: create ids for particular searchQuery
+// Todo: create ids for particular searchQuery
 export const saveQuery = (data: SearchBarAdvanceFormData) =>
     (dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
         const savedSearchQueries = services.searchService.getSavedQueries();
         const filteredQuery = savedSearchQueries.find(query => query.searchQuery === data.searchQuery);
         if (data.saveQuery && data.searchQuery) {
             if (filteredQuery) {
-                services.searchService.editSavedQueries(data);   
+                services.searchService.editSavedQueries(data);
                 dispatch(searchBarActions.UPDATE_SAVED_QUERY(savedSearchQueries));
                 dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Query has been sucessfully updated', hideDuration: 2000, kind: SnackbarKind.SUCCESS }));
             } else {
                 services.searchService.saveQuery(data);
                 dispatch(searchBarActions.SET_SAVED_QUERIES(savedSearchQueries));
                 dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Query has been sucessfully saved', hideDuration: 2000, kind: SnackbarKind.SUCCESS }));
-            }  
+            }
         }
         dispatch(searchBarActions.SET_CURRENT_VIEW(SearchView.BASIC));
         dispatch(searchBarActions.CLOSE_SEARCH_VIEW());
@@ -121,6 +121,26 @@ export const searchData = (searchValue: string) =>
             });
             dispatch(searchBarActions.SET_SEARCH_RESULTS(items));
         }
+        if (currentView !== SearchView.AUTOCOMPLETE) {
+            dispatch(navigateToSearchResults);
+        }
+        
+    };
+
+export const searchDataOnEnter = (searchValue: string) =>
+    async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+        dispatch(searchBarActions.CLOSE_SEARCH_VIEW());
+        dispatch(searchBarActions.SET_SEARCH_VALUE(searchValue));
+        dispatch(searchBarActions.SET_SEARCH_RESULTS([]));
+        if (searchValue) {
+            const filters = getFilters('name', searchValue);
+            const { items } = await services.groupsService.contents('', {
+                filters,
+                limit: 5,
+                recursive: true
+            });
+            dispatch(searchBarActions.SET_SEARCH_RESULTS(items));
+        }
         dispatch(navigateToSearchResults);
     };
 
diff --git a/src/views-components/search-bar/search-bar-view.tsx b/src/views-components/search-bar/search-bar-view.tsx
index 3d15801..cfaee6d 100644
--- a/src/views-components/search-bar/search-bar-view.tsx
+++ b/src/views-components/search-bar/search-bar-view.tsx
@@ -58,6 +58,7 @@ type SearchBarDataProps = {
 
 interface SearchBarActionProps {
     onSearch: (value: string) => any;
+    searchDataOnEnter: (value: string) => void;
     debounce?: number;
     onSetView: (currentView: string) => void;
     closeView: () => void;
@@ -201,7 +202,7 @@ export const SearchBarView = withStyles(styles)(
             event.preventDefault();
             clearTimeout(this.timeout);
             this.props.saveRecentQuery(this.state.value);
-            this.props.onSearch(this.state.value);
+            this.props.searchDataOnEnter(this.state.value);
             this.props.loadRecentQueries();
         }
 
diff --git a/src/views-components/search-bar/search-bar.tsx b/src/views-components/search-bar/search-bar.tsx
index 2d487e0..7c3d260 100644
--- a/src/views-components/search-bar/search-bar.tsx
+++ b/src/views-components/search-bar/search-bar.tsx
@@ -19,6 +19,7 @@ import {
 } from '~/store/search-bar/search-bar-actions';
 import { SearchBarView } from '~/views-components/search-bar/search-bar-view';
 import { SearchBarAdvanceFormData } from '~/models/search-bar';
+import { searchDataOnEnter } from '../../store/search-bar/search-bar-actions';
 
 const mapStateToProps = ({ searchBar }: RootState) => {
     return {
@@ -40,7 +41,8 @@ const mapDispatchToProps = (dispatch: Dispatch) => ({
     deleteSavedQuery: (id: number) => dispatch<any>(deleteSavedQuery(id)),
     openSearchView: () => dispatch<any>(openSearchView()),
     navigateTo: (uuid: string) => dispatch<any>(navigateToItem(uuid)),
-    editSavedQuery: (data: SearchBarAdvanceFormData) => dispatch<any>(editSavedQuery(data))
+    editSavedQuery: (data: SearchBarAdvanceFormData) => dispatch<any>(editSavedQuery(data)),
+    searchDataOnEnter: (searchValue: string) => dispatch<any>(searchDataOnEnter(searchValue))
 });
 
 export const SearchBar = connect(mapStateToProps, mapDispatchToProps)(SearchBarView);
\ No newline at end of file

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list