|
|
|
@ -12,6 +12,7 @@ import { |
|
|
|
|
LiveChannelScope, |
|
|
|
|
LoadingState, |
|
|
|
|
TimeRange, |
|
|
|
|
ScopedVars, |
|
|
|
|
} from '@grafana/data'; |
|
|
|
|
import { Scenario, TestDataQuery } from './types'; |
|
|
|
|
import { DataSourceWithBackend, getBackendSrv, getGrafanaLiveSrv, getTemplateSrv, TemplateSrv } from '@grafana/runtime'; |
|
|
|
@ -42,6 +43,8 @@ export class TestDataDataSource extends DataSourceWithBackend<TestDataQuery> { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
this.resolveTemplateVariables(target, options.scopedVars); |
|
|
|
|
|
|
|
|
|
switch (target.scenarioId) { |
|
|
|
|
case 'live': |
|
|
|
|
streams.push(runGrafanaLiveQuery(target, options)); |
|
|
|
@ -98,6 +101,10 @@ export class TestDataDataSource extends DataSourceWithBackend<TestDataQuery> { |
|
|
|
|
return merge(...streams); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
resolveTemplateVariables(query: TestDataQuery, scopedVars: ScopedVars) { |
|
|
|
|
query.labels = this.templateSrv.replace(query.labels!, scopedVars); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
annotationDataTopicTest(target: TestDataQuery, req: DataQueryRequest<TestDataQuery>): Observable<DataQueryResponse> { |
|
|
|
|
const events = this.buildFakeAnnotationEvents(req.range, 10); |
|
|
|
|
const dataFrame = new ArrayDataFrame(events); |
|
|
|
|