X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/64b25cb874d430f23d169606265c9534a52bdc6c..77f285190a3ae77a1075b249ca964b1afeed7ca2:/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 8f39caec..41cf2916 100644
--- a/src/views-components/search-bar/search-bar.tsx
+++ b/src/views-components/search-bar/search-bar.tsx
@@ -9,41 +9,48 @@ import {
     goToView,
     searchData,
     deleteSavedQuery,
-    saveRecentQuery,
     loadRecentQueries,
-    saveQuery,
     openSearchView,
     closeSearchView,
+    closeAdvanceView,
     navigateToItem,
     editSavedQuery,
-    searchDataOnEnter
+    changeData,
+    submitData, moveUp, moveDown, setAdvancedDataFromSearchValue
 } from '~/store/search-bar/search-bar-actions';
-import { SearchBarView } from '~/views-components/search-bar/search-bar-view';
+import { SearchBarView, SearchBarActionProps, SearchBarDataProps } from '~/views-components/search-bar/search-bar-view';
 import { SearchBarAdvanceFormData } from '~/models/search-bar';
 
-const mapStateToProps = ({ searchBar, form }: RootState) => {
+const mapStateToProps = ({ searchBar, form }: RootState): SearchBarDataProps => {
     return {
         searchValue: searchBar.searchValue,
         currentView: searchBar.currentView,
         isPopoverOpen: searchBar.open,
         searchResults: searchBar.searchResults,
+        selectedItem: searchBar.selectedItem,
         savedQueries: searchBar.savedQueries,
-        tags: form.searchBarAdvanceFormName
+        tags: form.searchBarAdvanceFormName,
+        saveQuery: form.searchBarAdvanceFormName &&
+            form.searchBarAdvanceFormName.values &&
+            form.searchBarAdvanceFormName.values.saveQuery
     };
 };
 
-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)),
+    onSubmit: (event: React.FormEvent<HTMLFormElement>) => dispatch<any>(submitData(event)),
     closeView: () => dispatch<any>(closeSearchView()),
-    saveRecentQuery: (query: string) => dispatch<any>(saveRecentQuery(query)),
+    closeAdvanceView: () => dispatch<any>(closeAdvanceView()),
     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))
+    moveUp: () => dispatch<any>(moveUp()),
+    moveDown: () => dispatch<any>(moveDown()),
+    setAdvancedDataFromSearchValue: (search: string) => dispatch<any>(setAdvancedDataFromSearchValue(search))
 });
 
-export const SearchBar = connect(mapStateToProps, mapDispatchToProps)(SearchBarView);
\ No newline at end of file
+export const SearchBar = connect(mapStateToProps, mapDispatchToProps)(SearchBarView);
