Replace deprecated humanizeEntityRef with Catalog Presentation API

Migrate all humanizeEntityRef and humanizeEntity usages to the Catalog
Presentation API across catalog, catalog-react, org-react,
catalog-import, scaffolder, and techdocs plugins.

- Use useEntityPresentation hook in React component contexts
  (AncestryPage)
- Use defaultEntityPresentation for non-React contexts like sort
  comparators, filter functions, and data mappers
- Add @deprecated tags to humanizeEntityRef and humanizeEntity
- Improve TSDoc on entityPresentationApiRef, EntityPresentationApi,
  useEntityPresentation, EntityDisplayName, and
  defaultEntityPresentation with guidance on which to use when
- Add Entity Presentation docs page with usage examples and migration
  guide

Made-with: Cursor

Signed-off-by: Marat Dyatko <maratd@spotify.com>
This commit is contained in:
Marat Dyatko
2026-03-25 16:15:27 +01:00
parent 36d205a455
commit 5f9a531412
24 changed files with 275 additions and 69 deletions
@@ -16,8 +16,8 @@
import { RELATION_OWNED_BY, Entity } from '@backstage/catalog-model';
import {
defaultEntityPresentation,
getEntityRelations,
humanizeEntityRef,
} from '@backstage/plugin-catalog-react';
import { toLowerMaybe } from '../../../helpers';
import { ConfigApi, RouteFunc } from '@backstage/core-plugin-api';
@@ -48,7 +48,11 @@ export function entitiesToDocsMapper(
}),
ownedByRelations,
ownedByRelationsTitle: ownedByRelations
.map(r => humanizeEntityRef(r, { defaultKind: 'group' }))
.map(
r =>
defaultEntityPresentation(r, { defaultKind: 'group' })
.primaryTitle,
)
.join(', '),
},
};