X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/3a530766c12a5677e6b5f8c54cd3a61f8e6934b4..2cfb56ef5060cbad461062690fad650f15c49731:/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..5208a7d6 100644 --- a/src/views-components/search-bar/search-bar.tsx +++ b/src/views-components/search-bar/search-bar.tsx @@ -5,20 +5,40 @@ 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 { + goToView, + searchData, + deleteSavedQuery, + saveRecentQuery, + loadRecentQueries, + saveQuery, + openSearchView, + closeSearchView, + navigateToItem +} from '~/store/search-bar/search-bar-actions'; import { SearchBarView } from '~/views-components/search-bar/search-bar-view'; +import { SearchBarAdvanceFormData } from '~/models/search-bar'; const mapStateToProps = ({ searchBar }: RootState) => { return { + searchValue: searchBar.searchValue, currentView: searchBar.currentView, - open: searchBar.open + isPopoverOpen: searchBar.open, + searchResults: searchBar.searchResults, + savedQueries: searchBar.savedQueries }; }; const mapDispatchToProps = (dispatch: Dispatch) => ({ + onSearch: (valueSearch: string) => dispatch(searchData(valueSearch)), onSetView: (currentView: string) => dispatch(goToView(currentView)), - openView: () => dispatch(searchBarActions.OPEN_SEARCH_VIEW()), - closeView: () => dispatch(searchBarActions.CLOSE_SEARCH_VIEW()) + closeView: () => dispatch(closeSearchView()), + saveRecentQuery: (query: string) => dispatch(saveRecentQuery(query)), + loadRecentQueries: () => dispatch(loadRecentQueries()), + saveQuery: (data: SearchBarAdvanceFormData) => dispatch(saveQuery(data)), + deleteSavedQuery: (id: number) => dispatch(deleteSavedQuery(id)), + openSearchView: () => dispatch(openSearchView()), + navigateTo: (uuid: string) => dispatch(navigateToItem(uuid)) }); export const SearchBar = connect(mapStateToProps, mapDispatchToProps)(SearchBarView); \ No newline at end of file