X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/da3ae51b7b3b63561a9e1c47c965f45a08225d34..8623f430ea556381f8681c2aea00e43e64d3f6d1:/src/views-components/search-bar/search-bar.tsx?ds=sidebyside

diff --git a/src/views-components/search-bar/search-bar.tsx b/src/views-components/search-bar/search-bar.tsx
index e9ebc7c7..e60b2141 100644
--- a/src/views-components/search-bar/search-bar.tsx
+++ b/src/views-components/search-bar/search-bar.tsx
@@ -5,23 +5,48 @@
 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 { saveRecentQuery, loadRecentQueries } from '~/store/search-bar/search-bar-actions';
+import {
+    goToView,
+    searchData,
+    deleteSavedQuery,
+    loadRecentQueries,
+    openSearchView,
+    closeSearchView,
+    closeAdvanceView,
+    navigateToItem,
+    editSavedQuery,
+    changeData,
+    submitData, moveUp, moveDown
+} 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,
+        selectedItem: searchBar.selectedItem,
+        savedQueries: searchBar.savedQueries,
+        tags: form.searchBarAdvanceFormName
     };
 };
 
-const mapDispatchToProps = (dispatch: Dispatch) => ({
+const mapDispatchToProps = (dispatch: Dispatch): SearchBarActionProps => ({
+    onSearch: (valueSearch: string) => dispatch<any>(searchData(valueSearch)),
+    onChange: (event: React.ChangeEvent<HTMLInputElement>) => dispatch<any>(changeData(event.target.value)),
     onSetView: (currentView: string) => dispatch(goToView(currentView)),
-    openView: () => dispatch<any>(searchBarActions.OPEN_SEARCH_VIEW()),
-    closeView: () => dispatch<any>(searchBarActions.CLOSE_SEARCH_VIEW()),
-    saveQuery: (query: string) => dispatch<any>(saveRecentQuery(query)),
-    loadQueries: () => dispatch<any>(loadRecentQueries())
+    onSubmit: (event: React.FormEvent<HTMLFormElement>) => dispatch<any>(submitData(event)),
+    closeView: () => dispatch<any>(closeSearchView()),
+    closeAdvanceView: () => dispatch<any>(closeAdvanceView()),
+    loadRecentQueries: () => dispatch<any>(loadRecentQueries()),
+    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)),
+    moveUp: () => dispatch<any>(moveUp()),
+    moveDown: () => dispatch<any>(moveDown())
 });
 
-export const SearchBar = connect(mapStateToProps, mapDispatchToProps)(SearchBarView);
\ No newline at end of file
+export const SearchBar = connect(mapStateToProps, mapDispatchToProps)(SearchBarView);
