Commit da67afa5 by utkarshcmu

Fixed api bugs, stats endpoint working

parent c7fae538
......@@ -3,10 +3,10 @@ package api
import (
"strings"
"github.com/grafana/grafana/pkg/middleware"
"github.com/grafana/grafana/pkg/setting"
"github.com/grafana/grafana/pkg/bus"
"github.com/grafana/grafana/pkg/middleware"
m "github.com/grafana/grafana/pkg/models"
"github.com/grafana/grafana/pkg/setting"
)
func AdminGetSettings(c *middleware.Context) {
......
......@@ -20,14 +20,14 @@ type GetDataSourceStatsQuery struct {
}
type AdminStats struct {
UserCount int
OrgCount int
DashboardCount int
DBSnapshotCount int
DBTagCount int
DataSourceCount int
PlaylistCount int
StarredDBCount int
UserCount int `json:"user_count"`
OrgCount int `json:"org_count"`
DashboardCount int `json:"dashboard_count"`
DbSnapshotCount int `json:"db_snapshot_count"`
DbTagCount int `json:"db_tag_count"`
DataSourceCount int `json:"data_source_count"`
PlaylistCount int `json:"playlist_count"`
StarredDbCount int `json:"starred_db_count"`
}
type GetAdminStatsQuery struct {
......
......@@ -73,13 +73,13 @@ func GetAdminStats(query *m.GetAdminStatsQuery) error {
(
SELECT COUNT(*)
FROM ` + dialect.Quote("data_source") + `
) AS datasource_count,
) AS data_source_count,
(
SELECT COUNT(*)
FROM ` + dialect.Quote("playlist") + `
) AS playlist_count,
(
SELECT DISTINCT(dashboard_id)
SELECT COUNT (DISTINCT ` + dialect.Quote("dashboard_id") + ` )
FROM ` + dialect.Quote("star") + `
) AS starred_db_count
`
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment