started work datasources admin
This commit is contained in:
@@ -25,6 +25,10 @@ func Register(m *macaron.Macaron) {
|
||||
m.Post("/api/account/using/:id", auth, SetUsingAccount)
|
||||
m.Get("/api/account/others", auth, GetOtherAccounts)
|
||||
|
||||
// datasources
|
||||
m.Get("/admin/datasources/", auth, Index)
|
||||
m.Get("/api/admin/datasources/", auth, GetDataSources)
|
||||
|
||||
// user register
|
||||
m.Get("/register/*_", Index)
|
||||
m.Post("/api/account", CreateAccount)
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"github.com/torkelo/grafana-pro/pkg/bus"
|
||||
"github.com/torkelo/grafana-pro/pkg/middleware"
|
||||
m "github.com/torkelo/grafana-pro/pkg/models"
|
||||
)
|
||||
|
||||
func GetDataSources(c *middleware.Context) {
|
||||
query := m.GetDataSourcesQuery{AccountId: c.Account.Id}
|
||||
err := bus.SendQuery(&query)
|
||||
|
||||
if err != nil {
|
||||
c.JsonApiErr(500, "Failed to query datasources", err)
|
||||
return
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user