Commit 2190392e by utkarshcmu

Added grafana_admins count

parent a621c0d2
......@@ -1446,7 +1446,8 @@ Keys:
"db_tag_count":6,
"data_source_count":1,
"playlist_count":1,
"starred_db_count":2
"starred_db_count":2,
"grafana_admin_count":2
}
### Global Users
......
......@@ -20,14 +20,15 @@ type GetDataSourceStatsQuery struct {
}
type AdminStats struct {
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"`
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"`
GrafanaAdminCount int `json:"grafana_admin_count"`
}
type GetAdminStatsQuery struct {
......
......@@ -81,7 +81,11 @@ func GetAdminStats(query *m.GetAdminStatsQuery) error {
(
SELECT COUNT (DISTINCT ` + dialect.Quote("dashboard_id") + ` )
FROM ` + dialect.Quote("star") + `
) AS starred_db_count
) AS starred_db_count,
(
SELECT SUM ( ` + dialect.Quote("is_admin") + ` )
FROM ` + dialect.Quote("user") + `
) AS grafana_admin_count
`
var stats m.AdminStats
......
<topnav icon="fa fa-fw fa-bar-chart" title="Grafana stats">
<topnav icon="fa fa-fw fa-bar-chart" title="Grafana stats" subnav="true">
<ul class="nav">
<li class="active"><a href="admin/stats">Overview</a></li>
</ul>
</topnav>
<div class="page-container">
<div class="page-wide">
<h1>
Stats
Overview
</h1>
<table class="filter-table form-inline">
......@@ -24,6 +27,10 @@
<td>{{stats.user_count}}</td>
</tr>
<tr>
<td>Total grafana admins</td>
<td>{{stats.grafana_admin_count}}</td>
</tr>
<tr>
<td>Total organizations</td>
<td>{{stats.org_count}}</td>
</tr>
......
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