Skip to content

Commit

Permalink
handled html UI for zero issues cases
Browse files Browse the repository at this point in the history
  • Loading branch information
sanyamsinghal committed Jan 9, 2025
1 parent df9ea11 commit 25b150b
Showing 1 changed file with 30 additions and 23 deletions.
53 changes: 30 additions & 23 deletions yb-voyager/cmd/migration_complexity.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 = `
<p>Below is a detailed breakdown of issues by category, showing the count for each impact level.</p>
<table border="1" cellpadding="5" cellspacing="0" style="border-collapse: collapse;">
<thead>
<tr>
<th>Category</th>
<th>Level-1</th>
<th>Level-2</th>
<th>Level-3</th>
<th>Total</th>
</tr>
</thead>
<tbody>
{{- range .Summaries }}
<tr>
<td>{{ .Category }}</td>
<td>{{ index .ImpactCounts "LEVEL_1" }}</td>
<td>{{ index .ImpactCounts "LEVEL_2" }}</td>
<td>{{ index .ImpactCounts "LEVEL_3" }}</td>
<td>{{ .TotalIssueCount }}</td>
</tr>
{{- end }}
</tbody>
</table>
{{- if .Summaries }}
<p>Below is a breakdown of the issues detected in different categories for each impact level.</p>
<table border="1" cellpadding="5" cellspacing="0" style="border-collapse: collapse;">
<thead>
<tr>
<th>Category</th>
<th>Level-1</th>
<th>Level-2</th>
<th>Level-3</th>
<th>Total</th>
</tr>
</thead>
<tbody>
{{- range .Summaries }}
<tr>
<td>{{ .Category }}</td>
<td>{{ index .ImpactCounts "LEVEL_1" }}</td>
<td>{{ index .ImpactCounts "LEVEL_2" }}</td>
<td>{{ index .ImpactCounts "LEVEL_3" }}</td>
<td>{{ .TotalIssueCount }}</td>
</tr>
{{- end }}
</tbody>
</table>
{{- end }}
<p>
<strong>Complexity:</strong> {{ .Complexity }}</br>
Expand Down Expand Up @@ -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 == "" {
Expand Down

0 comments on commit 25b150b

Please sign in to comment.