Commit 37a2ac20 by Tobias Skarhed Committed by GitHub

Search: Fix select item pressing enter 404 (#24634)

* Remove appSubUrl for navigation

* stripBaseFromUrl

* Remove unused imports
parent f1386c78
...@@ -5,6 +5,7 @@ import { MOVE_SELECTION_DOWN, MOVE_SELECTION_UP } from '../reducers/actionTypes' ...@@ -5,6 +5,7 @@ import { MOVE_SELECTION_DOWN, MOVE_SELECTION_UP } from '../reducers/actionTypes'
import { dashboardsSearchState, DashboardsSearchState, searchReducer } from '../reducers/dashboardSearch'; import { dashboardsSearchState, DashboardsSearchState, searchReducer } from '../reducers/dashboardSearch';
import { findSelected } from '../utils'; import { findSelected } from '../utils';
import { useSearch } from './useSearch'; import { useSearch } from './useSearch';
import { locationUtil } from '@grafana/data';
export const useDashboardSearch = (query: DashboardQuery, onCloseSearch: () => void) => { export const useDashboardSearch = (query: DashboardQuery, onCloseSearch: () => void) => {
const reducer = useReducer(searchReducer, dashboardsSearchState); const reducer = useReducer(searchReducer, dashboardsSearchState);
...@@ -31,7 +32,9 @@ export const useDashboardSearch = (query: DashboardQuery, onCloseSearch: () => v ...@@ -31,7 +32,9 @@ export const useDashboardSearch = (query: DashboardQuery, onCloseSearch: () => v
if (selectedItem.type === DashboardSearchItemType.DashFolder) { if (selectedItem.type === DashboardSearchItemType.DashFolder) {
onToggleSection(selectedItem as DashboardSection); onToggleSection(selectedItem as DashboardSection);
} else { } else {
getLocationSrv().update({ path: selectedItem.url }); getLocationSrv().update({
path: locationUtil.stripBaseFromUrl(selectedItem.url),
});
// Delay closing to prevent current page flicker // Delay closing to prevent current page flicker
setTimeout(onCloseSearch, 0); setTimeout(onCloseSearch, 0);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment