From 4ef0dcfd0ab5826ec0dbd632e509fb26a8268eb2 Mon Sep 17 00:00:00 2001 From: Eric Peterson Date: Mon, 8 Apr 2024 16:37:32 +0200 Subject: [PATCH] Also add the entity presentation API in app-next apps Signed-off-by: Eric Peterson --- .changeset/catalog-next-presentation-tho.md | 5 +++++ plugins/catalog/src/alpha/apis.tsx | 17 +++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 .changeset/catalog-next-presentation-tho.md diff --git a/.changeset/catalog-next-presentation-tho.md b/.changeset/catalog-next-presentation-tho.md new file mode 100644 index 0000000000..0694240b21 --- /dev/null +++ b/.changeset/catalog-next-presentation-tho.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-catalog': patch +--- + +Fixed a bug that prevented the default `entityPresentationApi` from being set in apps using the new frontend system. diff --git a/plugins/catalog/src/alpha/apis.tsx b/plugins/catalog/src/alpha/apis.tsx index ae8dcf9a9a..92880ba728 100644 --- a/plugins/catalog/src/alpha/apis.tsx +++ b/plugins/catalog/src/alpha/apis.tsx @@ -24,9 +24,13 @@ import { CatalogClient } from '@backstage/catalog-client'; import { createApiExtension } from '@backstage/frontend-plugin-api'; import { catalogApiRef, + entityPresentationApiRef, starredEntitiesApiRef, } from '@backstage/plugin-catalog-react'; -import { DefaultStarredEntitiesApi } from '../apis'; +import { + DefaultEntityPresentationApi, + DefaultStarredEntitiesApi, +} from '../apis'; export const catalogApi = createApiExtension({ factory: createApiFactory({ @@ -48,4 +52,13 @@ export const catalogStarredEntitiesApi = createApiExtension({ }), }); -export default [catalogApi, catalogStarredEntitiesApi]; +export const entityPresentationApi = createApiExtension({ + factory: createApiFactory({ + api: entityPresentationApiRef, + deps: { catalogApiImp: catalogApiRef }, + factory: ({ catalogApiImp }) => + DefaultEntityPresentationApi.create({ catalogApi: catalogApiImp }), + }), +}); + +export default [catalogApi, catalogStarredEntitiesApi, entityPresentationApi];