diff --git a/public/app/features/plugins/admin/components/InstallControls/index.tsx b/public/app/features/plugins/admin/components/InstallControls/index.tsx index faecc95e739..a65d1df7850 100644 --- a/public/app/features/plugins/admin/components/InstallControls/index.tsx +++ b/public/app/features/plugins/admin/components/InstallControls/index.tsx @@ -30,10 +30,14 @@ export const InstallControls = ({ plugin, latestCompatibleVersion }: Props) => { : PluginStatus.UNINSTALL : PluginStatus.INSTALL; - if (plugin.isCore || plugin.isDisabled || plugin.type === PluginType.renderer) { + if (plugin.isCore || plugin.isDisabled) { return null; } + if (plugin.type === PluginType.renderer) { + return
Renderer plugins cannot be managed by the Plugin Catalog.
; + } + if (plugin.isEnterprise && !config.licenseInfo?.hasValidLicense) { return ( diff --git a/public/app/features/plugins/admin/hooks/usePlugins.tsx b/public/app/features/plugins/admin/hooks/usePlugins.tsx deleted file mode 100644 index 475bf1e4330..00000000000 --- a/public/app/features/plugins/admin/hooks/usePlugins.tsx +++ /dev/null @@ -1,49 +0,0 @@ -import { useMemo } from 'react'; -import { useAsync } from 'react-use'; -import { CatalogPlugin, CatalogPluginsState } from '../types'; -import { api } from '../api'; -import { mapLocalToCatalog, mapRemoteToCatalog, mapToCatalogPlugin } from '../helpers'; - -export function usePlugins(): CatalogPluginsState { - const { loading, value, error } = useAsync(async () => { - const remote = await api.getRemotePlugins(); - const installed = await api.getInstalledPlugins(); - return { remote, installed }; - }, []); - - const plugins = useMemo(() => { - const installed = value?.installed || []; - const remote = value?.remote || []; - const unique: Record = {}; - - for (const plugin of installed) { - unique[plugin.id] = mapLocalToCatalog(plugin); - } - - for (const plugin of remote) { - if (plugin.typeCode === 'renderer') { - continue; - } - - if (!Boolean(plugin.versionSignatureType)) { - continue; - } - - if (unique[plugin.slug]) { - unique[plugin.slug] = mapToCatalogPlugin( - installed.find((installedPlugin) => installedPlugin.id === plugin.slug), - plugin - ); - } else { - unique[plugin.slug] = mapRemoteToCatalog(plugin); - } - } - return Object.values(unique); - }, [value?.installed, value?.remote]); - - return { - loading, - error, - plugins, - }; -}