From d408af872a72f48404f18b5587d604700454a6ed Mon Sep 17 00:00:00 2001 From: Dominik Henneke Date: Mon, 28 Jun 2021 18:42:30 +0200 Subject: [PATCH] Only return the selected fields from the new catalog Signed-off-by: Dominik Henneke --- .changeset/small-kings-repair.md | 5 +++++ plugins/catalog-backend/src/next/NextEntitiesCatalog.ts | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 .changeset/small-kings-repair.md diff --git a/.changeset/small-kings-repair.md b/.changeset/small-kings-repair.md new file mode 100644 index 0000000000..498126d8e6 --- /dev/null +++ b/.changeset/small-kings-repair.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-catalog-backend': patch +--- + +Only return the selected fields from the new catalog. diff --git a/plugins/catalog-backend/src/next/NextEntitiesCatalog.ts b/plugins/catalog-backend/src/next/NextEntitiesCatalog.ts index a7be2aef10..f3921602e2 100644 --- a/plugins/catalog-backend/src/next/NextEntitiesCatalog.ts +++ b/plugins/catalog-backend/src/next/NextEntitiesCatalog.ts @@ -133,8 +133,14 @@ export class NextEntitiesCatalog implements EntitiesCatalog { }; } + const dbResponse = rows.map(e => JSON.parse(e.final_entity!)); + + const entities = dbResponse.map(e => + request?.fields ? request.fields(e) : e, + ); + return { - entities: rows.map(e => JSON.parse(e.final_entity!)), + entities, pageInfo, }; }