Merge pull request #33576 from backstage/maratd/replace-humanize-entity-ref

Replace deprecated humanizeEntityRef with Catalog Presentation API
This commit is contained in:
Fredrik Adelöw
2026-04-07 14:28:39 +02:00
committed by GitHub
28 changed files with 693 additions and 91 deletions
@@ -16,8 +16,9 @@
import { RELATION_OWNED_BY, Entity } from '@backstage/catalog-model';
import {
entityPresentationSnapshot,
getEntityRelations,
humanizeEntityRef,
type EntityPresentationApi,
} from '@backstage/plugin-catalog-react';
import { toLowerMaybe } from '../../../helpers';
import { ConfigApi, RouteFunc } from '@backstage/core-plugin-api';
@@ -32,6 +33,7 @@ export function entitiesToDocsMapper(
entities: Entity[],
getRouteToReaderPageFor: getRouteFunc,
config: ConfigApi,
entityPresentationApi?: EntityPresentationApi,
) {
return entities.map(entity => {
const ownedByRelations = getEntityRelations(entity, RELATION_OWNED_BY);
@@ -48,7 +50,14 @@ export function entitiesToDocsMapper(
}),
ownedByRelations,
ownedByRelationsTitle: ownedByRelations
.map(r => humanizeEntityRef(r, { defaultKind: 'group' }))
.map(
r =>
entityPresentationSnapshot(
r,
{ defaultKind: 'group' },
entityPresentationApi,
).primaryTitle,
)
.join(', '),
},
};