added avg block propagation
This commit is contained in:
@@ -14,6 +14,7 @@ function StatsCtrl($scope, $filter, socket, _, toastr) {
|
||||
$scope.lastDifficulty = 0;
|
||||
$scope.upTimeTotal = 0;
|
||||
$scope.avgBlockTime = 0;
|
||||
$scope.blockPropagationAvg = 0;
|
||||
$scope.avgHashrate = 0;
|
||||
$scope.uncleCount = 0;
|
||||
$scope.bestStats = {};
|
||||
@@ -140,7 +141,8 @@ function StatsCtrl($scope, $filter, socket, _, toastr) {
|
||||
break;
|
||||
|
||||
case "blockPropagationChart":
|
||||
$scope.blockPropagationChart = data;
|
||||
$scope.blockPropagationChart = data.histogram;
|
||||
$scope.blockPropagationAvg = data.avg;
|
||||
|
||||
break;
|
||||
|
||||
@@ -159,7 +161,8 @@ function StatsCtrl($scope, $filter, socket, _, toastr) {
|
||||
$scope.difficultyChart = data.difficulty;
|
||||
$scope.transactionDensity = data.transactions;
|
||||
$scope.gasSpending = data.gasSpending;
|
||||
$scope.blockPropagationChart = data.propagation;
|
||||
$scope.blockPropagationChart = data.propagation.histogram;
|
||||
$scope.blockPropagationAvg = data.propagation.avg;
|
||||
$scope.uncleCountChart = data.uncleCount;
|
||||
$scope.uncleCount = data.uncleCount[0] + data.uncleCount[1];
|
||||
|
||||
|
||||
@@ -175,20 +175,20 @@ angular.module('netStatsApp.filters', [])
|
||||
};
|
||||
})
|
||||
.filter('propagationAvgTimeClass', function() {
|
||||
return function(stats) {
|
||||
if( ! stats.active)
|
||||
return function(propagationAvg, active) {
|
||||
if( ! active)
|
||||
return 'text-gray';
|
||||
|
||||
if(stats.propagationAvg == 0)
|
||||
if(propagationAvg == 0)
|
||||
return 'text-info';
|
||||
|
||||
if(stats.propagationAvg < 1000)
|
||||
if(propagationAvg < 1000)
|
||||
return 'text-success';
|
||||
|
||||
if(stats.propagationAvg < 3000)
|
||||
if(propagationAvg < 3000)
|
||||
return 'text-warning';
|
||||
|
||||
if(stats.propagationAvg < 7000)
|
||||
if(propagationAvg < 7000)
|
||||
return 'text-orange';
|
||||
|
||||
return 'text-danger'
|
||||
@@ -232,30 +232,33 @@ angular.module('netStatsApp.filters', [])
|
||||
};
|
||||
})
|
||||
.filter('blockPropagationFilter', function() {
|
||||
return function(ms) {
|
||||
return function(ms, prefix) {
|
||||
if(typeof prefix === 'undefined')
|
||||
prefix = '+';
|
||||
|
||||
var result = 0;
|
||||
|
||||
if(ms < 1000) {
|
||||
return (ms === 0 ? "" : "+") + ms + " ms";
|
||||
return (ms === 0 ? "" : prefix) + ms + " ms";
|
||||
}
|
||||
|
||||
if(ms < 1000*60) {
|
||||
result = ms/1000;
|
||||
return "+" + result.toFixed(1) + " s";
|
||||
return prefix + result.toFixed(1) + " s";
|
||||
}
|
||||
|
||||
if(ms < 1000*60*60) {
|
||||
result = ms/1000/60;
|
||||
return "+" + Math.round(result) + " min";
|
||||
return prefix + Math.round(result) + " min";
|
||||
}
|
||||
|
||||
if(ms < 1000*60*60*24) {
|
||||
result = ms/1000/60/60;
|
||||
return "+" + Math.round(result) + " h";
|
||||
return prefix + Math.round(result) + " h";
|
||||
}
|
||||
|
||||
result = ms/1000/60/60/24;
|
||||
return "+" + Math.round(result) + " days";
|
||||
return prefix + Math.round(result) + " days";
|
||||
};
|
||||
})
|
||||
.filter('avgTimeFilter', function() {
|
||||
|
||||
Reference in New Issue
Block a user