DataSourcePlugins: more generics improvements (#16965)

* more types for query editor

* generic datasources

* update

* change ComponentClass to ComponentType

* more types

* remove input
This commit is contained in:
Ryan McKinley
2019-05-09 02:48:13 -07:00
committed by Torkel Ödegaard
parent e1d408a66f
commit 7b92c56055
7 changed files with 51 additions and 27 deletions

View File

@@ -3,11 +3,11 @@ import React, { PureComponent } from 'react';
// Types
import { InputDatasource } from './InputDatasource';
import { InputQuery } from './types';
import { InputQuery, InputOptions } from './types';
import { FormLabel, Select, QueryEditorProps, SelectOptionItem, SeriesData, TableInputCSV, toCSV } from '@grafana/ui';
type Props = QueryEditorProps<InputDatasource, InputQuery>;
type Props = QueryEditorProps<InputDatasource, InputQuery, InputOptions>;
const options = [
{ value: 'panel', label: 'Panel', description: 'Save data in the panel configuration.' },

View File

@@ -6,6 +6,6 @@ import { InputQueryEditor } from './InputQueryEditor';
import { InputConfigEditor } from './InputConfigEditor';
import { InputOptions, InputQuery } from './types';
export const plugin = new DataSourcePlugin<InputQuery, InputOptions>(InputDatasource)
export const plugin = new DataSourcePlugin<InputDatasource, InputQuery, InputOptions>(InputDatasource)
.setConfigEditor(InputConfigEditor)
.setQueryEditor(InputQueryEditor);

View File

@@ -66,7 +66,7 @@ export interface CascaderOption {
disabled?: boolean;
}
export interface LokiQueryFieldFormProps extends ExploreQueryFieldProps<ExploreDataSourceApi, LokiQuery> {
export interface LokiQueryFieldFormProps extends ExploreQueryFieldProps<ExploreDataSourceApi<LokiQuery>, LokiQuery> {
history: HistoryItem[];
syntax: any;
logLabelOptions: any[];

View File

@@ -102,7 +102,7 @@ interface CascaderOption {
disabled?: boolean;
}
interface PromQueryFieldProps extends ExploreQueryFieldProps<ExploreDataSourceApi, PromQuery> {
interface PromQueryFieldProps extends ExploreQueryFieldProps<ExploreDataSourceApi<PromQuery>, PromQuery> {
history: HistoryItem[];
}