From 7da60b5b4f5c9df18b524ad2d0957121d2b3cbed Mon Sep 17 00:00:00 2001 From: iris Date: Mon, 12 Dec 2022 12:36:16 +0800 Subject: [PATCH] revert changes about adding backstage.io/last_updated_at Signed-off-by: iris --- .../src/service/DefaultEntitiesCatalog.ts | 25 +++---------------- 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/plugins/catalog-backend/src/service/DefaultEntitiesCatalog.ts b/plugins/catalog-backend/src/service/DefaultEntitiesCatalog.ts index a305df52e3..14f22f862b 100644 --- a/plugins/catalog-backend/src/service/DefaultEntitiesCatalog.ts +++ b/plugins/catalog-backend/src/service/DefaultEntitiesCatalog.ts @@ -210,14 +210,7 @@ export class DefaultEntitiesCatalog implements EntitiesCatalog { }; } - let entities: Entity[] = rows.map(e => { - const entityJson = JSON.parse(e.final_entity!); - if (e.last_updated_at) { - entityJson.metadata.annotations['backstage.io/last_updated_at'] = - e.last_updated_at; - } - return entityJson; - }); + let entities: Entity[] = rows.map(e => JSON.parse(e.final_entity!)); if (request?.fields) { entities = entities.map(e => request.fields!(e)); @@ -270,12 +263,7 @@ export class DefaultEntitiesCatalog implements EntitiesCatalog { query = parseFilter(request.filter, query, this.database); } for (const row of await query) { - const entityJson = JSON.parse(row.entity); - if (row.entity.last_updated_at) { - entityJson.metadata.annotations['backstage.io/last_updated_at'] = - row.entity.last_updated_at; - } - lookup.set(row.entityRef, row.entity ? entityJson : null); + lookup.set(row.entityRef, row.entity ? JSON.parse(row.entity) : null); } } @@ -385,18 +373,13 @@ export class DefaultEntitiesCatalog implements EntitiesCatalog { .where('refresh_state.entity_ref', '=', rootRef) .select({ entityJson: 'final_entities.final_entity', - last_updated_at: 'final_entities.last_updated_at', }); if (!rootRow) { throw new NotFoundError(`No such entity ${rootRef}`); } - const entityJson = JSON.parse(rootRow.entityJson); - if (rootRow.last_updated_at) { - entityJson.metadata.annotations['backstage.io/last_updated_at'] = - rootRow.last_updated_at; - } - const rootEntity = entityJson as Entity; + + const rootEntity = JSON.parse(rootRow.entityJson) as Entity; const seenEntityRefs = new Set(); const todo = new Array(); const items = new Array<{ entity: Entity; parentEntityRefs: string[] }>();