design improvements

This commit is contained in:
cubedro
2015-02-18 09:54:04 +02:00
parent 1959e77407
commit ddd31a5354
12 changed files with 193 additions and 32 deletions

View File

@@ -11,7 +11,9 @@ function StatsCtrl($scope, $filter, socket, _, toastr) {
$scope.nodesActive = 0;
$scope.bestBlock = 0;
$scope.lastBlock = 0;
$scope.lastDifficulty = 0;
$scope.upTimeTotal = 0;
$scope.avgBlockTime = 0;
$scope.nodes = [];
$scope.map = [];
@@ -117,6 +119,14 @@ function StatsCtrl($scope, $filter, socket, _, toastr) {
return parseInt(node.stats.block.timestamp);
}).stats.block.timestamp;
$scope.lastDifficulty = _.max($scope.nodes, function(node) {
return parseInt(node.stats.block.timestamp);
}).stats.block.difficulty;
$scope.avgBlockTime = _.max($scope.nodes, function(node) {
return parseInt(node.stats.block.timestamp);
}).stats.blocktimeAvg;
$scope.upTimeTotal = _.reduce($scope.nodes, function(total, node) {
return total + node.stats.uptime;
}, 0) / $scope.nodes.length;

View File

@@ -44,7 +44,7 @@ angular.module('netStatsApp.filters', [])
version = version.replace('eth version ', 'v')
.replace("\n" + 'Network protocol version: ', ' (')
.replace("\n" + 'Client database version: ', ',')
.replace("\n" + 'Build: ', ')<br>');
.replace("\n" + 'Build: ', ') - ');
return $sce.trustAsHtml(version);
};
})
@@ -63,6 +63,16 @@ angular.module('netStatsApp.filters', [])
return timeClass(timestamp);
};
})
.filter('avgTimeFilter', function() {
return function(time) {
return Math.round(time) + 's';
};
})
.filter('avgTimeClass', function() {
return function(time) {
return blockTimeClass(time);
}
})
.filter('upTimeFilter', function() {
return function(uptime) {
return Math.round(uptime) + '%';
@@ -115,6 +125,11 @@ function timeClass(timestamp)
var time = Math.floor((new Date()).getTime() / 1000);
var diff = time - timestamp;
return blockTimeClass(diff);
}
function blockTimeClass(diff)
{
if(diff <= 12)
return 'text-success';
@@ -124,5 +139,5 @@ function timeClass(timestamp)
if(diff <= 30)
return 'text-warning';
return 'text-danger';
return 'text-danger'
}