Commit 5e2b9e40 by Hugo Häggmark

Added more typings

parent 6b98b059
...@@ -65,15 +65,19 @@ export interface ExploreQueryFieldProps<DSType extends DataSourceApi, TQuery ext ...@@ -65,15 +65,19 @@ export interface ExploreQueryFieldProps<DSType extends DataSourceApi, TQuery ext
onExecuteHint?: (action: QueryFixAction) => void; onExecuteHint?: (action: QueryFixAction) => void;
} }
export interface ExploreStartPageProps {
onClickExample: (query: DataQuery) => void;
}
export interface PluginExports { export interface PluginExports {
Datasource?: DataSourceApi; Datasource?: DataSourceApi;
QueryCtrl?: any; QueryCtrl?: any;
QueryEditor?: ComponentClass<QueryEditorProps<DataSourceApi,DataQuery>>; QueryEditor?: ComponentClass<QueryEditorProps<DataSourceApi, DataQuery>>;
ConfigCtrl?: any; ConfigCtrl?: any;
AnnotationsQueryCtrl?: any; AnnotationsQueryCtrl?: any;
VariableQueryEditor?: any; VariableQueryEditor?: any;
ExploreQueryField?: ComponentClass<ExploreQueryFieldProps<DataSourceApi, DataQuery>>; ExploreQueryField?: ComponentClass<ExploreQueryFieldProps<DataSourceApi, DataQuery>>;
ExploreStartPage?: any; ExploreStartPage?: ComponentClass<ExploreStartPageProps>;
// Panel plugin // Panel plugin
PanelCtrl?: any; PanelCtrl?: any;
...@@ -131,5 +135,3 @@ export interface PluginMetaInfo { ...@@ -131,5 +135,3 @@ export interface PluginMetaInfo {
updated: string; updated: string;
version: string; version: string;
} }
// Libraries // Libraries
import React from 'react'; import React, { ComponentClass } from 'react';
import { hot } from 'react-hot-loader'; import { hot } from 'react-hot-loader';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import _ from 'lodash'; import _ from 'lodash';
...@@ -21,7 +21,7 @@ import TimePicker, { parseTime } from './TimePicker'; ...@@ -21,7 +21,7 @@ import TimePicker, { parseTime } from './TimePicker';
import { changeSize, changeTime, initializeExplore, modifyQueries, scanStart, setQueries } from './state/actions'; import { changeSize, changeTime, initializeExplore, modifyQueries, scanStart, setQueries } from './state/actions';
// Types // Types
import { RawTimeRange, TimeRange, DataQuery } from '@grafana/ui'; import { RawTimeRange, TimeRange, DataQuery, ExploreStartPageProps } from '@grafana/ui';
import { ExploreItemState, ExploreUrlState, RangeScanner, ExploreId } from 'app/types/explore'; import { ExploreItemState, ExploreUrlState, RangeScanner, ExploreId } from 'app/types/explore';
import { StoreState } from 'app/types'; import { StoreState } from 'app/types';
import { LAST_USED_DATASOURCE_KEY, ensureQueries, DEFAULT_RANGE } from 'app/core/utils/explore'; import { LAST_USED_DATASOURCE_KEY, ensureQueries, DEFAULT_RANGE } from 'app/core/utils/explore';
...@@ -30,7 +30,7 @@ import { ExploreToolbar } from './ExploreToolbar'; ...@@ -30,7 +30,7 @@ import { ExploreToolbar } from './ExploreToolbar';
import { scanStopAction } from './state/actionTypes'; import { scanStopAction } from './state/actionTypes';
interface ExploreProps { interface ExploreProps {
StartPage?: any; StartPage?: ComponentClass<ExploreStartPageProps>;
changeSize: typeof changeSize; changeSize: typeof changeSize;
changeTime: typeof changeTime; changeTime: typeof changeTime;
datasourceError: string; datasourceError: string;
......
import React, { PureComponent } from 'react'; import React, { PureComponent } from 'react';
import LokiCheatSheet from './LokiCheatSheet'; import LokiCheatSheet from './LokiCheatSheet';
import { ExploreStartPageProps } from '@grafana/ui';
interface Props { export default class LokiStartPage extends PureComponent<ExploreStartPageProps> {
onClickExample: () => void;
}
export default class LokiStartPage extends PureComponent<Props> {
render() { render() {
return ( return (
<div className="grafana-info-box grafana-info-box--max-lg"> <div className="grafana-info-box grafana-info-box--max-lg">
......
import React, { PureComponent } from 'react'; import React, { PureComponent } from 'react';
import PromCheatSheet from './PromCheatSheet'; import PromCheatSheet from './PromCheatSheet';
import { ExploreStartPageProps } from '@grafana/ui';
interface Props { export default class PromStart extends PureComponent<ExploreStartPageProps> {
onClickExample: () => void;
}
export default class PromStart extends PureComponent<Props> {
render() { render() {
return ( return (
<div className="grafana-info-box grafana-info-box--max-lg"> <div className="grafana-info-box grafana-info-box--max-lg">
......
import { ComponentClass } from 'react';
import { Value } from 'slate'; import { Value } from 'slate';
import { RawTimeRange, TimeRange, DataQuery, DataSourceSelectItem, DataSourceApi, QueryHint } from '@grafana/ui'; import {
RawTimeRange,
TimeRange,
DataQuery,
DataSourceSelectItem,
DataSourceApi,
QueryHint,
ExploreStartPageProps,
} from '@grafana/ui';
import { Emitter } from 'app/core/core'; import { Emitter } from 'app/core/core';
import { LogsModel } from 'app/core/logs_model'; import { LogsModel } from 'app/core/logs_model';
...@@ -102,7 +111,7 @@ export interface ExploreItemState { ...@@ -102,7 +111,7 @@ export interface ExploreItemState {
/** /**
* React component to be shown when no queries have been run yet, e.g., for a query language cheat sheet. * React component to be shown when no queries have been run yet, e.g., for a query language cheat sheet.
*/ */
StartPage?: any; StartPage?: ComponentClass<ExploreStartPageProps>;
/** /**
* Width used for calculating the graph interval (can't have more datapoints than pixels) * Width used for calculating the graph interval (can't have more datapoints than pixels)
*/ */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment