Runtime: remove updateLocation from window context (#42857)

This commit is contained in:
Ryan McKinley 2021-12-07 20:01:35 -08:00 committed by GitHub
parent fb05f253d4
commit e9d2b25db3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,7 +1,6 @@
import { UrlQueryMap, PanelData } from '@grafana/data'; import { PanelData } from '@grafana/data';
import { getLocationSrv } from '@grafana/runtime'; import { getDashboardSrv } from 'app/features/dashboard/services/DashboardSrv';
import { getDashboardSrv } from '../dashboard/services/DashboardSrv'; import { getTimeSrv } from 'app/features/dashboard/services/TimeSrv';
import { getTimeSrv } from '../dashboard/services/TimeSrv';
/** /**
* This will setup features that are accessible through the root window location * This will setup features that are accessible through the root window location
@ -12,19 +11,6 @@ import { getTimeSrv } from '../dashboard/services/TimeSrv';
*/ */
export function initWindowRuntime() { export function initWindowRuntime() {
(window as any).grafanaRuntime = { (window as any).grafanaRuntime = {
/** Navigate the page within the currently loaded application */
updateLocation: (path: string, query?: UrlQueryMap) => {
if (query?.theme) {
throw new Error(`chaning theme requires full page refresh`);
}
getLocationSrv().update({
path,
query,
replace: true,
partial: false,
});
},
/** Get info for the current dashboard. This will include the migrated dashboard JSON */ /** Get info for the current dashboard. This will include the migrated dashboard JSON */
getDashboardSaveModel: () => { getDashboardSaveModel: () => {
const d = getDashboardSrv().getCurrent(); const d = getDashboardSrv().getCurrent();