mirror of
https://github.com/grafana/grafana.git
synced 2025-08-06 04:19:26 +08:00
Plugin extensions: Introduce new registry for added components (#91877)
* add added component registry * fix broken test * add tests for usePluginComponents hook * readd expose components * add type assertion exceptions to betterer results * use new addedComponent registry in legacy endpoints * remove unused code * cleanup * revert test code * remove commented code * wrap in try catch * pr feedback
This commit is contained in:
@ -5,7 +5,6 @@ import { useAsync } from 'react-use';
|
||||
|
||||
import {
|
||||
type PluginExtensionLinkConfig,
|
||||
type PluginExtensionComponentConfig,
|
||||
type PluginExtensionConfig,
|
||||
type PluginExtensionEventHelpers,
|
||||
PluginExtensionTypes,
|
||||
@ -31,12 +30,6 @@ export function isPluginExtensionLinkConfig(
|
||||
return typeof extension === 'object' && 'type' in extension && extension['type'] === PluginExtensionTypes.link;
|
||||
}
|
||||
|
||||
export function isPluginExtensionComponentConfig<Props extends object>(
|
||||
extension: PluginExtensionConfig | undefined | PluginExtensionComponentConfig<Props>
|
||||
): extension is PluginExtensionComponentConfig<Props> {
|
||||
return typeof extension === 'object' && 'type' in extension && extension['type'] === PluginExtensionTypes.component;
|
||||
}
|
||||
|
||||
export function handleErrorsInFn(fn: Function, errorMessagePrefix = '') {
|
||||
return (...args: unknown[]) => {
|
||||
try {
|
||||
|
Reference in New Issue
Block a user