Commit c6ab63ec by utkarshcmu

Calculated total stats in frontend

parent 00a6efa1
......@@ -57,6 +57,7 @@ function (angular, $, config, moment) {
dashboardKeybindings.shortcuts($scope);
$scope.evaluateTotalStats();
$scope.updateSubmenuVisibility();
$scope.setWindowTitleAndTheme();
......@@ -67,6 +68,25 @@ function (angular, $, config, moment) {
});
};
$scope.evaluateTotalStats = function() {
$scope.dashboard.totalRows = 0;
$scope.dashboard.totalPanels = 0;
$scope.dashboard.totalQueries = 0;
if ($scope.dashboard.rows) {
$scope.dashboard.totalRows = $scope.dashboard.rows.length;
for (var i=0; i<$scope.dashboard.rows.length; i++) {
if ($scope.dashboard.rows[i].panels) {
$scope.dashboard.totalPanels += $scope.dashboard.rows[i].panels.length;
for (var j=0; j<$scope.dashboard.rows[i].panels.length; j++) {
if ($scope.dashboard.rows[i].panels[j].targets) {
$scope.dashboard.totalQueries += $scope.dashboard.rows[i].panels[j].targets.length;
}
}
}
}
}
};
$scope.updateSubmenuVisibility = function() {
$scope.submenuEnabled = $scope.dashboard.isSubmenuFeaturesEnabled();
};
......
......@@ -167,6 +167,39 @@
<div class="tight-form">
<ul class="tight-form-list">
<li class="tight-form-item" style="width: 120px">
Total Rows:
</li>
<li class="tight-form-item" style="width: 180px">
{{dashboard.totalRows}}
</li>
</ul>
<div class="clearfix"></div>
</div>
<div class="tight-form">
<ul class="tight-form-list">
<li class="tight-form-item" style="width: 120px">
Total Panels:
</li>
<li class="tight-form-item" style="width: 180px">
{{dashboard.totalPanels}}
</li>
</ul>
<div class="clearfix"></div>
</div>
<div class="tight-form">
<ul class="tight-form-list">
<li class="tight-form-item" style="width: 120px">
Total Queries:
</li>
<li class="tight-form-item" style="width: 180px">
{{dashboard.totalQueries}}
</li>
</ul>
<div class="clearfix"></div>
</div>
<div class="tight-form">
<ul class="tight-form-list">
<li class="tight-form-item" style="width: 120px">
Current version:
</li>
<li class="tight-form-item" style="width: 180px">
......
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