chore: fixing issue with the vizualizer

Signed-off-by: blam <ben@blam.sh>
This commit is contained in:
blam
2024-08-19 12:04:33 +02:00
parent 003f38a39a
commit f58c71da9d
2 changed files with 21 additions and 15 deletions
@@ -189,15 +189,26 @@ function OutputLink(props: {
}) {
const routeRef = props.node?.instance?.getData(coreExtensionData.routeRef);
const link = useRouteRef(routeRef as RouteRef<undefined>);
try {
const link = useRouteRef(routeRef as RouteRef<undefined>);
return (
<Tooltip title={<Typography>{props.dataRef.id}</Typography>}>
<Box className={props.className}>
{link ? <Link to={link()}>link</Link> : null}
</Box>
</Tooltip>
);
return (
<Tooltip title={<Typography>{props.dataRef.id}</Typography>}>
<Box className={props.className}>
{link ? <Link to={link()}>link</Link> : null}
</Box>
</Tooltip>
);
} catch (ex) {
// eslint-disable-next-line no-console
console.warn(
props.node?.spec.id
? `Unable to generate output link for ${props.node.spec.id}`
: 'Unable to generate output link',
ex,
);
return null;
}
}
function Output(props: { dataRef: ExtensionDataRef<unknown>; node?: AppNode }) {
@@ -15,19 +15,14 @@
*/
import React from 'react';
import {
compatWrapper,
convertLegacyRouteRef,
} from '@backstage/core-compat-api';
import { rootCatalogKubernetesRouteRef } from '../plugin';
import { compatWrapper } from '@backstage/core-compat-api';
import { EntityContentBlueprint } from '@backstage/plugin-catalog-react/alpha';
export const entityKubernetesContent = EntityContentBlueprint.make({
name: 'kubernetes',
params: {
defaultPath: 'kubernetes',
defaultPath: '/kubernetes',
defaultTitle: 'Kubernetes',
routeRef: convertLegacyRouteRef(rootCatalogKubernetesRouteRef),
loader: () =>
import('./KubernetesContentPage').then(m =>
compatWrapper(<m.KubernetesContentPage />),