mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Added grafana_admins count
This commit is contained in:
@@ -1446,7 +1446,8 @@ Keys:
|
|||||||
"db_tag_count":6,
|
"db_tag_count":6,
|
||||||
"data_source_count":1,
|
"data_source_count":1,
|
||||||
"playlist_count":1,
|
"playlist_count":1,
|
||||||
"starred_db_count":2
|
"starred_db_count":2,
|
||||||
|
"grafana_admin_count":2
|
||||||
}
|
}
|
||||||
|
|
||||||
### Global Users
|
### Global Users
|
||||||
|
|||||||
@@ -20,14 +20,15 @@ type GetDataSourceStatsQuery struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type AdminStats struct {
|
type AdminStats struct {
|
||||||
UserCount int `json:"user_count"`
|
UserCount int `json:"user_count"`
|
||||||
OrgCount int `json:"org_count"`
|
OrgCount int `json:"org_count"`
|
||||||
DashboardCount int `json:"dashboard_count"`
|
DashboardCount int `json:"dashboard_count"`
|
||||||
DbSnapshotCount int `json:"db_snapshot_count"`
|
DbSnapshotCount int `json:"db_snapshot_count"`
|
||||||
DbTagCount int `json:"db_tag_count"`
|
DbTagCount int `json:"db_tag_count"`
|
||||||
DataSourceCount int `json:"data_source_count"`
|
DataSourceCount int `json:"data_source_count"`
|
||||||
PlaylistCount int `json:"playlist_count"`
|
PlaylistCount int `json:"playlist_count"`
|
||||||
StarredDbCount int `json:"starred_db_count"`
|
StarredDbCount int `json:"starred_db_count"`
|
||||||
|
GrafanaAdminCount int `json:"grafana_admin_count"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type GetAdminStatsQuery struct {
|
type GetAdminStatsQuery struct {
|
||||||
|
|||||||
@@ -81,7 +81,11 @@ func GetAdminStats(query *m.GetAdminStatsQuery) error {
|
|||||||
(
|
(
|
||||||
SELECT COUNT (DISTINCT ` + dialect.Quote("dashboard_id") + ` )
|
SELECT COUNT (DISTINCT ` + dialect.Quote("dashboard_id") + ` )
|
||||||
FROM ` + dialect.Quote("star") + `
|
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
|
var stats m.AdminStats
|
||||||
|
|||||||
@@ -1,10 +1,13 @@
|
|||||||
<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>
|
</topnav>
|
||||||
|
|
||||||
<div class="page-container">
|
<div class="page-container">
|
||||||
<div class="page-wide">
|
<div class="page-wide">
|
||||||
<h1>
|
<h1>
|
||||||
Stats
|
Overview
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
<table class="filter-table form-inline">
|
<table class="filter-table form-inline">
|
||||||
@@ -23,6 +26,10 @@
|
|||||||
<td>Total users</td>
|
<td>Total users</td>
|
||||||
<td>{{stats.user_count}}</td>
|
<td>{{stats.user_count}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Total grafana admins</td>
|
||||||
|
<td>{{stats.grafana_admin_count}}</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Total organizations</td>
|
<td>Total organizations</td>
|
||||||
<td>{{stats.org_count}}</td>
|
<td>{{stats.org_count}}</td>
|
||||||
|
|||||||
Reference in New Issue
Block a user