code refactoring and improve views
[arvados-workbench2.git] / src / views-components / search-bar / search-bar.tsx
index 7c3d2604a7a54072d1c089d256ae39a7c0895d16..6ca588a734b93c92a8ce0aa396e3d9d4d79bdd37 100644 (file)
@@ -15,23 +15,24 @@ import {
     openSearchView,
     closeSearchView,
     navigateToItem,
-    editSavedQuery
+    editSavedQuery,
+    searchDataOnEnter
 } 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';
-import { searchDataOnEnter } from '../../store/search-bar/search-bar-actions';
 
-const mapStateToProps = ({ searchBar }: RootState) => {
+const mapStateToProps = ({ searchBar, form }: RootState): SearchBarDataProps => {
     return {
         searchValue: searchBar.searchValue,
         currentView: searchBar.currentView,
         isPopoverOpen: searchBar.open,
         searchResults: searchBar.searchResults,
-        savedQueries: searchBar.savedQueries
+        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)),
     closeView: () => dispatch<any>(closeSearchView()),