diff --git a/plugins/api-docs/src/components/ApiDefinitionCard/ApiDefinitionCard.tsx b/plugins/api-docs/src/components/ApiDefinitionCard/ApiDefinitionCard.tsx index 5013b309a7..ce6f0658bf 100644 --- a/plugins/api-docs/src/components/ApiDefinitionCard/ApiDefinitionCard.tsx +++ b/plugins/api-docs/src/components/ApiDefinitionCard/ApiDefinitionCard.tsx @@ -28,7 +28,7 @@ type Props = { }; export const ApiDefinitionCard = (_: Props) => { - const entity = useEntity().entity; + const { entity } = useEntity(); const config = useApi(apiDocsConfigRef); const { getApiDefinitionWidget } = config; diff --git a/plugins/org/src/components/Cards/Group/GroupProfile/GroupProfileCard.tsx b/plugins/org/src/components/Cards/Group/GroupProfile/GroupProfileCard.tsx index c0e2660ad4..1e55b1b340 100644 --- a/plugins/org/src/components/Cards/Group/GroupProfile/GroupProfileCard.tsx +++ b/plugins/org/src/components/Cards/Group/GroupProfile/GroupProfileCard.tsx @@ -55,9 +55,9 @@ export const GroupProfileCard = ({ entity?: GroupEntity; variant?: InfoCardVariants; }) => { - const group = useEntity().entity; + const { entity: group } = useEntity(); if (!group) { - return User not found; + return Group not found; } const { diff --git a/plugins/org/src/components/Cards/Group/MembersList/MembersListCard.tsx b/plugins/org/src/components/Cards/Group/MembersList/MembersListCard.tsx index 3fc82ed3ec..852f2a9e98 100644 --- a/plugins/org/src/components/Cards/Group/MembersList/MembersListCard.tsx +++ b/plugins/org/src/components/Cards/Group/MembersList/MembersListCard.tsx @@ -19,7 +19,13 @@ import { RELATION_MEMBER_OF, UserEntity, } from '@backstage/catalog-model'; -import { Avatar, InfoCard, Progress, useApi } from '@backstage/core'; +import { + Avatar, + InfoCard, + Progress, + ResponseErrorPanel, + useApi, +} from '@backstage/core'; import { catalogApiRef, entityRouteParams, @@ -34,7 +40,6 @@ import { Theme, Typography, } from '@material-ui/core'; -import Alert from '@material-ui/lab/Alert'; import React from 'react'; import { generatePath, Link as RouterLink } from 'react-router-dom'; import { useAsync } from 'react-use'; @@ -110,7 +115,7 @@ export const MembersListCard = (_props: { /** @deprecated The entity is now grabbed from context instead */ entity?: GroupEntity; }) => { - const groupEntity = useEntity().entity; + const { entity: groupEntity } = useEntity(); const { metadata: { name: groupName }, spec: { profile }, @@ -138,7 +143,7 @@ export const MembersListCard = (_props: { if (loading) { return ; } else if (error) { - return {error.message}; + return ; } return ( diff --git a/plugins/org/src/components/Cards/OwnershipCard/OwnershipCard.tsx b/plugins/org/src/components/Cards/OwnershipCard/OwnershipCard.tsx index 0c46b8e670..820934c856 100644 --- a/plugins/org/src/components/Cards/OwnershipCard/OwnershipCard.tsx +++ b/plugins/org/src/components/Cards/OwnershipCard/OwnershipCard.tsx @@ -15,7 +15,13 @@ */ import { Entity } from '@backstage/catalog-model'; -import { InfoCard, InfoCardVariants, Progress, useApi } from '@backstage/core'; +import { + InfoCard, + InfoCardVariants, + Progress, + ResponseErrorPanel, + useApi, +} from '@backstage/core'; import { catalogApiRef, isOwnerOf, @@ -29,7 +35,6 @@ import { makeStyles, Typography, } from '@material-ui/core'; -import Alert from '@material-ui/lab/Alert'; import React from 'react'; import { useAsync } from 'react-use'; @@ -180,12 +185,12 @@ export const OwnershipCard = ({ name: 'Tools', }, ] as Array<{ counter: number; className: EntitiesTypes; name: string }>; - }, [catalogApi]); + }, [catalogApi, entity]); if (loading) { return ; } else if (error) { - return {error.message}; + return ; } return ( diff --git a/plugins/org/src/components/Cards/User/UserProfileCard/UserProfileCard.tsx b/plugins/org/src/components/Cards/User/UserProfileCard/UserProfileCard.tsx index 9648f2104a..585c0f32e0 100644 --- a/plugins/org/src/components/Cards/User/UserProfileCard/UserProfileCard.tsx +++ b/plugins/org/src/components/Cards/User/UserProfileCard/UserProfileCard.tsx @@ -51,7 +51,7 @@ export const UserProfileCard = ({ entity?: UserEntity; variant?: InfoCardVariants; }) => { - const user = useEntity().entity; + const { entity: user } = useEntity(); if (!user) { return User not found; }