Address PR review feedback from freben
- Consolidate changesets: one for catalog-react (deprecation), one combined for the remaining 5 plugins - Add entity-presentation to microsite/sidebars.ts - Update @deprecated tags to point to useEntityPresentation / entityPresentationApiRef only, not defaultEntityPresentation - Use entityPresentationApiRef with .promise in async loaders (StepPrepareCreatePullRequest, TemplateFormPreviewer) - Add optional entityPresentation?: EntityPresentationApi param to sync column factories and use .snapshot when available (columnFactories, EntityTable/columns, EntityOwnerPicker, CatalogTable) - Rewrite entity-presentation.md to recommend .snapshot/.promise instead of defaultEntityPresentation - Update TSDoc on entityPresentationApiRef, EntityPresentationApi, defaultEntityPresentation, useEntityPresentation, EntityDisplayName - Re-export presentation API types from alpha entry point - Update API reports - Fix test mocks for entityPresentationApiRef Made-with: Cursor Signed-off-by: Marat Dyatko <maratd@spotify.com> Made-with: Cursor
This commit is contained in:
@@ -14,10 +14,15 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { RELATION_OWNED_BY, Entity } from '@backstage/catalog-model';
|
||||
import {
|
||||
RELATION_OWNED_BY,
|
||||
Entity,
|
||||
stringifyEntityRef,
|
||||
} from '@backstage/catalog-model';
|
||||
import {
|
||||
defaultEntityPresentation,
|
||||
getEntityRelations,
|
||||
type EntityPresentationApi,
|
||||
} from '@backstage/plugin-catalog-react';
|
||||
import { toLowerMaybe } from '../../../helpers';
|
||||
import { ConfigApi, RouteFunc } from '@backstage/core-plugin-api';
|
||||
@@ -32,6 +37,7 @@ export function entitiesToDocsMapper(
|
||||
entities: Entity[],
|
||||
getRouteToReaderPageFor: getRouteFunc,
|
||||
config: ConfigApi,
|
||||
entityPresentation?: EntityPresentationApi,
|
||||
) {
|
||||
return entities.map(entity => {
|
||||
const ownedByRelations = getEntityRelations(entity, RELATION_OWNED_BY);
|
||||
@@ -48,11 +54,15 @@ export function entitiesToDocsMapper(
|
||||
}),
|
||||
ownedByRelations,
|
||||
ownedByRelationsTitle: ownedByRelations
|
||||
.map(
|
||||
r =>
|
||||
defaultEntityPresentation(r, { defaultKind: 'group' })
|
||||
.primaryTitle,
|
||||
)
|
||||
.map(r => {
|
||||
if (entityPresentation) {
|
||||
return entityPresentation.forEntity(stringifyEntityRef(r), {
|
||||
defaultKind: 'group',
|
||||
}).snapshot.primaryTitle;
|
||||
}
|
||||
return defaultEntityPresentation(r, { defaultKind: 'group' })
|
||||
.primaryTitle;
|
||||
})
|
||||
.join(', '),
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user