use @backstage/autodetect for DevTools Plugin

Co-authored-by: Vincenzo Scamporlino <vinzscam@users.noreply.github.com>
Signed-off-by: Philipp Hugenroth <philipph@spotify.com>
This commit is contained in:
Philipp Hugenroth
2023-07-18 11:38:33 +02:00
committed by Patrik Oldsberg
parent 2cf06dffe7
commit 879b1aa6f5
@@ -43,8 +43,6 @@ import {
} from '@backstage/plugin-devtools-common';
import * as autodetect from '@backstage/autodetect';
const PACKAGES_GLOBAL = '__backstage_detected_packages__';
const useStyles = makeStyles((theme: Theme) =>
createStyles({
paperStyle: {
@@ -79,22 +77,17 @@ const copyToClipboard = ({ about }: { about: DevToolsInfo | undefined }) => {
export const InfoContent = () => {
const classes = useStyles();
const { about, loading, error } = useInfo();
console.log('ooo', autodetect.getAvailablePlugins());
const availablePlugins: PackageDependency[] = (window as any)[PACKAGES_GLOBAL]
? (
(window as any)[PACKAGES_GLOBAL].modules as Array<Record<string, any>>
).map(({ name, module }) => {
const pluginImpl: any = Object.values(module).find(
(v: any) => !!v?.getId,
);
return {
name,
versions: (pluginImpl?.getId() as string) || '',
};
})
: [];
const plugins = autodetect.getAvailablePlugins();
const availablePlugins: PackageDependency[] = (
plugins.modules as Array<Record<string, any>>
).map(({ name, module }) => {
const pluginImpl: any = Object.values(module).find((v: any) => !!v?.getId);
return {
name,
versions: (pluginImpl?.getId() as string) || '',
};
});
if (loading) {
return <Progress />;
} else if (error) {