diff --git a/pkg/database/alerts.go b/pkg/database/alerts.go index e1373712a..d270d5fc7 100644 --- a/pkg/database/alerts.go +++ b/pkg/database/alerts.go @@ -558,7 +558,6 @@ func BuildAlertRequestFromFilter(alerts *ent.AlertQuery, filter map[string][]str if v[0] == "false" { alerts = alerts.Where(alert.SimulatedEQ(false)) } - delete(filter, "simulated") } if _, ok := filter["origin"]; ok { @@ -642,6 +641,8 @@ func BuildAlertRequestFromFilter(alerts *ent.AlertQuery, filter map[string][]str continue case "sort": continue + case "simulated": + continue default: return nil, errors.Wrapf(InvalidFilter, "Filter parameter '%s' is unknown (=%s)", param, value[0]) } @@ -778,10 +779,11 @@ func (c *Client) QueryAlertWithFilter(filter map[string][]string) ([]*ent.Alert, break } ret = append(ret, result[0:diff]...) + } else { ret = append(ret, result...) } - if len(ret) == limit || len(ret) == 0 { + if len(ret) == limit || len(ret) == 0 || len(ret) < paginationSize { c.Log.Debugf("Pagination done len(ret) = %d", len(ret)) break }