From 4a2a2b163b0055f23b69fe3f1a12057e26fb3556 Mon Sep 17 00:00:00 2001 From: Ryan McKinley Date: Tue, 7 Apr 2020 13:58:08 -0700 Subject: [PATCH] Query: make queryType a top level property (#23412) --- packages/grafana-data/src/types/datasource.ts | 12 +++++++++++- .../grafana-azure-monitor-datasource/types.ts | 1 - public/app/plugins/datasource/stackdriver/types.ts | 3 +-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/packages/grafana-data/src/types/datasource.ts b/packages/grafana-data/src/types/datasource.ts index 1d588ad8872..e68973ce22a 100644 --- a/packages/grafana-data/src/types/datasource.ts +++ b/packages/grafana-data/src/types/datasource.ts @@ -370,6 +370,11 @@ export interface DataQueryResponse { state?: LoadingState; } +/** + * These are the common properties avaliable to all queries in all datasources + * Specific implementations will extend this interface adding the required properties + * for the given context + */ export interface DataQuery { /** * A - Z @@ -377,7 +382,7 @@ export interface DataQuery { refId: string; /** - * true if query is disabled (ie not executed / sent to TSDB) + * true if query is disabled (ie should not be returned to the dashboard) */ hide?: boolean; @@ -386,6 +391,11 @@ export interface DataQuery { */ key?: string; + /** + * Specify the query flavor + */ + queryType?: string; + /** * For mixed data sources the selected datasource is on the query level. * For non mixed scenarios this is undefined. diff --git a/public/app/plugins/datasource/grafana-azure-monitor-datasource/types.ts b/public/app/plugins/datasource/grafana-azure-monitor-datasource/types.ts index 88ac403127c..71811845e72 100644 --- a/public/app/plugins/datasource/grafana-azure-monitor-datasource/types.ts +++ b/public/app/plugins/datasource/grafana-azure-monitor-datasource/types.ts @@ -3,7 +3,6 @@ import { DataQuery, DataSourceJsonData, DataSourceSettings } from '@grafana/data export type AzureDataSourceSettings = DataSourceSettings; export interface AzureMonitorQuery extends DataQuery { - refId: string; format: string; subscription: string; azureMonitor: AzureMetricQuery; diff --git a/public/app/plugins/datasource/stackdriver/types.ts b/public/app/plugins/datasource/stackdriver/types.ts index 8708476e276..09cdd2da9f4 100644 --- a/public/app/plugins/datasource/stackdriver/types.ts +++ b/public/app/plugins/datasource/stackdriver/types.ts @@ -78,8 +78,7 @@ export interface SLOQuery { } export interface StackdriverQuery extends DataQuery { - datasourceId?: number; - refId: string; + datasourceId?: number; // Should not be necessary anymore queryType: QueryType; metricQuery: MetricQuery; sloQuery?: SLOQuery;