Show domain for systems and hide other fields if the don't apply for the kind
This commit is contained in:
@@ -2,4 +2,5 @@
|
||||
'@backstage/plugin-catalog': patch
|
||||
---
|
||||
|
||||
Display the owner and system as links to the entity pages in the about card.
|
||||
Display the owner, system, and domain as links to the entity pages in the about card.
|
||||
Only display fields in the about card that are applicable to the entity kind.
|
||||
|
||||
@@ -37,9 +37,15 @@ type Props = {
|
||||
|
||||
export const AboutContent = ({ entity }: Props) => {
|
||||
const classes = useStyles();
|
||||
const isSystem = entity.kind.toLowerCase() === 'system';
|
||||
const isDomain = entity.kind.toLowerCase() === 'domain';
|
||||
const isResource = entity.kind.toLowerCase() === 'resource';
|
||||
const [partOfSystemRelation] = getEntityRelations(entity, RELATION_PART_OF, {
|
||||
kind: 'system',
|
||||
});
|
||||
const [partOfDomainRelation] = getEntityRelations(entity, RELATION_PART_OF, {
|
||||
kind: 'domain',
|
||||
});
|
||||
const ownedByRelations = getEntityRelations(entity, RELATION_OWNED_BY);
|
||||
|
||||
return (
|
||||
@@ -57,28 +63,48 @@ export const AboutContent = ({ entity }: Props) => {
|
||||
</React.Fragment>
|
||||
))}
|
||||
</AboutField>
|
||||
<AboutField
|
||||
label="System"
|
||||
value="No System"
|
||||
gridSizes={{ xs: 12, sm: 6, lg: 4 }}
|
||||
>
|
||||
{partOfSystemRelation && (
|
||||
<EntityRefLink
|
||||
entityRef={partOfSystemRelation}
|
||||
defaultKind="system"
|
||||
/>
|
||||
)}
|
||||
</AboutField>
|
||||
<AboutField
|
||||
label="Type"
|
||||
value={entity?.spec?.type as string}
|
||||
gridSizes={{ xs: 12, sm: 6, lg: 4 }}
|
||||
/>
|
||||
<AboutField
|
||||
label="Lifecycle"
|
||||
value={entity?.spec?.lifecycle as string}
|
||||
gridSizes={{ xs: 12, sm: 6, lg: 4 }}
|
||||
/>
|
||||
{isSystem && (
|
||||
<AboutField
|
||||
label="Domain"
|
||||
value="No Domain"
|
||||
gridSizes={{ xs: 12, sm: 6, lg: 4 }}
|
||||
>
|
||||
{partOfDomainRelation && (
|
||||
<EntityRefLink
|
||||
entityRef={partOfDomainRelation}
|
||||
defaultKind="domain"
|
||||
/>
|
||||
)}
|
||||
</AboutField>
|
||||
)}
|
||||
{!isSystem && !isDomain && (
|
||||
<AboutField
|
||||
label="System"
|
||||
value="No System"
|
||||
gridSizes={{ xs: 12, sm: 6, lg: 4 }}
|
||||
>
|
||||
{partOfSystemRelation && (
|
||||
<EntityRefLink
|
||||
entityRef={partOfSystemRelation}
|
||||
defaultKind="system"
|
||||
/>
|
||||
)}
|
||||
</AboutField>
|
||||
)}
|
||||
{!isSystem && !isDomain && (
|
||||
<AboutField
|
||||
label="Type"
|
||||
value={entity?.spec?.type as string}
|
||||
gridSizes={{ xs: 12, sm: 6, lg: 4 }}
|
||||
/>
|
||||
)}
|
||||
{!isSystem && !isDomain && !isResource && (
|
||||
<AboutField
|
||||
label="Lifecycle"
|
||||
value={entity?.spec?.lifecycle as string}
|
||||
gridSizes={{ xs: 12, sm: 6, lg: 4 }}
|
||||
/>
|
||||
)}
|
||||
<AboutField
|
||||
label="Tags"
|
||||
value="No Tags"
|
||||
|
||||
Reference in New Issue
Block a user