Alerting: Refactor API endpoints for fetching alert rules (#37055)

* Refactor ruler API endpoint for listing rules

* Refactor prometheus API endpoint for listing rules

* Update HTTP API docs
This commit is contained in:
Sofia Papagiannaki
2021-07-22 09:53:14 +03:00
committed by GitHub
parent 9cd8e11c30
commit 7815ed511f
8 changed files with 93 additions and 42 deletions
+3 -2
View File
@@ -13,7 +13,7 @@ import (
// FolderService is a service for operating on folders.
type FolderService interface {
GetFolders(limit int64) ([]*models.Folder, error)
GetFolders(limit int64, page int64) ([]*models.Folder, error)
GetFolderByID(id int64) (*models.Folder, error)
GetFolderByUID(uid string) (*models.Folder, error)
GetFolderByTitle(title string) (*models.Folder, error)
@@ -32,7 +32,7 @@ var NewFolderService = func(orgID int64, user *models.SignedInUser, store dashbo
}
}
func (dr *dashboardServiceImpl) GetFolders(limit int64) ([]*models.Folder, error) {
func (dr *dashboardServiceImpl) GetFolders(limit int64, page int64) ([]*models.Folder, error) {
searchQuery := search.Query{
SignedInUser: dr.user,
DashboardIds: make([]int64, 0),
@@ -41,6 +41,7 @@ func (dr *dashboardServiceImpl) GetFolders(limit int64) ([]*models.Folder, error
OrgId: dr.orgId,
Type: "dash-folder",
Permission: models.PERMISSION_VIEW,
Page: page,
}
if err := bus.Dispatch(&searchQuery); err != nil {