display source in alerts list when an alert has multiple decisions (#2098)

This commit is contained in:
blotus 2023-03-06 13:51:57 +01:00 committed by GitHub
parent b2c2c5ac59
commit e27a0a0e14
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -24,7 +24,7 @@ func alertsTable(out io.Writer, alerts *models.GetAlertsResponse, printMachine b
for _, alertItem := range *alerts {
displayVal := *alertItem.Source.Scope
if len(alertItem.Decisions) > 1 {
displayVal = fmt.Sprintf("%d %ss", len(alertItem.Decisions), *alertItem.Decisions[0].Scope)
displayVal = fmt.Sprintf("%s (%d %ss)", *alertItem.Source.Scope, len(alertItem.Decisions), *alertItem.Decisions[0].Scope)
} else if *alertItem.Source.Value != "" {
displayVal += ":" + *alertItem.Source.Value
}