mirror of
https://github.com/grafana/grafana.git
synced 2024-11-26 19:00:54 -06:00
Calculated total stats in frontend
This commit is contained in:
parent
00a6efa15e
commit
c6ab63ec47
@ -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();
|
||||
};
|
||||
|
@ -164,6 +164,39 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="pull-left tight-form">
|
||||
<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">
|
||||
|
Loading…
Reference in New Issue
Block a user