X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/00ddf216e1a5046a858b1c8b49f0e967404474ca..a94211e27f3eebaea55ccba096869f70161e74ad:/src/views-components/search-bar/search-bar.tsx

diff --git a/src/views-components/search-bar/search-bar.tsx b/src/views-components/search-bar/search-bar.tsx
index affd5e4c..6ca588a7 100644
--- a/src/views-components/search-bar/search-bar.tsx
+++ b/src/views-components/search-bar/search-bar.tsx
@@ -5,20 +5,45 @@
 import { connect } from 'react-redux';
 import { RootState } from '~/store/store';
 import { Dispatch } from 'redux';
-import { goToView, searchBarActions } from '~/store/search-bar/search-bar-actions';
-import { SearchBarView } from '~/views-components/search-bar/search-bar-view';
+import {
+    goToView,
+    searchData,
+    deleteSavedQuery,
+    saveRecentQuery,
+    loadRecentQueries,
+    saveQuery,
+    openSearchView,
+    closeSearchView,
+    navigateToItem,
+    editSavedQuery,
+    searchDataOnEnter
+} from '~/store/search-bar/search-bar-actions';
+import { SearchBarView, SearchBarActionProps, SearchBarDataProps } from '~/views-components/search-bar/search-bar-view';
+import { SearchBarAdvanceFormData } from '~/models/search-bar';
 
-const mapStateToProps = ({ searchBar }: RootState) => {
+const mapStateToProps = ({ searchBar, form }: RootState): SearchBarDataProps => {
     return {
+        searchValue: searchBar.searchValue,
         currentView: searchBar.currentView,
-        open: searchBar.open
+        isPopoverOpen: searchBar.open,
+        searchResults: searchBar.searchResults,
+        savedQueries: searchBar.savedQueries,
+        tags: form.searchBarAdvanceFormName
     };
 };
 
-const mapDispatchToProps = (dispatch: Dispatch) => ({
+const mapDispatchToProps = (dispatch: Dispatch): SearchBarActionProps => ({
+    onSearch: (valueSearch: string) => dispatch<any>(searchData(valueSearch)),
     onSetView: (currentView: string) => dispatch(goToView(currentView)),
-    openView: () => dispatch<any>(searchBarActions.OPEN_SEARCH_VIEW()),
-    closeView: () => dispatch<any>(searchBarActions.CLOSE_SEARCH_VIEW())
+    closeView: () => dispatch<any>(closeSearchView()),
+    saveRecentQuery: (query: string) => dispatch<any>(saveRecentQuery(query)),
+    loadRecentQueries: () => dispatch<any>(loadRecentQueries()),
+    saveQuery: (data: SearchBarAdvanceFormData) => dispatch<any>(saveQuery(data)),
+    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)),
+    searchDataOnEnter: (searchValue: string) => dispatch<any>(searchDataOnEnter(searchValue))
 });
 
 export const SearchBar = connect(mapStateToProps, mapDispatchToProps)(SearchBarView);
\ No newline at end of file
