mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Refactor: improvements to PanelQueryRunner (#16678)
merged DataQueryOptions + DataRequestInfo info: DataQueryRequest
This commit is contained in:
@@ -13,15 +13,23 @@ export enum FieldType {
|
||||
other = 'other', // Object, Array, etc
|
||||
}
|
||||
|
||||
export interface QueryResultMeta {
|
||||
[key: string]: any;
|
||||
|
||||
// Match the result to the query
|
||||
requestId?: string;
|
||||
}
|
||||
|
||||
export interface QueryResultBase {
|
||||
/**
|
||||
* Matches the query target refId
|
||||
*/
|
||||
refId?: string;
|
||||
|
||||
/**
|
||||
* Used by some backend datasources to communicate back info about the execution (generated sql, timing)
|
||||
*/
|
||||
meta?: any;
|
||||
meta?: QueryResultMeta;
|
||||
}
|
||||
|
||||
export interface Field {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ComponentClass } from 'react';
|
||||
import { TimeRange, RawTimeRange } from './time';
|
||||
import { TimeRange } from './time';
|
||||
import { PluginMeta } from './plugin';
|
||||
import { TableData, TimeSeries, SeriesData } from './data';
|
||||
|
||||
@@ -94,7 +94,7 @@ export interface DataSourceApi<TQuery extends DataQuery = DataQuery> {
|
||||
/**
|
||||
* Main metrics / data query action
|
||||
*/
|
||||
query(options: DataQueryOptions<TQuery>): Promise<DataQueryResponse>;
|
||||
query(options: DataQueryRequest<TQuery>): Promise<DataQueryResponse>;
|
||||
|
||||
/**
|
||||
* Test & verify datasource settings & connection details
|
||||
@@ -220,10 +220,11 @@ export interface ScopedVars {
|
||||
[key: string]: ScopedVar;
|
||||
}
|
||||
|
||||
export interface DataQueryOptions<TQuery extends DataQuery = DataQuery> {
|
||||
export interface DataQueryRequest<TQuery extends DataQuery = DataQuery> {
|
||||
requestId: string; // Used to identify results and optionally cancel the request in backendSrv
|
||||
timezone: string;
|
||||
range: TimeRange;
|
||||
rangeRaw: RawTimeRange; // Duplicate of results in range. will be deprecated eventually
|
||||
timeInfo?: string; // The query time description (blue text in the upper right)
|
||||
targets: TQuery[];
|
||||
panelId: number;
|
||||
dashboardId: number;
|
||||
@@ -232,13 +233,8 @@ export interface DataQueryOptions<TQuery extends DataQuery = DataQuery> {
|
||||
intervalMs: number;
|
||||
maxDataPoints: number;
|
||||
scopedVars: ScopedVars;
|
||||
}
|
||||
|
||||
/**
|
||||
* Timestamps when the query starts and stops
|
||||
*/
|
||||
export interface DataRequestInfo extends DataQueryOptions {
|
||||
timeInfo?: string; // The query time description (blue text in the upper right)
|
||||
// Request Timing
|
||||
startTime: number;
|
||||
endTime?: number;
|
||||
}
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import { ComponentClass } from 'react';
|
||||
import { LoadingState, SeriesData } from './data';
|
||||
import { TimeRange } from './time';
|
||||
import { ScopedVars, DataRequestInfo, DataQueryError, LegacyResponseData } from './datasource';
|
||||
import { ScopedVars, DataQueryRequest, DataQueryError, LegacyResponseData } from './datasource';
|
||||
|
||||
export type InterpolateFunction = (value: string, scopedVars?: ScopedVars, format?: string | Function) => string;
|
||||
|
||||
export interface PanelData {
|
||||
state: LoadingState;
|
||||
series: SeriesData[];
|
||||
request?: DataRequestInfo;
|
||||
request?: DataQueryRequest;
|
||||
error?: DataQueryError;
|
||||
|
||||
// Data format expected by Angular panels
|
||||
|
||||
Reference in New Issue
Block a user