feat(nested folders): Add CountAlertRulesInFolder to ngalert store (#58269)

* chore: refactor CountDashboardsInFolder to use the more efficient Count() sql function

* feat(nested folders): Add CountAlertRulesInFolder to ngalert store

This commit adds CountAlertRulesInFolder and a new model for the CountAlertRulesQuery. It returns a count of alert rules associated with a given orgID and parent folder UID. (the namespace referenced inside alert rules is the parent folder).

I'm not sure where this belongs in the ngalert service, so that will come in a future commit.
This commit is contained in:
Kristin Laemmert
2022-11-08 11:51:00 +01:00
committed by GitHub
parent af2f51f196
commit ef7145e4aa
5 changed files with 101 additions and 33 deletions
+4 -4
View File
@@ -32,12 +32,12 @@ type DashboardSearchProjection struct {
type CountDashboardsInFolderQuery struct {
FolderUID string
OrgID int64
}
// Note for reviewers: I wasn't sure what to name this. It's not actually a DTO
// CountDashboardsInFolderRequest is the request passed from the service to the
// store layer. The FolderID will be replaced with FolderUID when dashboards are
// updated with parent folder UIDs.
// TODO: CountDashboardsInFolderRequest is the request passed from the service
// to the store layer. The FolderID will be replaced with FolderUID when
// dashboards are updated with parent folder UIDs.
type CountDashboardsInFolderRequest struct {
FolderID int64
OrgID int64