diff --git a/.changeset/sour-boxes-travel.md b/.changeset/sour-boxes-travel.md new file mode 100644 index 0000000000..319bcd24c2 --- /dev/null +++ b/.changeset/sour-boxes-travel.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-catalog': patch +--- + +unify how the owner and lifecycle header labels are made diff --git a/plugins/catalog/src/components/EntityLayout/EntityLayout.tsx b/plugins/catalog/src/components/EntityLayout/EntityLayout.tsx index 87a1a48e92..6a9fa38e73 100644 --- a/plugins/catalog/src/components/EntityLayout/EntityLayout.tsx +++ b/plugins/catalog/src/components/EntityLayout/EntityLayout.tsx @@ -14,7 +14,11 @@ * limitations under the License. */ -import { Entity, ENTITY_DEFAULT_NAMESPACE } from '@backstage/catalog-model'; +import { + Entity, + ENTITY_DEFAULT_NAMESPACE, + RELATION_OWNED_BY, +} from '@backstage/catalog-model'; import { Content, Header, @@ -26,6 +30,8 @@ import { } from '@backstage/core'; import { EntityContext, + EntityRefLinks, + getEntityRelations, useEntityCompoundName, } from '@backstage/plugin-catalog-react'; import { Box } from '@material-ui/core'; @@ -75,6 +81,29 @@ const headerProps = ( }; }; +const EntityLabels = ({ entity }: { entity: Entity }) => { + const ownedByRelations = getEntityRelations(entity, RELATION_OWNED_BY); + return ( + <> + {ownedByRelations.length > 0 && ( + + } + /> + )} + {entity.spec?.lifecycle && ( + + )} + + ); +}; + // NOTE(freben): Intentionally not exported at this point, since it's part of // the unstable extra context menu items concept below type ExtraContextMenuItem = { @@ -133,17 +162,9 @@ export const EntityLayout = ({ pageTitleOverride={headerTitle} type={headerType} > - {/* TODO: fix after catalog page customization is added */} - {entity && kind !== 'user' && ( + {entity && ( <> - - + { const ownedByRelations = getEntityRelations(entity, RELATION_OWNED_BY); - return ( <> {ownedByRelations.length > 0 && ( + } /> )}