mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Annotations: fixes variable values not displaying in annotations. (#37883)
* Fixes wrong annotation when opening dashboard with URL encoded variable Co-authored-by: Ashley Harrison, Hugo Haggmark, and Tobias Skarhed. * added a more descriptive comment
This commit is contained in:
@@ -155,8 +155,6 @@ export function initDashboard(args: InitDashboardArgs): ThunkResult<void> {
|
|||||||
dashboardSrv.setCurrent(dashboard);
|
dashboardSrv.setCurrent(dashboard);
|
||||||
|
|
||||||
timeSrv.init(dashboard);
|
timeSrv.init(dashboard);
|
||||||
const runner = createDashboardQueryRunner({ dashboard, timeSrv });
|
|
||||||
runner.run({ dashboard, range: timeSrv.timeRange() });
|
|
||||||
|
|
||||||
if (storeState.dashboard.modifiedQueries) {
|
if (storeState.dashboard.modifiedQueries) {
|
||||||
const { panelId, queries } = storeState.dashboard.modifiedQueries;
|
const { panelId, queries } = storeState.dashboard.modifiedQueries;
|
||||||
@@ -166,6 +164,11 @@ export function initDashboard(args: InitDashboardArgs): ThunkResult<void> {
|
|||||||
// template values service needs to initialize completely before the rest of the dashboard can load
|
// template values service needs to initialize completely before the rest of the dashboard can load
|
||||||
await dispatch(initVariablesTransaction(args.urlUid!, dashboard));
|
await dispatch(initVariablesTransaction(args.urlUid!, dashboard));
|
||||||
|
|
||||||
|
// DashboardQueryRunner needs to run after all variables have been resolved so that any annotation query including a variable
|
||||||
|
// will be correctly resolved
|
||||||
|
const runner = createDashboardQueryRunner({ dashboard, timeSrv });
|
||||||
|
runner.run({ dashboard, range: timeSrv.timeRange() });
|
||||||
|
|
||||||
if (getState().templating.transaction.uid !== args.urlUid) {
|
if (getState().templating.transaction.uid !== args.urlUid) {
|
||||||
// if a previous dashboard has slow running variable queries the batch uid will be the new one
|
// if a previous dashboard has slow running variable queries the batch uid will be the new one
|
||||||
// but the args.urlUid will be the same as before initVariablesTransaction was called so then we can't continue initializing
|
// but the args.urlUid will be the same as before initVariablesTransaction was called so then we can't continue initializing
|
||||||
|
|||||||
Reference in New Issue
Block a user