Move types to types/explore

This commit is contained in:
David Kaltschmidt 2019-01-12 23:28:51 +01:00
parent be172d3e4a
commit f02f41c9b0
5 changed files with 64 additions and 84 deletions

View File

@ -6,7 +6,14 @@ import { AutoSizer } from 'react-virtualized';
import { RawTimeRange, TimeRange } from '@grafana/ui'; import { RawTimeRange, TimeRange } from '@grafana/ui';
import { DataSourceSelectItem } from 'app/types/datasources'; import { DataSourceSelectItem } from 'app/types/datasources';
import { ExploreUrlState, HistoryItem, QueryTransaction, RangeScanner, ExploreId } from 'app/types/explore'; import {
ExploreItemState,
ExploreUrlState,
HistoryItem,
QueryTransaction,
RangeScanner,
ExploreId,
} from 'app/types/explore';
import { DataQuery } from 'app/types/series'; import { DataQuery } from 'app/types/series';
import { StoreState } from 'app/types'; import { StoreState } from 'app/types';
import store from 'app/core/store'; import store from 'app/core/store';
@ -37,7 +44,6 @@ import {
scanStart, scanStart,
scanStop, scanStop,
} from './state/actions'; } from './state/actions';
import { ExploreItemState } from './state/reducers';
import Panel from './Panel'; import Panel from './Panel';
import QueryRows from './QueryRows'; import QueryRows from './QueryRows';

View File

