From 25b150b637d661c4e3f84a9974e805796397f502 Mon Sep 17 00:00:00 2001 From: Sanyam Singhal Date: Thu, 9 Jan 2025 11:22:06 +0000 Subject: [PATCH] handled html UI for zero issues cases --- yb-voyager/cmd/migration_complexity.go | 53 +++++++++++++++----------- 1 file changed, 30 insertions(+), 23 deletions(-) diff --git a/yb-voyager/cmd/migration_complexity.go b/yb-voyager/cmd/migration_complexity.go index 77f4660ac..69b71d1d3 100644 --- a/yb-voyager/cmd/migration_complexity.go +++ b/yb-voyager/cmd/migration_complexity.go @@ -215,29 +215,31 @@ func getComplexityForLevel(level string, count int) string { // TODO: discuss if the html should be in main report or here const explainTemplateHTML = ` -

Below is a detailed breakdown of issues by category, showing the count for each impact level.

- - - - - - - - - - - - {{- range .Summaries }} - - - - - - - - {{- end }} - -
CategoryLevel-1Level-2Level-3Total
{{ .Category }}{{ index .ImpactCounts "LEVEL_1" }}{{ index .ImpactCounts "LEVEL_2" }}{{ index .ImpactCounts "LEVEL_3" }}{{ .TotalIssueCount }}
+{{- if .Summaries }} +

Below is a breakdown of the issues detected in different categories for each impact level.

+ + + + + + + + + + + + {{- range .Summaries }} + + + + + + + + {{- end }} + +
CategoryLevel-1Level-2Level-3Total
{{ .Category }}{{ index .ImpactCounts "LEVEL_1" }}{{ index .ImpactCounts "LEVEL_2" }}{{ index .ImpactCounts "LEVEL_3" }}{{ .TotalIssueCount }}
+{{- end }}

Complexity: {{ .Complexity }}
@@ -309,6 +311,11 @@ func buildRationale(finalComplexity string, l1Count int, l2Count int, l3Count in } func buildCategorySummary(issues []AssessmentIssue) []MigrationComplexityCategorySummary { + if len(issues) == 0 { + return nil + + } + summaryMap := make(map[string]*MigrationComplexityCategorySummary) for _, issue := range issues { if issue.Category == "" {