diff --git a/backend/extractionSteps/JobStepBase.py b/backend/extractionSteps/JobStepBase.py index 5231cbf..0b94f05 100644 --- a/backend/extractionSteps/JobStepBase.py +++ b/backend/extractionSteps/JobStepBase.py @@ -49,31 +49,39 @@ def reportData( return rawDataHeaders = list(list(controllerData.values())[0][self.componentType].values())[0][jobStepName][metricFolder].keys() - writeUncoloredRow(rawDataSheet, 1, ["controller", "application", *rawDataHeaders]) + headers = ["controller", "application"] + (["description"] if self.componentType == "apm" else []) + list(rawDataHeaders) + + writeUncoloredRow(rawDataSheet, 1, headers) # Write Data rowIdx = 2 for host, hostInfo in controllerData.items(): for application in hostInfo[self.componentType].values(): if colorRows: + data = [ + ( hostInfo["controller"].host, None), + ( application["name"], None), + *[application[jobStepName][metricFolder][header] for header in rawDataHeaders] + ] + if self.componentType == "apm": + data.insert(2, ( application["description"], None)) writeColoredRow( rawDataSheet, rowIdx, - [ - (hostInfo["controller"].host, None), - (application["name"], None), - *[application[jobStepName][metricFolder][header] for header in rawDataHeaders], - ], + data ) else: + data = [ + hostInfo["controller"].host, + application["name"], + *[application[jobStepName][metricFolder][header] for header in rawDataHeaders] + ] + if self.componentType == "apm": + data.insert(2, application["description"]) writeUncoloredRow( rawDataSheet, rowIdx, - [ - hostInfo["controller"].host, - application["name"], - *[application[jobStepName][metricFolder][header] for header in rawDataHeaders], - ], + data ) rowIdx += 1 diff --git a/backend/output/presentations/cxPptFsoUseCases.py b/backend/output/presentations/cxPptFsoUseCases.py index 018f139..33d174d 100644 --- a/backend/output/presentations/cxPptFsoUseCases.py +++ b/backend/output/presentations/cxPptFsoUseCases.py @@ -62,8 +62,12 @@ class ExcelSheets(object): def __init__(self, directory: str, filenames: tuple): self.workbooks = {} for filename in filenames: - full_path = os.path.join(directory, filename) - self.workbooks[filename] = pd.read_excel(full_path, sheet_name=None) + try: + full_path = os.path.join(directory, filename) + self.workbooks[filename] = pd.read_excel(full_path, sheet_name=None) + except Exception as e: + logging.warning(f"Not able to load workbook {filename}") + logging.warning(f"Was it generated to begin with? Ignoring.") def findSheetByHeader(self, header_name): result = [] @@ -539,8 +543,6 @@ def createCxHamUseCasePpt(folder: str): f"{file_prefix}-Synthetics.xlsx" )) - assert len(excels.getWorkBooks()) == 11 - # currently only 1st controller in the job file is examined. controller = getValuesInColumn(apm_wb["Analysis"], "controller")[0] diff --git a/backend/output/reports/MaturityAssessmentReport.py b/backend/output/reports/MaturityAssessmentReport.py index 2385311..55a256f 100644 --- a/backend/output/reports/MaturityAssessmentReport.py +++ b/backend/output/reports/MaturityAssessmentReport.py @@ -26,30 +26,41 @@ def createWorkbook(self, jobs, controllerData, jobFileName): jobNameCols.append(name if not name.startswith("OverallAssessment") else "OverallAssessment") jobStep.reportData(workbook, controllerData, name) + data_header = [ + "controller", + "componentType", + "name", + *jobNameCols, + ] + + if reportType == "apm": # add desc header after name + data_header.insert(3, "description") + # Write Headers writeUncoloredRow( analysisSheet, 1, - [ - "controller", - "componentType", - "name", - *jobNameCols, - ], + data_header ) rowIdx = 2 for host, hostInfo in controllerData.items(): for component in hostInfo[reportType].values(): + + data_row = [ + (hostInfo["controller"].host, None), + (reportType, None), + (component["name"], None), + *[component[jobStep]["computed"] for jobStep in [type(jobStep).__name__ for jobStep in filteredJobs]], + ] + + if reportType == "apm": # add desc after name + data_row.insert(3, (component["description"], None)) + writeColoredRow( analysisSheet, rowIdx, - [ - (hostInfo["controller"].host, None), - (reportType, None), - (component["name"], None), - *[component[jobStep]["computed"] for jobStep in [type(jobStep).__name__ for jobStep in filteredJobs]], - ], + data_row ) rowIdx += 1