@ -21,6 +21,8 @@ import { DataQuery, StoreState } from 'app/types';
import { getDatasourceSrv } from 'app/features/plugins/datasource_srv'; import { getDatasourceSrv } from 'app/features/plugins/datasource_srv';
import { import {
ExploreId, ExploreId,
ExploreItemState,
ExploreUrlState,
HistoryItem, HistoryItem,
RangeScanner, RangeScanner,
ResultType, ResultType,
@ -28,10 +30,8 @@ import {
QueryTransaction, QueryTransaction,
QueryHint, QueryHint,
QueryHintGetter, QueryHintGetter,
ExploreUrlState,
} from 'app/types/explore'; } from 'app/types/explore';
import { Emitter } from 'app/core/core'; import { Emitter } from 'app/core/core';
import { ExploreItemState } from './reducers';
export enum ActionTypes { export enum ActionTypes {
AddQueryRow = 'ADD_QUERY_ROW', AddQueryRow = 'ADD_QUERY_ROW',

View File

@ -1,61 +1,13 @@
import { RawTimeRange, TimeRange } from '@grafana/ui';
import { import {
calculateResultsFromQueryTransactions, calculateResultsFromQueryTransactions,
generateEmptyQuery, generateEmptyQuery,
getIntervals, getIntervals,
ensureQueries, ensureQueries,
} from 'app/core/utils/explore'; } from 'app/core/utils/explore';
import { DataSourceSelectItem } from 'app/types/datasources'; import { ExploreItemState, ExploreState, QueryTransaction } from 'app/types/explore';
import { HistoryItem, QueryTransaction, QueryIntervals, RangeScanner } from 'app/types/explore';
import { DataQuery } from 'app/types/series'; import { DataQuery } from 'app/types/series';
import { Action, ActionTypes } from './actions'; import { Action, ActionTypes } from './actions';
import { Emitter } from 'app/core/core';
import { LogsModel } from 'app/core/logs_model';
import TableModel from 'app/core/table_model';
// TODO move to types
export interface ExploreState {
split: boolean;
left: ExploreItemState;
right: ExploreItemState;
}
export interface ExploreItemState {
StartPage?: any;
containerWidth: number;
datasourceInstance: any;
datasourceError: string;
datasourceLoading: boolean | null;
datasourceMissing: boolean;
eventBridge?: Emitter;
exploreDatasources: DataSourceSelectItem[];
graphResult?: any[];
history: HistoryItem[];
initialDatasource?: string;
initialQueries: DataQuery[];
initialized: boolean;
logsHighlighterExpressions?: string[];
logsResult?: LogsModel;
modifiedQueries: DataQuery[];
queryIntervals: QueryIntervals;
queryTransactions: QueryTransaction[];
requestedDatasourceId?: number;
range: TimeRange | RawTimeRange;
scanner?: RangeScanner;
scanning?: boolean;
scanRange?: RawTimeRange;
showingGraph: boolean;
showingLogs: boolean;
showingStartPage?: boolean;
showingTable: boolean;
supportsGraph: boolean | null;
supportsLogs: boolean | null;
supportsTable: boolean | null;
tableResult?: TableModel;
}
export const DEFAULT_RANGE = { export const DEFAULT_RANGE = {
from: 'now-6h', from: 'now-6h',

View File

@ -1,9 +1,12 @@
import { Value } from 'slate'; import { Value } from 'slate';
import { RawTimeRange, TimeRange } from '@grafana/ui';
import { Emitter } from 'app/core/core';
import { LogsModel } from 'app/core/logs_model';
import TableModel from 'app/core/table_model';
import { DataSourceSelectItem } from 'app/types/datasources';
import { DataQuery } from './series'; import { DataQuery } from './series';
import { RawTimeRange } from '@grafana/ui';
import TableModel from 'app/core/table_model';
import { LogsModel } from 'app/core/logs_model';
export interface CompletionItem { export interface CompletionItem {
/** /**
@ -80,6 +83,52 @@ export enum ExploreId {
right = 'right', right = 'right',
} }
export interface ExploreState {
split: boolean;
left: ExploreItemState;
right: ExploreItemState;
}
export interface ExploreItemState {
StartPage?: any;
containerWidth: number;
datasourceInstance: any;
datasourceError: string;
datasourceLoading: boolean | null;
datasourceMissing: boolean;
eventBridge?: Emitter;
exploreDatasources: DataSourceSelectItem[];
graphResult?: any[];
history: HistoryItem[];
initialDatasource?: string;
initialQueries: DataQuery[];
initialized: boolean;
logsHighlighterExpressions?: string[];
logsResult?: LogsModel;
modifiedQueries: DataQuery[];
queryIntervals: QueryIntervals;
queryTransactions: QueryTransaction[];
requestedDatasourceId?: number;
range: TimeRange | RawTimeRange;
scanner?: RangeScanner;
scanning?: boolean;
scanRange?: RawTimeRange;
showingGraph: boolean;
showingLogs: boolean;
showingStartPage?: boolean;
showingTable: boolean;
supportsGraph: boolean | null;
supportsLogs: boolean | null;
supportsTable: boolean | null;
tableResult?: TableModel;
}
export interface ExploreUrlState {
datasource: string;
queries: any[]; // Should be a DataQuery, but we're going to strip refIds, so typing makes less sense
range: RawTimeRange;
}
export interface HistoryItem { export interface HistoryItem {
ts: number; ts: number;
query: DataQuery; query: DataQuery;
@ -168,31 +217,4 @@ export interface TextMatch {
end: number; end: number;
} }
export interface ExploreState {
StartPage?: any;
datasource: any;
datasourceError: any;
graphResult?: any[];
history: HistoryItem[];
logsHighlighterExpressions?: string[];
logsResult?: LogsModel;
queryTransactions: QueryTransaction[];
scanning?: boolean;
scanRange?: RawTimeRange;
showingGraph: boolean;
showingLogs: boolean;
showingStartPage?: boolean;
showingTable: boolean;
supportsGraph: boolean | null;
supportsLogs: boolean | null;
supportsTable: boolean | null;
tableResult?: TableModel;
}
export interface ExploreUrlState {
datasource: string;
queries: any[]; // Should be a DataQuery, but we're going to strip refIds, so typing makes less sense
range: RawTimeRange;
}
export type ResultType = 'Graph' | 'Logs' | 'Table'; export type ResultType = 'Graph' | 'Logs' | 'Table';

View File

@ -19,7 +19,7 @@ import {
} from './appNotifications'; } from './appNotifications';
import { DashboardSearchHit } from './search'; import { DashboardSearchHit } from './search';
import { ValidationEvents, ValidationRule } from './form'; import { ValidationEvents, ValidationRule } from './form';
import { ExploreState } from 'app/features/explore/state/reducers'; import { ExploreState } from './explore';
export { export {
Team, Team,
TeamsState, TeamsState,