Commit a87fd11f by bergquist

feat(stats): add alerts to global admin stats

parent ad97db93
...@@ -30,6 +30,7 @@ type AdminStats struct { ...@@ -30,6 +30,7 @@ type AdminStats struct {
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"`
AlertCount int `json:"alert_count"`
} }
type GetAdminStatsQuery struct { type GetAdminStatsQuery struct {
......
...@@ -89,7 +89,11 @@ func GetAdminStats(query *m.GetAdminStatsQuery) error { ...@@ -89,7 +89,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 COUNT(*)
FROM ` + dialect.Quote("alert") + `
) AS alert_count
` `
var stats m.AdminStats var stats m.AdminStats
......
...@@ -46,6 +46,10 @@ ...@@ -46,6 +46,10 @@
<td>Total starred dashboards</td> <td>Total starred dashboards</td>
<td>{{ctrl.stats.starred_db_count}}</td> <td>{{ctrl.stats.starred_db_count}}</td>
</tr> </tr>
<tr>
<td>Total alerts</td>
<td>{{ctrl.stats.alert_count}}</td>
</tr>
</tbody> </tbody>
</table> </table>
</div> </div>
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