Commit 07fee0a8 by utkarshcmu

Converted adminStatsCtrl to typescript

parent 442db7fe
......@@ -115,6 +115,7 @@ define([
.when('/admin/stats', {
templateUrl: 'app/features/admin/partials/stats.html',
controller : 'AdminStatsCtrl',
controllerAs: 'ctrl',
})
.when('/login', {
templateUrl: 'app/partials/login.html',
......
define([
'angular',
],
function (angular) {
'use strict';
var module = angular.module('grafana.controllers');
module.controller('AdminStatsCtrl', function($scope, backendSrv) {
$scope.init = function() {
$scope.getStats();
};
$scope.getStats = function() {
backendSrv.get('/api/admin/stats').then(function(stats) {
$scope.stats = stats;
});
};
$scope.init();
});
});
//<reference path="../../headers/common.d.ts" />
import angular from 'angular';
export class AdminStatsCtrl {
stats: any;
/** @ngInject */
constructor(private backendSrv: any) {}
init() {
this.backendSrv.get('/api/admin/stats').then(stats => {
this.stats = stats;
});
}
}
angular.module('grafana.controllers').controller('AdminStatsCtrl', AdminStatsCtrl);
......@@ -5,7 +5,7 @@
</topnav>
<div class="page-container">
<div class="page-wide">
<div class="page-wide" ng-init="ctrl.init()">
<h1>
Overview
</h1>
......@@ -20,39 +20,39 @@
<tbody>
<tr>
<td>Total dashboards</td>
<td>{{stats.dashboard_count}}</td>
<td>{{ctrl.stats.dashboard_count}}</td>
</tr>
<tr>
<td>Total users</td>
<td>{{stats.user_count}}</td>
<td>{{ctrl.stats.user_count}}</td>
</tr>
<tr>
<td>Total grafana admins</td>
<td>{{stats.grafana_admin_count}}</td>
<td>{{ctrl.stats.grafana_admin_count}}</td>
</tr>
<tr>
<td>Total organizations</td>
<td>{{stats.org_count}}</td>
<td>{{ctrl.stats.org_count}}</td>
</tr>
<tr>
<td>Total datasources</td>
<td>{{stats.data_source_count}}</td>
<td>{{ctrl.stats.data_source_count}}</td>
</tr>
<tr>
<td>Total playlists</td>
<td>{{stats.playlist_count}}</td>
<td>{{ctrl.stats.playlist_count}}</td>
</tr>
<tr>
<td>Total snapshots</td>
<td>{{stats.db_snapshot_count}}</td>
<td>{{ctrl.stats.db_snapshot_count}}</td>
</tr>
<tr>
<td>Total dashboard tags</td>
<td>{{stats.db_tag_count}}</td>
<td>{{ctrl.stats.db_tag_count}}</td>
</tr>
<tr>
<td>Total starred dashboards</td>
<td>{{stats.starred_db_count}}</td>
<td>{{ctrl.stats.starred_db_count}}</td>
</tr>
</tbody>
</table>
......
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