From b2efa2020e7c527c5eaace68af027f1d834e8dd0 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Wed, 21 Oct 2020 17:23:11 +0200 Subject: [PATCH] catalog: use the ownerBy relation to display owners Co-authored-by: blam --- .../src/components/AboutCard/AboutCard.tsx | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/plugins/catalog/src/components/AboutCard/AboutCard.tsx b/plugins/catalog/src/components/AboutCard/AboutCard.tsx index 266d5fa843..be5d6b815b 100644 --- a/plugins/catalog/src/components/AboutCard/AboutCard.tsx +++ b/plugins/catalog/src/components/AboutCard/AboutCard.tsx @@ -14,7 +14,12 @@ * limitations under the License. */ -import { Entity, ENTITY_DEFAULT_NAMESPACE } from '@backstage/catalog-model'; +import { + Entity, + ENTITY_DEFAULT_NAMESPACE, + RELATION_OWNED_BY, + serializeEntityRef, +} from '@backstage/catalog-model'; import { Card, CardContent, @@ -139,7 +144,20 @@ export function AboutCard({ entity, variant }: AboutCardProps) { r.type === RELATION_OWNED_BY) + .map(({ target: { kind, name, namespace } }) => + // TODO(Rugvip): we want to provide some utils for this + serializeEntityRef({ + kind, + name, + namespace: + namespace === ENTITY_DEFAULT_NAMESPACE + ? undefined + : namespace, + }), + ) + .join(', ')} gridSizes={{ xs: 12, sm: 6, lg: 4 }} />