added uptime functionality
This commit is contained in:
@@ -25,5 +25,6 @@ function StatsCtrl($scope, socket, _) {
|
||||
$scope.nodesActive = _.filter($scope.nodes, function(node){ return node.stats.active == true; }).length;
|
||||
$scope.bestBlock = _.max($scope.nodes, function(node){ return parseInt(node.stats.block.height); }).stats.block.height;
|
||||
$scope.lastBlock = _.max($scope.nodes, function(node){ return parseInt(node.stats.block.timestamp); }).stats.block.timestamp;
|
||||
$scope.upTimeTotal = _.reduce($scope.nodes, function(total, node){ return total + node.stats.uptime.total; }, 0) / $scope.nodes.length;
|
||||
}
|
||||
}
|
||||
@@ -54,7 +54,24 @@ angular.module('netStatsApp.filters', [])
|
||||
return function(timestamp) {
|
||||
return timeClass(timestamp);
|
||||
};
|
||||
}).filter('geoTooltip', function() {
|
||||
})
|
||||
.filter('upTimeFilter', function() {
|
||||
return function(uptime) {
|
||||
return Math.round(uptime) + '%';
|
||||
};
|
||||
})
|
||||
.filter('upTimeClass', function() {
|
||||
return function(uptime) {
|
||||
if(uptime >= 90)
|
||||
return 'text-success';
|
||||
|
||||
if(uptime >= 75)
|
||||
return 'text-warning';
|
||||
|
||||
return 'text-danger';
|
||||
};
|
||||
})
|
||||
.filter('geoTooltip', function() {
|
||||
return function(geo) {
|
||||
return geo.city + ", " + geo.country;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user