From a4625ae1eb975e66d41d44db1a6e7f8ae68866af Mon Sep 17 00:00:00 2001 From: "isiryder@gmail.com" Date: Thu, 19 Sep 2024 09:51:51 +0100 Subject: [PATCH] Add applicationId hidden field to reports --- backend/extractionSteps/JobStepBase.py | 11 +++++++---- backend/output/reports/AgentMatrixReport.py | 10 ++++++++-- backend/output/reports/CustomMetricsReport.py | 6 +++++- backend/output/reports/DashboardReport.py | 2 +- backend/output/reports/LicenseReport.py | 2 +- backend/output/reports/MaturityAssessmentReport.py | 7 +++++-- backend/output/reports/SyntheticsReport.py | 5 ++++- backend/util/excel_utils.py | 2 +- 8 files changed, 32 insertions(+), 13 deletions(-) diff --git a/backend/extractionSteps/JobStepBase.py b/backend/extractionSteps/JobStepBase.py index 0b94f05..4838a80 100644 --- a/backend/extractionSteps/JobStepBase.py +++ b/backend/extractionSteps/JobStepBase.py @@ -49,9 +49,10 @@ def reportData( return rawDataHeaders = list(list(controllerData.values())[0][self.componentType].values())[0][jobStepName][metricFolder].keys() - headers = ["controller", "application"] + (["description"] if self.componentType == "apm" else []) + list(rawDataHeaders) + headers = ["controller", "application", "applicationId"] + (["description"] if self.componentType == "apm" else []) + list(rawDataHeaders) writeUncoloredRow(rawDataSheet, 1, headers) + rawDataSheet.column_dimensions["C"].hidden = True # Write Data rowIdx = 2 @@ -61,10 +62,11 @@ def reportData( data = [ ( hostInfo["controller"].host, None), ( application["name"], None), + ( application["applicationId"] if self.componentType == "mrum" else application["id"], None), *[application[jobStepName][metricFolder][header] for header in rawDataHeaders] ] if self.componentType == "apm": - data.insert(2, ( application["description"], None)) + data.insert(3, ( application["description"], None)) writeColoredRow( rawDataSheet, rowIdx, @@ -74,10 +76,11 @@ def reportData( data = [ hostInfo["controller"].host, application["name"], + application["applicationId"] if self.componentType == "mrum" else application["id"], *[application[jobStepName][metricFolder][header] for header in rawDataHeaders] ] if self.componentType == "apm": - data.insert(2, application["description"]) + data.insert(3, application["description"]) writeUncoloredRow( rawDataSheet, rowIdx, @@ -85,7 +88,7 @@ def reportData( ) rowIdx += 1 - addFilterAndFreeze(rawDataSheet) + addFilterAndFreeze(rawDataSheet, "E2") if self.componentType == "apm" else addFilterAndFreeze(rawDataSheet, "D2") resizeColumnWidth(rawDataSheet) def applyThresholds(self, analysisDataEvaluatedMetrics, analysisDataRoot, jobStepThresholds): diff --git a/backend/output/reports/AgentMatrixReport.py b/backend/output/reports/AgentMatrixReport.py index acffad9..1b6595e 100644 --- a/backend/output/reports/AgentMatrixReport.py +++ b/backend/output/reports/AgentMatrixReport.py @@ -22,7 +22,9 @@ def createWorkbook(self, jobs, controllerData, jobFileName): logging.debug(f"Creating workbook sheet for App Agents") appAgentsSheet = workbook.create_sheet(f"Overall - App Agents") - writeUncoloredRow(appAgentsSheet, 1, ["controller", "application", *allAppAgentVersions]) + writeUncoloredRow(appAgentsSheet, 1, ["controller", "application", "applicationId", *allAppAgentVersions]) + appAgentsSheet.column_dimensions["C"].hidden = True + # Write Data rowIdx = 2 for host, hostInfo in controllerData.items(): @@ -41,6 +43,7 @@ def createWorkbook(self, jobs, controllerData, jobFileName): [ hostInfo["controller"].host, application["name"], + application["id"], *agentCountRow, ], ) @@ -60,8 +63,10 @@ def createWorkbook(self, jobs, controllerData, jobFileName): writeUncoloredRow( machineAgentsSheet, 1, - ["controller", "application", *allMachineAgentVersions], + ["controller", "application", "applicationId", *allMachineAgentVersions], ) + machineAgentsSheet.column_dimensions["C"].hidden = True + # Write Data rowIdx = 2 for host, hostInfo in controllerData.items(): @@ -80,6 +85,7 @@ def createWorkbook(self, jobs, controllerData, jobFileName): [ hostInfo["controller"].host, application["name"], + application["id"], *agentCountRow, ], ) diff --git a/backend/output/reports/CustomMetricsReport.py b/backend/output/reports/CustomMetricsReport.py index dc8bdf5..26a5cb7 100644 --- a/backend/output/reports/CustomMetricsReport.py +++ b/backend/output/reports/CustomMetricsReport.py @@ -29,10 +29,13 @@ def createWorkbook(self, jobs, controllerData, jobFileName): "controller", "componentType", "application", + "applicationId", *allExtensions, ], ) + summarySheet.column_dimensions["D"].hidden = True + rowIdx = 2 for host, hostInfo in controllerData.items(): for component in hostInfo["apm"].values(): @@ -43,12 +46,13 @@ def createWorkbook(self, jobs, controllerData, jobFileName): hostInfo["controller"].host, "apm", component["name"], + component["id"], *[(True if e in component["customMetrics"] else False) for e in allExtensions], ], ) rowIdx += 1 - addFilterAndFreeze(summarySheet) + addFilterAndFreeze(summarySheet, "E2") resizeColumnWidth(summarySheet) logging.debug(f"Saving CustomMetrics Workbook") diff --git a/backend/output/reports/DashboardReport.py b/backend/output/reports/DashboardReport.py index 6c9b683..5b9358c 100644 --- a/backend/output/reports/DashboardReport.py +++ b/backend/output/reports/DashboardReport.py @@ -33,7 +33,7 @@ def createWorkbook(self, jobs, controllerData, jobFileName): ) rowIdx += 1 - addFilterAndFreeze(dashboardSheet) + addFilterAndFreeze(dashboardSheet, "C2") resizeColumnWidth(dashboardSheet) logging.debug(f"Saving Dashboard Workbook") diff --git a/backend/output/reports/LicenseReport.py b/backend/output/reports/LicenseReport.py index d553ec8..ee3dbfb 100644 --- a/backend/output/reports/LicenseReport.py +++ b/backend/output/reports/LicenseReport.py @@ -47,7 +47,7 @@ def createWorkbook(self, jobs, controllerData, jobFileName): ) rowIdx += 1 - addFilterAndFreeze(licenseSheet) + addFilterAndFreeze(licenseSheet, "C2") resizeColumnWidth(licenseSheet) logging.debug(f"Saving License Workbook") diff --git a/backend/output/reports/MaturityAssessmentReport.py b/backend/output/reports/MaturityAssessmentReport.py index 55a256f..dc1313a 100644 --- a/backend/output/reports/MaturityAssessmentReport.py +++ b/backend/output/reports/MaturityAssessmentReport.py @@ -30,11 +30,12 @@ def createWorkbook(self, jobs, controllerData, jobFileName): "controller", "componentType", "name", + "applicationId", *jobNameCols, ] if reportType == "apm": # add desc header after name - data_header.insert(3, "description") + data_header.insert(4, "description") # Write Headers writeUncoloredRow( @@ -42,6 +43,7 @@ def createWorkbook(self, jobs, controllerData, jobFileName): 1, data_header ) + analysisSheet.column_dimensions["D"].hidden = True rowIdx = 2 for host, hostInfo in controllerData.items(): @@ -51,6 +53,7 @@ def createWorkbook(self, jobs, controllerData, jobFileName): (hostInfo["controller"].host, None), (reportType, None), (component["name"], None), + (component["applicationId"] if reportType == "mrum" else component["id"], None), *[component[jobStep]["computed"] for jobStep in [type(jobStep).__name__ for jobStep in filteredJobs]], ] @@ -64,7 +67,7 @@ def createWorkbook(self, jobs, controllerData, jobFileName): ) rowIdx += 1 - addFilterAndFreeze(analysisSheet) + addFilterAndFreeze(analysisSheet, "E2") resizeColumnWidth(analysisSheet) # Now that we have the data , Populate the summary sheet with headers diff --git a/backend/output/reports/SyntheticsReport.py b/backend/output/reports/SyntheticsReport.py index 743c02b..cf0961e 100644 --- a/backend/output/reports/SyntheticsReport.py +++ b/backend/output/reports/SyntheticsReport.py @@ -52,6 +52,7 @@ def createWorkbook(self, jobs, controllerData, jobFileName): "host": (host, color), "componentType": ("brum", color), "application": (application["name"], color), + "applicationId": (application["id"], color), "jobName": (syntheticJob["config"]["description"], color), "numberOfWebDriverCalls": (numberOfWebDriverCalls, color), "projectedDailyRuns": (syntheticJob["config"]["projectedUsage"]["projectedDailyRuns"], color), @@ -95,7 +96,9 @@ def createWorkbook(self, jobs, controllerData, jobFileName): ) rowIdx += 1 - addFilterAndFreeze(summarySheet, freezePane="E2") + summarySheet.column_dimensions["D"].hidden = True + + addFilterAndFreeze(summarySheet, freezePane="F2") resizeColumnWidth(summarySheet) logging.debug(f"Saving Synthetics Workbook") diff --git a/backend/util/excel_utils.py b/backend/util/excel_utils.py index 864ed11..9aac063 100644 --- a/backend/util/excel_utils.py +++ b/backend/util/excel_utils.py @@ -107,7 +107,7 @@ def resizeColumnWidth(sheet: Worksheet): sheet.column_dimensions[col].width = value + headerFilterArrowPadding -def addFilterAndFreeze(sheet: Worksheet, freezePane: str = "C2"): +def addFilterAndFreeze(sheet: Worksheet, freezePane: str = "D2"): """Add filter on headers and freeze the first 2 columns and 1 row.""" sheet.auto_filter.ref = sheet.dimensions # Freeze controller and application columns