From e2077e9659f5d186b740470a728766c34fd03a54 Mon Sep 17 00:00:00 2001 From: Ivana Huckova <30407135+ivanahuckova@users.noreply.github.com> Date: Thu, 8 Dec 2022 11:52:28 +0100 Subject: [PATCH] Dashboard: Run requests with correct app type (#60010) Dashboard: Run quries with correct core app --- public/app/features/dashboard/state/PanelModel.ts | 2 ++ public/app/features/query/state/PanelQueryRunner.ts | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/public/app/features/dashboard/state/PanelModel.ts b/public/app/features/dashboard/state/PanelModel.ts index da359a94c3f..f8b584b794f 100644 --- a/public/app/features/dashboard/state/PanelModel.ts +++ b/public/app/features/dashboard/state/PanelModel.ts @@ -16,6 +16,7 @@ import { urlUtil, PanelModel as IPanelModel, DataSourceRef, + CoreApp, } from '@grafana/data'; import { getTemplateSrv, RefreshEvent } from '@grafana/runtime'; import config from 'app/core/config'; @@ -366,6 +367,7 @@ export class PanelModel implements DataConfigSource, IPanelModel { scopedVars: this.scopedVars, cacheTimeout: this.cacheTimeout, transformations: this.transformations, + app: this.isEditing ? CoreApp.PanelEditor : this.isViewing ? CoreApp.PanelViewer : CoreApp.Dashboard, }); } diff --git a/public/app/features/query/state/PanelQueryRunner.ts b/public/app/features/query/state/PanelQueryRunner.ts index 3f3a2c480b8..9509d089e13 100644 --- a/public/app/features/query/state/PanelQueryRunner.ts +++ b/public/app/features/query/state/PanelQueryRunner.ts @@ -58,6 +58,7 @@ export interface QueryRunnerOptions< scopedVars?: ScopedVars; cacheTimeout?: string | null; transformations?: DataTransformerConfig[]; + app?: CoreApp; } let counter = 100; @@ -213,6 +214,7 @@ export class PanelQueryRunner { maxDataPoints, scopedVars, minInterval, + app, } = options; if (isSharedDashboardQuery(datasource)) { @@ -221,7 +223,7 @@ export class PanelQueryRunner { } const request: DataQueryRequest = { - app: CoreApp.Dashboard, + app: app ?? CoreApp.Dashboard, requestId: getNextRequestId(), timezone, panelId,