From ba3bd87fa8c5f2bd196e39aef2aff17b62d41ae2 Mon Sep 17 00:00:00 2001 From: Fahim Ahmed <99824146+ahmedfahim21@users.noreply.github.com> Date: Tue, 18 Mar 2025 22:51:49 +0530 Subject: [PATCH] fix: Ensure S3 export is enabled only when Amazon S3 is active (#2330) --- .../run-report/run-report.component.ts | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/app/reports/run-report/run-report.component.ts b/src/app/reports/run-report/run-report.component.ts index 5289af67d..359b02990 100644 --- a/src/app/reports/run-report/run-report.component.ts +++ b/src/app/reports/run-report/run-report.component.ts @@ -85,12 +85,23 @@ export class RunReportComponent implements OnInit { this.route.data.subscribe((data: { reportParameters: ReportParameter[]; configurations: any }) => { this.paramData = data.reportParameters; if (this.isTableReport()) { - data.configurations.globalConfiguration.forEach((config: GlobalConfiguration) => { - if (config.name === 'report-export-s3-folder-name') { - this.exportToS3Allowed = config.enabled; - this.exportToS3Repository = config.stringValue; - } - }); + const amazonS3Config = data.configurations.globalConfiguration.find( + (config: GlobalConfiguration) => config.name === 'amazon-s3' + ); + const reportExportS3Config = data.configurations.globalConfiguration.find( + (config: GlobalConfiguration) => config.name === 'report-export-s3-folder-name' + ); + + if ( + amazonS3Config && + amazonS3Config.enabled && + reportExportS3Config && + reportExportS3Config.enabled && + reportExportS3Config.stringValue + ) { + this.exportToS3Allowed = true; + this.exportToS3Repository = reportExportS3Config.stringValue; + } } }); }