react panels query processing

This commit is contained in:
Torkel Ödegaard
2018-10-14 18:19:49 +02:00
parent 543c67a297
commit 8e85295b2b
11 changed files with 106 additions and 52 deletions

View File

@@ -9,7 +9,7 @@ import { ApiKey, ApiKeysState, NewApiKey } from './apiKeys';
import { Invitee, OrgUser, User, UsersState } from './user';
import { DataSource, DataSourcesState } from './datasources';
import { PluginMeta, Plugin, PluginsState } from './plugins';
import { TimeRange, LoadingState } from './queries';
import { TimeRange, LoadingState, TimeSeries, DataQuery, DataQueryResponse, DataQueryOptions } from './series';
import { PanelProps } from './panel';
export {
@@ -50,6 +50,10 @@ export {
TimeRange,
LoadingState,
PanelProps,
TimeSeries,
DataQuery,
DataQueryResponse,
DataQueryOptions,
};
export interface StoreState {

View File

@@ -1,6 +1,6 @@
import { LoadingState } from './queries';
import { LoadingState, TimeSeries } from './series';
export interface PanelProps {
data: any;
timeSeries: TimeSeries[];
loading: LoadingState;
}

View File

@@ -1,19 +0,0 @@
import { Moment } from 'moment';
export enum LoadingState {
NotStarted = 'NotStarted',
Loading = 'Loading',
Done = 'Done',
Error = 'Error',
}
export interface RawTimeRange {
from: Moment | string;
to: Moment | string;
}
export interface TimeRange {
from: Moment;
to: Moment;
raw: RawTimeRange;
}

View File

@@ -0,0 +1,50 @@
import { Moment } from 'moment';
export enum LoadingState {
NotStarted = 'NotStarted',
Loading = 'Loading',
Done = 'Done',
Error = 'Error',
}
export interface RawTimeRange {
from: Moment | string;
to: Moment | string;
}
export interface TimeRange {
from: Moment;
to: Moment;
raw: RawTimeRange;
}
export type TimeSeriesValue = string | number | null;
export type TimeSeriesPoints = TimeSeriesValue[][];
export interface TimeSeries {
target: string;
datapoints: TimeSeriesPoints;
}
export interface DataQueryResponse {
data: TimeSeries[];
}
export interface DataQuery {
refId: string;
}
export interface DataQueryOptions {
timezone: string;
range: TimeRange;
rangeRaw: RawTimeRange;
targets: DataQuery[];
panelId: number;
dashboardId: number;
cacheTimeout?: string;
}
export interface DataSourceApi {
query(options: DataQueryOptions): Promise<DataQueryResponse>;
}