PluginExtensions: Fixed so we expose the proper types for usePluginComponents (#100949)
* Fixed usage of incorrect type in the 'usePluginComponents' hook. * improved betterer. * Changed import path of usePluginLinks types. * improved betterer result.
This commit is contained in:
1 parent
68ce949fff
commit
c969a7251e
9 files changed
+72
-74
No files matched your search
@@ -1,10 +1,4 @@
|
||||
import type {
|
||||
PluginExtension,
|
||||
PluginExtensionLink,
|
||||
PluginExtensionComponent,
|
||||
PluginExtensionFunction,
|
||||
PluginExtensionComponentMeta,
|
||||
} from '@grafana/data';
|
||||
import type { PluginExtension, PluginExtensionLink, PluginExtensionComponent } from '@grafana/data';
|
||||
|
||||
import { isPluginExtensionComponent, isPluginExtensionLink } from './utils';
|
||||
|
||||
@@ -23,11 +17,6 @@ export type GetPluginExtensionsOptions = {
|
||||
limitPerPlugin?: number;
|
||||
};
|
||||
|
||||
export type UsePluginComponentOptions = {
|
||||
extensionPointId: string;
|
||||
limitPerPlugin?: number;
|
||||
};
|
||||
|
||||
export type GetPluginExtensionsResult<T = PluginExtension> = {
|
||||
extensions: T[];
|
||||
};
|
||||
@@ -37,37 +26,6 @@ export type UsePluginExtensionsResult<T = PluginExtension> = {
|
||||
isLoading: boolean;
|
||||
};
|
||||
|
||||
export type UsePluginComponentResult<Props = {}> = {
|
||||
component: React.ComponentType<Props> | undefined | null;
|
||||
isLoading: boolean;
|
||||
};
|
||||
|
||||
export type UsePluginComponentsResult<Props = {}> = {
|
||||
components: Array<React.ComponentType<Props> & { meta: PluginExtensionComponentMeta }>;
|
||||
isLoading: boolean;
|
||||
};
|
||||
|
||||
export type UsePluginLinksOptions = {
|
||||
extensionPointId: string;
|
||||
context?: object | Record<string | symbol, unknown>;
|
||||
limitPerPlugin?: number;
|
||||
};
|
||||
|
||||
export type UsePluginLinksResult = {
|
||||
isLoading: boolean;
|
||||
links: PluginExtensionLink[];
|
||||
};
|
||||
|
||||
export type UsePluginFunctionsOptions = {
|
||||
extensionPointId: string;
|
||||
limitPerPlugin?: number;
|
||||
};
|
||||
|
||||
export type UsePluginFunctionsResult<Signature> = {
|
||||
isLoading: boolean;
|
||||
functions: Array<PluginExtensionFunction<Signature>>;
|
||||
};
|
||||
|
||||
let singleton: GetPluginExtensions | undefined;
|
||||
|
||||
export function setPluginExtensionGetter(instance: GetPluginExtensions): void {
|
||||
|
||||
Reference in new issue
Block a user