mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
grafana/data: Update plugin config page typings (BREAKING) (#21503)
* Change typyings of plugins config pages * Update plugin config page types of core plugins
This commit is contained in:
@@ -34,7 +34,7 @@ export class DataSourcePlugin<
|
||||
DSType extends DataSourceApi<TQuery, TOptions>,
|
||||
TQuery extends DataQuery = DataSourceQueryType<DSType>,
|
||||
TOptions extends DataSourceJsonData = DataSourceOptionsType<DSType>
|
||||
> extends GrafanaPlugin<DataSourcePluginMeta> {
|
||||
> extends GrafanaPlugin<DataSourcePluginMeta<TOptions>> {
|
||||
components: DataSourcePluginComponents<DSType, TQuery, TOptions> = {};
|
||||
|
||||
constructor(public DataSourceClass: DataSourceConstructor<DSType, TQuery, TOptions>) {
|
||||
@@ -108,7 +108,7 @@ export class DataSourcePlugin<
|
||||
}
|
||||
}
|
||||
|
||||
export interface DataSourcePluginMeta extends PluginMeta {
|
||||
export interface DataSourcePluginMeta<T extends KeyValue = {}> extends PluginMeta<T> {
|
||||
builtIn?: boolean; // Is this for all
|
||||
metrics?: boolean;
|
||||
logs?: boolean;
|
||||
|
@@ -13,7 +13,7 @@ export enum PluginType {
|
||||
renderer = 'renderer',
|
||||
}
|
||||
|
||||
export interface PluginMeta<T extends {} = KeyValue> {
|
||||
export interface PluginMeta<T extends KeyValue = {}> {
|
||||
id: string;
|
||||
name: string;
|
||||
type: PluginType;
|
||||
@@ -108,12 +108,12 @@ export interface PluginMetaInfo {
|
||||
version: string;
|
||||
}
|
||||
|
||||
export interface PluginConfigPageProps<T extends GrafanaPlugin> {
|
||||
plugin: T;
|
||||
export interface PluginConfigPageProps<T extends PluginMeta> {
|
||||
plugin: GrafanaPlugin<T>;
|
||||
query: KeyValue; // The URL query parameters
|
||||
}
|
||||
|
||||
export interface PluginConfigPage<T extends GrafanaPlugin> {
|
||||
export interface PluginConfigPage<T extends PluginMeta> {
|
||||
title: string; // Display
|
||||
icon?: string;
|
||||
id: string; // Unique, in URL
|
||||
@@ -132,10 +132,10 @@ export class GrafanaPlugin<T extends PluginMeta = PluginMeta> {
|
||||
angularConfigCtrl?: any;
|
||||
|
||||
// Show configuration tabs on the plugin page
|
||||
configPages?: Array<PluginConfigPage<GrafanaPlugin>>;
|
||||
configPages?: Array<PluginConfigPage<T>>;
|
||||
|
||||
// Tabs on the plugin page
|
||||
addConfigPage(tab: PluginConfigPage<GrafanaPlugin>) {
|
||||
addConfigPage(tab: PluginConfigPage<T>) {
|
||||
if (!this.configPages) {
|
||||
this.configPages = [];
|
||||
}
|
||||
|
Reference in New Issue
Block a user