diff --git a/plugins/org/src/components/Cards/Group/GroupProfile/GroupProfileCard.tsx b/plugins/org/src/components/Cards/Group/GroupProfile/GroupProfileCard.tsx
index f5a1acd5e6..3b8d93b121 100644
--- a/plugins/org/src/components/Cards/Group/GroupProfile/GroupProfileCard.tsx
+++ b/plugins/org/src/components/Cards/Group/GroupProfile/GroupProfileCard.tsx
@@ -21,7 +21,7 @@ import {
RELATION_PARENT_OF,
} from '@backstage/catalog-model';
import { Avatar, InfoCard } from '@backstage/core';
-import { entityRouteParams } from '@backstage/plugin-catalog-react';
+import { useEntity, entityRouteParams } from '@backstage/plugin-catalog-react';
import { Box, Grid, Link, Tooltip, Typography } from '@material-ui/core';
import AccountTreeIcon from '@material-ui/icons/AccountTree';
import EmailIcon from '@material-ui/icons/Email';
@@ -33,26 +33,29 @@ import { generatePath, Link as RouterLink } from 'react-router-dom';
const GroupLink = ({
groupName,
index = 0,
- entity,
}: {
groupName: string;
index?: number;
- entity: Entity;
-}) => (
- <>
- {index >= 1 ? ', ' : ''}
-
- [{groupName}]
-
- >
-);
+ /** @deprecated The entity is now grabbed from context instead */
+ entity?: Entity;
+}) => {
+ const { entity } = useEntity();
+ return (
+ <>
+ {index >= 1 ? ', ' : ''}
+
+ [{groupName}]
+
+ >
+ );
+};
const CardTitle = ({ title }: { title: string }) => (
@@ -61,12 +64,13 @@ const CardTitle = ({ title }: { title: string }) => (
);
export const GroupProfileCard = ({
- entity: group,
variant,
}: {
- entity: GroupEntity;
+ /** @deprecated The entity is now grabbed from context instead */
+ entity?: GroupEntity;
variant: string;
}) => {
+ const group = useEntity().entity as GroupEntity;
const {
metadata: { name, description },
spec: { profile },
diff --git a/plugins/org/src/components/Cards/Group/MembersList/MembersListCard.tsx b/plugins/org/src/components/Cards/Group/MembersList/MembersListCard.tsx
index f644e7db7e..7f8ede2eb7 100644
--- a/plugins/org/src/components/Cards/Group/MembersList/MembersListCard.tsx
+++ b/plugins/org/src/components/Cards/Group/MembersList/MembersListCard.tsx
@@ -21,6 +21,7 @@ import {
} from '@backstage/catalog-model';
import { Avatar, InfoCard, Progress, useApi } from '@backstage/core';
import {
+ useEntity,
catalogApiRef,
entityRouteParams,
} from '@backstage/plugin-catalog-react';
@@ -105,11 +106,11 @@ const MemberComponent = ({
);
};
-export const MembersListCard = ({
- entity: groupEntity,
-}: {
- entity: GroupEntity;
+export const MembersListCard = (_props: {
+ /** @deprecated The entity is now grabbed from context instead */
+ entity?: GroupEntity;
}) => {
+ const groupEntity = useEntity().entity as GroupEntity;
const {
metadata: { name: groupName },
spec: { profile },
diff --git a/plugins/org/src/components/Cards/OwnershipCard/OwnershipCard.tsx b/plugins/org/src/components/Cards/OwnershipCard/OwnershipCard.tsx
index 60f06bd53a..80e80bddcc 100644
--- a/plugins/org/src/components/Cards/OwnershipCard/OwnershipCard.tsx
+++ b/plugins/org/src/components/Cards/OwnershipCard/OwnershipCard.tsx
@@ -16,7 +16,11 @@
import { Entity } from '@backstage/catalog-model';
import { InfoCard, Progress, useApi } from '@backstage/core';
-import { catalogApiRef, isOwnerOf } from '@backstage/plugin-catalog-react';
+import {
+ catalogApiRef,
+ isOwnerOf,
+ useEntity,
+} from '@backstage/plugin-catalog-react';
import { pageTheme } from '@backstage/theme';
import {
Box,
@@ -113,12 +117,13 @@ const EntityCountTile = ({
};
export const OwnershipCard = ({
- entity,
variant,
}: {
- entity: Entity;
+ /** @deprecated The entity is now grabbed from context instead */
+ entity?: Entity;
variant: string;
}) => {
+ const { entity } = useEntity();
const catalogApi = useApi(catalogApiRef);
const {
loading,
diff --git a/plugins/org/src/components/Cards/User/UserProfileCard/UserProfileCard.tsx b/plugins/org/src/components/Cards/User/UserProfileCard/UserProfileCard.tsx
index bdd0cd15f6..1cf7c968b3 100644
--- a/plugins/org/src/components/Cards/User/UserProfileCard/UserProfileCard.tsx
+++ b/plugins/org/src/components/Cards/User/UserProfileCard/UserProfileCard.tsx
@@ -19,7 +19,7 @@ import {
UserEntity,
} from '@backstage/catalog-model';
import { Avatar, InfoCard } from '@backstage/core';
-import { entityRouteParams } from '@backstage/plugin-catalog-react';
+import { useEntity, entityRouteParams } from '@backstage/plugin-catalog-react';
import { Box, Grid, Link, Tooltip, Typography } from '@material-ui/core';
import EmailIcon from '@material-ui/icons/Email';
import GroupIcon from '@material-ui/icons/Group';
@@ -60,12 +60,13 @@ const CardTitle = ({ title }: { title?: string }) =>
) : null;
export const UserProfileCard = ({
- entity: user,
variant,
}: {
- entity: UserEntity;
+ /** @deprecated The entity is now grabbed from context instead */
+ entity?: UserEntity;
variant: string;
}) => {
+ const user = useEntity().entity as UserEntity;
const {
metadata: { name: metaName },
spec: { profile },