mirror of
https://github.com/prymitive/karma
synced 2026-05-25 04:53:05 +00:00
fix(filters): don't return empty filters in the API response
This commit is contained in:
@@ -781,12 +781,7 @@ var countsMap = models.LabelsCountMap{
|
||||
},
|
||||
}
|
||||
|
||||
var filtersExpected = []models.Filter{
|
||||
models.Filter{
|
||||
Hits: 24,
|
||||
IsValid: true,
|
||||
},
|
||||
}
|
||||
var filtersExpected = []models.Filter{}
|
||||
|
||||
func compareAlertGroups(testCase groupTest, group models.AlertGroup) bool {
|
||||
if testCase.receiver != group.Receiver {
|
||||
|
||||
5
views.go
5
views.go
@@ -96,6 +96,7 @@ func alerts(c *gin.Context) {
|
||||
// set pointers for data store objects, need a lock until end of view is reached
|
||||
alerts := []models.AlertGroup{}
|
||||
colors := models.LabelsColorMap{}
|
||||
// used for top labels dropdown
|
||||
counters := models.LabelsCountMap{}
|
||||
|
||||
dedupedAlerts := alertmanager.DedupAlerts()
|
||||
@@ -178,7 +179,9 @@ func alerts(c *gin.Context) {
|
||||
Hits: filter.GetHits(),
|
||||
IsValid: filter.GetIsValid(),
|
||||
}
|
||||
apiFilters = append(apiFilters, af)
|
||||
if af.Text != "" {
|
||||
apiFilters = append(apiFilters, af)
|
||||
}
|
||||
}
|
||||
resp.Filters = apiFilters
|
||||
|
||||
|
||||
Reference in New Issue
Block a user