Chore: define base panel type in @grafana/data (#37766)

This commit is contained in:
Ryan McKinley
2021-08-11 00:23:41 -07:00
committed by GitHub
parent 7a8e861c1f
commit 36c798eb2f
14 changed files with 117 additions and 69 deletions

View File

@@ -8,6 +8,7 @@ import {
DataQueryResponse,
DataSourceApi,
DataSourceInstanceSettings,
DatasourceRef,
isValidLiveChannelAddress,
parseLiveChannelAddress,
StreamingFrameOptions,
@@ -17,6 +18,7 @@ import {
import { GrafanaAnnotationQuery, GrafanaAnnotationType, GrafanaQuery, GrafanaQueryType } from './types';
import AnnotationQueryEditor from './components/AnnotationQueryEditor';
import { getDashboardSrv } from '../../../features/dashboard/services/DashboardSrv';
import { isString } from 'lodash';
let counter = 100;
@@ -37,7 +39,11 @@ export class GrafanaDatasource extends DataSourceApi<GrafanaQuery> {
return json;
},
prepareQuery(anno: AnnotationQuery<GrafanaAnnotationQuery>): GrafanaQuery {
return { ...anno, refId: anno.name, queryType: GrafanaQueryType.Annotations };
let datasource: DatasourceRef | undefined | null = undefined;
if (isString(anno.datasource)) {
datasource = anno.datasource as DatasourceRef;
}
return { ...anno, refId: anno.name, queryType: GrafanaQueryType.Annotations, datasource };
},
};
}