From 6f38883583c4c43af149f68db482b39a3240ec95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Wed, 30 Jun 2021 10:36:05 +0200 Subject: [PATCH] Graph: Workaround for DashboardQueryRunner race condition (#36254) * Graph: Workaround for DashboardQueryRunner race condition * Removed deepClone --- public/app/features/panel/metrics_panel_ctrl.ts | 8 ++++---- public/app/plugins/panel/graph/module.ts | 4 ---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/public/app/features/panel/metrics_panel_ctrl.ts b/public/app/features/panel/metrics_panel_ctrl.ts index 22c0471ea2e..80bf76b7bca 100644 --- a/public/app/features/panel/metrics_panel_ctrl.ts +++ b/public/app/features/panel/metrics_panel_ctrl.ts @@ -20,11 +20,12 @@ import { PanelQueryRunner } from '../query/state/PanelQueryRunner'; class MetricsPanelCtrl extends PanelCtrl { declare datasource: DataSourceApi; + declare range: TimeRange; + contextSrv: ContextSrv; datasourceSrv: any; timeSrv: any; templateSrv: any; - declare range: TimeRange; interval: any; intervalMs: any; resolution: any; @@ -98,7 +99,6 @@ class MetricsPanelCtrl extends PanelCtrl { // load datasource service return this.datasourceSrv .get(this.panel.datasource, this.panel.scopedVars) - .then(this.updateTimeRange.bind(this)) .then(this.issueQueries.bind(this)) .catch((err: any) => { this.processDataError(err); @@ -178,11 +178,11 @@ class MetricsPanelCtrl extends PanelCtrl { const newTimeData = applyPanelTimeOverrides(this.panel, this.range); this.timeInfo = newTimeData.timeInfo; this.range = newTimeData.timeRange; - - return this.datasource; } issueQueries(datasource: DataSourceApi) { + this.updateTimeRange(datasource); + this.datasource = datasource; const panel = this.panel as PanelModel; diff --git a/public/app/plugins/panel/graph/module.ts b/public/app/plugins/panel/graph/module.ts index d64e395531d..09eb61c6811 100644 --- a/public/app/plugins/panel/graph/module.ts +++ b/public/app/plugins/panel/graph/module.ts @@ -184,10 +184,6 @@ export class GraphCtrl extends MetricsPanelCtrl { actions.push({ text: 'Toggle legend', click: 'ctrl.toggleLegend()', shortcut: 'p l' }); } - issueQueries(datasource: any) { - return super.issueQueries(datasource); - } - zoomOut(evt: any) { appEvents.publish(new ZoomOutEvent(2)); }