X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/36b4e36f75ea0035b6b0de6aaaad4edd3231371c..2c2339c775f9112f5da638b2beb81d8b6d5abc2b:/src/store/search-results-panel/search-results-panel-actions.ts diff --git a/src/store/search-results-panel/search-results-panel-actions.ts b/src/store/search-results-panel/search-results-panel-actions.ts index 05da5b3e..e1bcfa85 100644 --- a/src/store/search-results-panel/search-results-panel-actions.ts +++ b/src/store/search-results-panel/search-results-panel-actions.ts @@ -3,14 +3,27 @@ // SPDX-License-Identifier: AGPL-3.0 import { Dispatch } from 'redux'; -import { RootState } from '~/store/store'; -import { ServiceRepository } from '~/services/services'; -import { bindDataExplorerActions } from '~/store/data-explorer/data-explorer-action'; +import { RootState } from 'store/store'; +import { ServiceRepository } from 'services/services'; +import { bindDataExplorerActions } from 'store/data-explorer/data-explorer-action'; +import { setBreadcrumbs } from 'store/breadcrumbs/breadcrumbs-actions'; +import { searchBarActions } from 'store/search-bar/search-bar-actions'; export const SEARCH_RESULTS_PANEL_ID = "searchResultsPanel"; export const searchResultsPanelActions = bindDataExplorerActions(SEARCH_RESULTS_PANEL_ID); export const loadSearchResultsPanel = () => (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => { - dispatch(searchResultsPanelActions.REQUEST_ITEMS()); - }; \ No newline at end of file + dispatch(setBreadcrumbs([{ label: 'Search results' }])); + const loc = getState().router.location; + if (loc !== null) { + const search = new URLSearchParams(loc.search); + const q = search.get('q'); + if (q !== null) { + dispatch(searchBarActions.SET_SEARCH_VALUE(q)); + } + } + dispatch(searchBarActions.SET_SEARCH_RESULTS([])); + dispatch(searchResultsPanelActions.CLEAR()); + dispatch(searchResultsPanelActions.REQUEST_ITEMS(true)); + };