diff --git a/plugins/org/src/components/Cards/OwnershipCard/ComponentsGrid.tsx b/plugins/org/src/components/Cards/OwnershipCard/ComponentsGrid.tsx index ba037f791c..f996342454 100644 --- a/plugins/org/src/components/Cards/OwnershipCard/ComponentsGrid.tsx +++ b/plugins/org/src/components/Cards/OwnershipCard/ComponentsGrid.tsx @@ -57,16 +57,16 @@ const EntityCountTile = ({ counter, type, kind, - name, url, }: { counter: number; - type: string; + type?: string; kind: string; - name: string; url: string; }) => { - const classes = useStyles({ type }); + const classes = useStyles({ type: type ?? kind }); + + const rawTitle = type ?? kind; return ( @@ -80,9 +80,9 @@ const EntityCountTile = ({ {counter} - {pluralize(name, counter)} + {pluralize(rawTitle.toLocaleUpperCase('en-US'), counter)} - {kind !== type && {kind}} + {type && {kind}} ); @@ -116,12 +116,11 @@ export const ComponentsGrid = ({ return ( {componentsWithCounters?.map(c => ( - + diff --git a/plugins/org/src/components/Cards/OwnershipCard/useGetEntities.ts b/plugins/org/src/components/Cards/OwnershipCard/useGetEntities.ts index 3756e6827e..b36c41c459 100644 --- a/plugins/org/src/components/Cards/OwnershipCard/useGetEntities.ts +++ b/plugins/org/src/components/Cards/OwnershipCard/useGetEntities.ts @@ -136,7 +136,6 @@ export function useGetEntities( counter: number; type: string; kind: string; - name: string; queryParams: string; }[] | undefined; @@ -174,16 +173,14 @@ export function useGetEntities( const counts = ownedEntitiesList.items.reduce( (acc: EntityTypeProps[], ownedEntity) => { const match = acc.find( - x => - x.kind === ownedEntity.kind && - x.type === (ownedEntity.spec?.type ?? ownedEntity.kind), + x => x.kind === ownedEntity.kind && x.type === ownedEntity.spec?.type, ); if (match) { match.count += 1; } else { acc.push({ kind: ownedEntity.kind, - type: ownedEntity.spec?.type?.toString() ?? ownedEntity.kind, + type: ownedEntity.spec?.type?.toString(), count: 1, }); } @@ -199,13 +196,11 @@ export function useGetEntities( counter: topOwnedEntity.count, type: topOwnedEntity.type, kind: topOwnedEntity.kind, - name: topOwnedEntity.type.toLocaleUpperCase('en-US'), queryParams: getQueryParams(owners, topOwnedEntity), })) as Array<{ counter: number; type: string; kind: string; - name: string; queryParams: string; }>; }, [catalogApi, entity, relationsType]);