From 04b2ecd23cea85ef6a989bd1f2a2b33e7bc41daf Mon Sep 17 00:00:00 2001 From: Elliot Greenwood Date: Tue, 23 Feb 2021 23:55:48 +0000 Subject: [PATCH] Add link to owner from the techdocs header Signed-off-by: Elliot Greenwood --- .../reader/components/TechDocsPageHeader.tsx | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/plugins/techdocs/src/reader/components/TechDocsPageHeader.tsx b/plugins/techdocs/src/reader/components/TechDocsPageHeader.tsx index 7b0c2e64cc..2038c74d72 100644 --- a/plugins/techdocs/src/reader/components/TechDocsPageHeader.tsx +++ b/plugins/techdocs/src/reader/components/TechDocsPageHeader.tsx @@ -17,10 +17,10 @@ import React from 'react'; import { AsyncState } from 'react-use/lib/useAsync'; import CodeIcon from '@material-ui/icons/Code'; -import { EntityName } from '@backstage/catalog-model'; +import { EntityName, parseEntityName } from '@backstage/catalog-model'; import { Header, HeaderLabel, Link, useRouteRef } from '@backstage/core'; import { TechDocsMetadata } from '../../types'; -import { entityRouteRef } from '@backstage/plugin-catalog-react'; +import { EntityRefLink, entityRouteRef } from '@backstage/plugin-catalog-react'; type TechDocsPageHeaderProps = { entityId: EntityName; @@ -54,6 +54,11 @@ export const TechDocsPageHeader = ({ const componentLink = useRouteRef(entityRouteRef); + let ownerEntity; + if (owner) { + ownerEntity = parseEntityName(owner, { defaultKind: 'group' }); + } + const labels = ( <> } /> - {owner ? : null} + {owner ? ( + + ) : ( + owner + ) + } + /> + ) : null} {lifecycle ? : null} {locationMetadata && locationMetadata.type !== 'dir' &&