mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: define base panel type in @grafana/data (#37766)
This commit is contained in:
@@ -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 };
|
||||
},
|
||||
};
|
||||
}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { PanelModel, FieldConfigSource } from '@grafana/data';
|
||||
import { PanelModel, FieldConfigSource, DataQuery } from '@grafana/data';
|
||||
import { graphPanelMigrationHandler } from './GraphMigrations';
|
||||
|
||||
describe('Graph Panel Migrations', () => {
|
||||
@@ -52,7 +52,7 @@ describe('Graph Panel Migrations', () => {
|
||||
spaceLength: 10,
|
||||
stack: false,
|
||||
steppedLine: false,
|
||||
targets: [
|
||||
targets: ([
|
||||
{
|
||||
alias: 'Foo datacenter',
|
||||
labels: 'datacenter=foo,region=us-east-1',
|
||||
@@ -71,7 +71,7 @@ describe('Graph Panel Migrations', () => {
|
||||
refId: 'C',
|
||||
scenarioId: 'random_walk',
|
||||
},
|
||||
],
|
||||
] as unknown) as DataQuery[],
|
||||
thresholds: [],
|
||||
timeFrom: null,
|
||||
timeRegions: [],
|
||||
|
Reference in New Issue
Block a user