From 099c5cf4fec87de88d9c7f6d97fa4595858ff6f5 Mon Sep 17 00:00:00 2001 From: Oliver Sand Date: Thu, 21 Jan 2021 15:27:40 +0100 Subject: [PATCH] Show the parent component in the about card (via partOf relationship) --- .changeset/few-geckos-shout.md | 5 +++++ .../src/components/AboutCard/AboutContent.tsx | 20 +++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 .changeset/few-geckos-shout.md diff --git a/.changeset/few-geckos-shout.md b/.changeset/few-geckos-shout.md new file mode 100644 index 0000000000..169d22cad1 --- /dev/null +++ b/.changeset/few-geckos-shout.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-catalog': patch +--- + +Show the parent component in the about card (via partOf relationship) diff --git a/plugins/catalog/src/components/AboutCard/AboutContent.tsx b/plugins/catalog/src/components/AboutCard/AboutContent.tsx index 178debb42a..24b4376f30 100644 --- a/plugins/catalog/src/components/AboutCard/AboutContent.tsx +++ b/plugins/catalog/src/components/AboutCard/AboutContent.tsx @@ -40,9 +40,17 @@ export const AboutContent = ({ entity }: Props) => { const isSystem = entity.kind.toLowerCase() === 'system'; const isDomain = entity.kind.toLowerCase() === 'domain'; const isResource = entity.kind.toLowerCase() === 'resource'; + const isComponent = entity.kind.toLowerCase() === 'component'; const [partOfSystemRelation] = getEntityRelations(entity, RELATION_PART_OF, { kind: 'system', }); + const [partOfComponentRelation] = getEntityRelations( + entity, + RELATION_PART_OF, + { + kind: 'component', + }, + ); const [partOfDomainRelation] = getEntityRelations(entity, RELATION_PART_OF, { kind: 'domain', }); @@ -91,6 +99,18 @@ export const AboutContent = ({ entity }: Props) => { )} )} + {isComponent && partOfComponentRelation && ( + + + + )} {!isSystem && !isDomain && (