diff --git a/public/app/core/services/keybindingSrv.ts b/public/app/core/services/keybindingSrv.ts index b1700f3d33d..0cdfa731f92 100644 --- a/public/app/core/services/keybindingSrv.ts +++ b/public/app/core/services/keybindingSrv.ts @@ -3,6 +3,7 @@ import _ from 'lodash'; import coreModule from 'app/core/core_module'; import appEvents from 'app/core/app_events'; import { getExploreUrl } from 'app/core/utils/explore'; +import locationUtil from 'app/core/utils/location_util'; import { store } from 'app/store/store'; import Mousetrap from 'mousetrap'; @@ -220,8 +221,10 @@ export class KeybindingSrv { const panel = dashboard.getPanelById(dashboard.meta.focusPanelId); const datasource = await this.datasourceSrv.get(panel.datasource); const url = await getExploreUrl(panel, panel.targets, datasource, this.datasourceSrv, this.timeSrv); - if (url) { - this.$timeout(() => this.$location.url(url)); + const urlWithoutBase = locationUtil.stripBaseFromUrl(url); + + if (urlWithoutBase) { + this.$timeout(() => this.$location.url(urlWithoutBase)); } } }); diff --git a/public/app/core/utils/explore.ts b/public/app/core/utils/explore.ts index 493372f1bca..0f8a0db60c7 100644 --- a/public/app/core/utils/explore.ts +++ b/public/app/core/utils/explore.ts @@ -90,7 +90,8 @@ export async function getExploreUrl( const exploreState = JSON.stringify({ ...state, originPanelId: panel.id }); url = renderUrl('/explore', { left: exploreState }); } - return url; + const finalUrl = config.appSubUrl + url; + return finalUrl; } export function buildQueryTransaction( diff --git a/public/app/features/panel/metrics_panel_ctrl.ts b/public/app/features/panel/metrics_panel_ctrl.ts index ee13a440830..5dc612f86c7 100644 --- a/public/app/features/panel/metrics_panel_ctrl.ts +++ b/public/app/features/panel/metrics_panel_ctrl.ts @@ -251,13 +251,6 @@ class MetricsPanelCtrl extends PanelCtrl { } return items; } - - async explore() { - const url = await getExploreUrl(this.panel, this.panel.targets, this.datasource, this.datasourceSrv, this.timeSrv); - if (url) { - this.$timeout(() => this.$location.url(url)); - } - } } export { MetricsPanelCtrl }; diff --git a/public/app/features/panel/specs/metrics_panel_ctrl.test.ts b/public/app/features/panel/specs/metrics_panel_ctrl.test.ts index 061f361880e..3acbb694b74 100644 --- a/public/app/features/panel/specs/metrics_panel_ctrl.test.ts +++ b/public/app/features/panel/specs/metrics_panel_ctrl.test.ts @@ -10,6 +10,9 @@ jest.mock('app/core/config', () => { name: 'test', }, }, + config: { + appSubUrl: 'test', + }, }; });