mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
grafana/data: Add type for secure json in DataSourceAPI (#21772)
This commit is contained in:
parent
c3a19c6d98
commit
67c5531961
@ -33,15 +33,16 @@ export type DataSourceOptionsType<DSType extends DataSourceApi<any, any>> = DSTy
|
||||
export class DataSourcePlugin<
|
||||
DSType extends DataSourceApi<TQuery, TOptions>,
|
||||
TQuery extends DataQuery = DataSourceQueryType<DSType>,
|
||||
TOptions extends DataSourceJsonData = DataSourceOptionsType<DSType>
|
||||
TOptions extends DataSourceJsonData = DataSourceOptionsType<DSType>,
|
||||
TSecureOptions = {}
|
||||
> extends GrafanaPlugin<DataSourcePluginMeta<TOptions>> {
|
||||
components: DataSourcePluginComponents<DSType, TQuery, TOptions> = {};
|
||||
components: DataSourcePluginComponents<DSType, TQuery, TOptions, TSecureOptions> = {};
|
||||
|
||||
constructor(public DataSourceClass: DataSourceConstructor<DSType, TQuery, TOptions>) {
|
||||
super();
|
||||
}
|
||||
|
||||
setConfigEditor(editor: ComponentType<DataSourcePluginOptionsEditorProps<TOptions>>) {
|
||||
setConfigEditor(editor: ComponentType<DataSourcePluginOptionsEditorProps<TOptions, TSecureOptions>>) {
|
||||
this.components.ConfigEditor = editor;
|
||||
return this;
|
||||
}
|
||||
@ -131,7 +132,8 @@ interface PluginMetaQueryOptions {
|
||||
export interface DataSourcePluginComponents<
|
||||
DSType extends DataSourceApi<TQuery, TOptions>,
|
||||
TQuery extends DataQuery = DataQuery,
|
||||
TOptions extends DataSourceJsonData = DataSourceJsonData
|
||||
TOptions extends DataSourceJsonData = DataSourceJsonData,
|
||||
TSecureOptions = {}
|
||||
> {
|
||||
QueryCtrl?: any;
|
||||
AnnotationsQueryCtrl?: any;
|
||||
@ -141,7 +143,7 @@ export interface DataSourcePluginComponents<
|
||||
ExploreMetricsQueryField?: ComponentType<ExploreQueryFieldProps<DSType, TQuery, TOptions>>;
|
||||
ExploreLogsQueryField?: ComponentType<ExploreQueryFieldProps<DSType, TQuery, TOptions>>;
|
||||
ExploreStartPage?: ComponentType<ExploreStartPageProps>;
|
||||
ConfigEditor?: ComponentType<DataSourcePluginOptionsEditorProps<TOptions>>;
|
||||
ConfigEditor?: ComponentType<DataSourcePluginOptionsEditorProps<TOptions, TSecureOptions>>;
|
||||
MetadataInspector?: ComponentType<MetadataInspectorProps<DSType, TQuery, TOptions>>;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user