Chore: use Wrap for all admin API (#26673)

* Chore: use Wrap for all admin API

* API: fix admin tests
This commit is contained in:
Agnès Toulet
2020-07-29 18:00:14 +02:00
committed by GitHub
parent ec76d69b49
commit 7a5464fe10
4 changed files with 37 additions and 50 deletions
+5 -6
View File
@@ -9,7 +9,7 @@ import (
"github.com/grafana/grafana/pkg/setting"
)
func AdminGetSettings(c *models.ReqContext) {
func AdminGetSettings(c *models.ReqContext) Response {
settings := make(map[string]interface{})
for _, section := range setting.Raw.Sections() {
@@ -35,16 +35,15 @@ func AdminGetSettings(c *models.ReqContext) {
}
}
c.JSON(200, settings)
return JSON(200, settings)
}
func AdminGetStats(c *models.ReqContext) {
func AdminGetStats(c *models.ReqContext) Response {
statsQuery := models.GetAdminStatsQuery{}
if err := bus.Dispatch(&statsQuery); err != nil {
c.JsonApiErr(500, "Failed to get admin stats from database", err)
return
return Error(500, "Failed to get admin stats from database", err)
}
c.JSON(200, statsQuery.Result)
return JSON(200, statsQuery.Result)
}