mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
react panels query processing
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { LoadingState } from './queries';
|
||||
import { LoadingState, TimeSeries } from './series';
|
||||
|
||||
export interface PanelProps {
|
||||
data: any;
|
||||
timeSeries: TimeSeries[];
|
||||
loading: LoadingState;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
50
public/app/types/series.ts
Normal file
50
public/app/types/series.ts
Normal 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>;
|
||||
}
|
||||
Reference in New Issue
Block a user