API: Support paging in the admin orgs list API (#26932)

* Add page/limit to org search

* Update docs

* Fix test per PR feedback
This commit is contained in:
Benjamin Blattberg
2020-08-12 10:59:07 +03:00
committed by GitHub
parent 214c1078aa
commit 3403db190d
3 changed files with 44 additions and 3 deletions
+9 -2
View File
@@ -160,11 +160,18 @@ func DeleteOrgByID(c *models.ReqContext) Response {
}
func SearchOrgs(c *models.ReqContext) Response {
perPage := c.QueryInt("perpage")
if perPage <= 0 {
perPage = 1000
}
page := c.QueryInt("page")
query := models.SearchOrgsQuery{
Query: c.Query("query"),
Name: c.Query("name"),
Page: 0,
Limit: 1000,
Page: page,
Limit: perPage,
}
if err := bus.Dispatch(&query); err != nil {