UNPKG

@grafana/runtime

Version:
1 lines 2.24 kB
{"version":3,"file":"LocationSrv.mjs","sources":["../../../src/services/LocationSrv.ts"],"sourcesContent":["import { UrlQueryMap } from '@grafana/data';\n\n/**\n * @public\n * @deprecated in favor of {@link locationService} and will be removed in Grafana 9\n */\nexport interface LocationUpdate {\n /**\n * Target path where you automatically wants to navigate the user.\n */\n path?: string;\n\n /**\n * Specify this value if you want to add values to the query string of the URL.\n */\n query?: UrlQueryMap;\n\n /**\n * If set to true, the query argument will be added to the existing URL.\n */\n partial?: boolean;\n\n /**\n * Used internally to sync the Redux state from Angular to make sure that the Redux location\n * state is in sync when navigating using the Angular router.\n *\n * @remarks\n * Do not change this unless you are the Angular router.\n *\n * @internal\n */\n routeParams?: UrlQueryMap;\n\n /*\n * If set to true, this will replace URL state (ie. cause no new browser history).\n */\n replace?: boolean;\n}\n\n/**\n * If you need to automatically navigate the user to a new place in the application this should\n * be done via the LocationSrv and it will make sure to update the application state accordingly.\n *\n * @public\n * @deprecated in favor of {@link locationService} and will be removed in Grafana 9\n */\nexport interface LocationSrv {\n update(options: LocationUpdate): void;\n}\n\nlet singletonInstance: LocationSrv;\n\n/**\n * Used during startup by Grafana to set the LocationSrv so it is available\n * via the {@link getLocationSrv} to the rest of the application.\n *\n * @internal\n */\nexport function setLocationSrv(instance: LocationSrv) {\n singletonInstance = instance;\n}\n\n/**\n * Used to retrieve the {@link LocationSrv} that can be used to automatically navigate\n * the user to a new place in Grafana.\n *\n * @public\n * @deprecated in favor of {@link locationService} and will be removed in Grafana 9\n */\nexport function getLocationSrv(): LocationSrv {\n return singletonInstance;\n}\n"],"names":[],"mappings":"AAkDA,IAAI,iBAAA;AAQG,SAAS,eAAe,QAAuB,EAAA;AACpD,EAAoB,iBAAA,GAAA,QAAA;AACtB;AASO,SAAS,cAA8B,GAAA;AAC5C,EAAO,OAAA,iBAAA;AACT;;;;"}