* 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.
45 lines
982 B
Go
45 lines
982 B
Go
package dashboards
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/grafana/grafana/pkg/models"
|
|
"github.com/grafana/grafana/pkg/services/user"
|
|
)
|
|
|
|
type SaveDashboardDTO struct {
|
|
OrgId int64
|
|
UpdatedAt time.Time
|
|
User *user.SignedInUser
|
|
Message string
|
|
Overwrite bool
|
|
Dashboard *models.Dashboard
|
|
}
|
|
|
|
type DashboardSearchProjection struct {
|
|
ID int64 `xorm:"id"`
|
|
UID string `xorm:"uid"`
|
|
Title string
|
|
Slug string
|
|
Term string
|
|
IsFolder bool
|
|
FolderID int64 `xorm:"folder_id"`
|
|
FolderUID string `xorm:"folder_uid"`
|
|
FolderSlug string
|
|
FolderTitle string
|
|
SortMeta int64
|
|
}
|
|
|
|
type CountDashboardsInFolderQuery struct {
|
|
FolderUID string
|
|
OrgID int64
|
|
}
|
|
|
|
// 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
|
|
}
|