feat(alerting): server-side state+severity filters, ButtonGroup filter UI
Backend: `GET /environments/{envSlug}/alerts` now accepts optional multi-value
`state=…` and `severity=…` query params. Filters are pushed down to
PostgresAlertInstanceRepository, which appends `AND state::text = ANY(?)` /
`AND severity::text = ANY(?)` to the inbox query (null/empty = no filter).
`AlertInstanceRepository.listForInbox` gained a 7-arg overload; the old 5-arg
form is preserved as a default delegate so existing callers (evaluator,
AlertingFullLifecycleIT, PostgresAlertInstanceRepositoryIT) compile unchanged.
`InAppInboxQuery.listInbox` also has a new filtered overload.
UI: InboxPage severity filter migrated from `SegmentedTabs` (single-select,
no color cues) to `ButtonGroup` (multi-select with severity-coloured dots),
matching the topnavbar status-filter pattern. `useAlerts` forwards the
filters as query params and cache-keys on the filter tuple so each combo
is independently cached.
Unit + hook tests updated to the new contract (5 UI tests + 8 Java unit
tests passing). OpenAPI types regenerated from the fresh local backend.
This commit is contained in:
@@ -10,10 +10,30 @@ public interface AlertInstanceRepository {
|
||||
AlertInstance save(AlertInstance instance); // upsert by id
|
||||
Optional<AlertInstance> findById(UUID id);
|
||||
Optional<AlertInstance> findOpenForRule(UUID ruleId); // state IN ('PENDING','FIRING','ACKNOWLEDGED')
|
||||
|
||||
/**
|
||||
* Unfiltered inbox listing. Convenience overload that delegates to the filtered
|
||||
* variant with {@code states}/{@code severities} set to {@code null} (no filter).
|
||||
*/
|
||||
default List<AlertInstance> listForInbox(UUID environmentId,
|
||||
List<String> userGroupIdFilter,
|
||||
String userId,
|
||||
List<String> userRoleNames,
|
||||
int limit) {
|
||||
return listForInbox(environmentId, userGroupIdFilter, userId, userRoleNames, null, null, limit);
|
||||
}
|
||||
|
||||
/**
|
||||
* Inbox listing with optional state + severity filters. {@code null} or empty lists mean
|
||||
* "no filter on that field". When both lists are non-empty the row must match at least one
|
||||
* value from each list (AND between dimensions, OR within).
|
||||
*/
|
||||
List<AlertInstance> listForInbox(UUID environmentId,
|
||||
List<String> userGroupIdFilter,
|
||||
String userId,
|
||||
List<String> userRoleNames,
|
||||
List<AlertState> states,
|
||||
List<AlertSeverity> severities,
|
||||
int limit);
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user