按告警级别和数量排序 (#913)

This commit is contained in:
zheng 2022-04-15 14:33:44 +08:00 committed by GitHub
parent e94f807d52
commit e8cfe46381
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -81,6 +81,13 @@ func alertCurEventsCard(c *gin.Context) {
cards[i] = cardmap[titles[i]]
}
sort.SliceStable(cards, func(i, j int) bool {
if cards[i].Severity != cards[j].Severity {
return cards[i].Severity < cards[j].Severity
}
return cards[i].Total > cards[j].Total
})
ginx.NewRender(c).Data(cards, nil)
}