From 08e506e9eb73bfb1f1a8d0c8203ea7c70ba65582 Mon Sep 17 00:00:00 2001 From: Shashank Sharma Date: Fri, 27 Oct 2023 19:04:47 +0530 Subject: [PATCH 1/2] Fixes dirty values getting stored in localStorage. --- web/src/auth/AuthStore.ts | 4 +++- web/src/services/auth/AuthMapper.ts | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/web/src/auth/AuthStore.ts b/web/src/auth/AuthStore.ts index 2186631c5..9a9850b0b 100644 --- a/web/src/auth/AuthStore.ts +++ b/web/src/auth/AuthStore.ts @@ -89,7 +89,9 @@ class AuthStore { }; } // Updating user and selected org. - LocalStorage.setItem(LocalStorageKey.SELECTED_ORG, this.user?.selectedOrg); + if (this.user?.selectedOrg) { + LocalStorage.setItem(LocalStorageKey.SELECTED_ORG, this.user?.selectedOrg); + } LocalStorage.setItem(LocalStorageKey.USER, this.user); } } diff --git a/web/src/services/auth/AuthMapper.ts b/web/src/services/auth/AuthMapper.ts index 99d156a27..40d383866 100644 --- a/web/src/services/auth/AuthMapper.ts +++ b/web/src/services/auth/AuthMapper.ts @@ -7,7 +7,7 @@ export class AuthMapper { ...response, data: { ...response.data, - name: response.data.name, + name: response.data?.name, }, }; } From d49a363fbe68831248520db5b0ce899124bb38fd Mon Sep 17 00:00:00 2001 From: Shashank Sharma Date: Fri, 27 Oct 2023 19:45:17 +0530 Subject: [PATCH 2/2] Ignoring bulk status update --- api/src/reconciliation/reconciliation.controller.ts | 13 ++++++++++++- api/src/stream/stream.comp-reconcile.service.ts | 6 ++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/api/src/reconciliation/reconciliation.controller.ts b/api/src/reconciliation/reconciliation.controller.ts index ae8f4fbb1..3e2e7317f 100644 --- a/api/src/reconciliation/reconciliation.controller.ts +++ b/api/src/reconciliation/reconciliation.controller.ts @@ -390,7 +390,7 @@ export class ReconciliationController { const terminationRequests = waitingWorkflows.map((w) => TerminateWorkflow(org, w.lastWorkflowRunId) ); - const resp = await Promise.allSettled(terminationRequests); + const resp = await Promise.allSettled(terminationRequests); const failedResps = resp.filter((r) => r.status === 'rejected'); if (failedResps.length > 0) { this.logger.error({ @@ -417,6 +417,17 @@ export class ReconciliationController { })); await this.reconSvc.bulkUpdateCompRecon(compReconUpdates); + + + const components = await this.compSvc.getAllForEnvironmentById(org, envRecon.environment); + const updateComponents = components.map(comp => { + delete comp.latestCompRecon; + const date = new Date().toISOString(); + comp.lastReconcileDatetime = date; + return comp; + }); + await this.compSvc.bulkUpdate(updateComponents); + delete envRecon.componentReconciles; await this.reconSvc.updateEnvRecon(envRecon, { status: 'cancelled', diff --git a/api/src/stream/stream.comp-reconcile.service.ts b/api/src/stream/stream.comp-reconcile.service.ts index 09f736d97..29db21ff7 100644 --- a/api/src/stream/stream.comp-reconcile.service.ts +++ b/api/src/stream/stream.comp-reconcile.service.ts @@ -53,6 +53,12 @@ export class StreamComponentReconcileService this.eventColumns.has(col.propertyName) ) ) { + if ( + event.updatedColumns.find((col) => col.propertyName === 'status') && + ['waiting_for_parent', 'cancelled'].includes(compRecon.status) + ) { + return; + } if ( event.updatedColumns.find((col) => col.propertyName === 'estimatedCost') ) {