|
|
@ -2,7 +2,7 @@ |
|
|
|
|
|
|
|
|
|
|
|
/* Controllers */ |
|
|
|
/* Controllers */ |
|
|
|
|
|
|
|
|
|
|
|
function StatsCtrl($scope, $filter, socket, _, toastr) { |
|
|
|
netStatsApp.controller('StatsCtrl', function($scope, $filter, socket, _, toastr) { |
|
|
|
|
|
|
|
|
|
|
|
// Main Stats init
|
|
|
|
// Main Stats init
|
|
|
|
// ---------------
|
|
|
|
// ---------------
|
|
|
@ -34,7 +34,7 @@ function StatsCtrl($scope, $filter, socket, _, toastr) { |
|
|
|
|
|
|
|
|
|
|
|
$scope.latency = 0; |
|
|
|
$scope.latency = 0; |
|
|
|
|
|
|
|
|
|
|
|
$scope.currentApiVersion = "0.0.6"; |
|
|
|
$scope.currentApiVersion = "0.0.7"; |
|
|
|
|
|
|
|
|
|
|
|
$scope.predicate = ['-stats.active', '-stats.block.number', 'stats.block.propagation']; |
|
|
|
$scope.predicate = ['-stats.active', '-stats.block.number', 'stats.block.propagation']; |
|
|
|
$scope.reverse = false; |
|
|
|
$scope.reverse = false; |
|
|
@ -52,9 +52,10 @@ function StatsCtrl($scope, $filter, socket, _, toastr) { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$scope.timeout = setInterval(function(){ |
|
|
|
$scope.timeout = setInterval(function () |
|
|
|
|
|
|
|
{ |
|
|
|
$scope.$apply(); |
|
|
|
$scope.$apply(); |
|
|
|
}, 1000); |
|
|
|
}, 200); |
|
|
|
|
|
|
|
|
|
|
|
$scope.getNumber = function(num) { |
|
|
|
$scope.getNumber = function(num) { |
|
|
|
return new Array(num); |
|
|
|
return new Array(num); |
|
|
@ -63,8 +64,6 @@ function StatsCtrl($scope, $filter, socket, _, toastr) { |
|
|
|
// Socket listeners
|
|
|
|
// Socket listeners
|
|
|
|
// ----------------
|
|
|
|
// ----------------
|
|
|
|
|
|
|
|
|
|
|
|
socket = new Primus(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
socket.on('open', function open() { |
|
|
|
socket.on('open', function open() { |
|
|
|
socket.emit('ready'); |
|
|
|
socket.emit('ready'); |
|
|
|
console.log('The connection has been opened.'); |
|
|
|
console.log('The connection has been opened.'); |
|
|
@ -178,7 +177,7 @@ function StatsCtrl($scope, $filter, socket, _, toastr) { |
|
|
|
break; |
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
case "inactive": |
|
|
|
case "inactive": |
|
|
|
if(typeof data.stats !== 'undefined') |
|
|
|
if( !_.isUndefined(data.stats) ) |
|
|
|
$scope.nodes[findIndex({id: data.id})].stats = data.stats; |
|
|
|
$scope.nodes[findIndex({id: data.id})].stats = data.stats; |
|
|
|
|
|
|
|
|
|
|
|
toastr['error']("Node "+ $scope.nodes[findIndex({id: data.id})].info.name +" went away!", "Node connection was lost!"); |
|
|
|
toastr['error']("Node "+ $scope.nodes[findIndex({id: data.id})].info.name +" went away!", "Node connection was lost!"); |
|
|
@ -186,9 +185,10 @@ function StatsCtrl($scope, $filter, socket, _, toastr) { |
|
|
|
break; |
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
case "latency": |
|
|
|
case "latency": |
|
|
|
|
|
|
|
if( !_.isUndefined(data.id) ) |
|
|
|
var node = $scope.nodes[findIndex({id: data.id})]; |
|
|
|
var node = $scope.nodes[findIndex({id: data.id})]; |
|
|
|
|
|
|
|
|
|
|
|
if(typeof node.stats !== 'undefined' && typeof node.stats.latency !== 'undefined') |
|
|
|
if( !_.isUndefined(node) && !_.isUndefined(node.stats) && !_.isUndefined(node.stats.latency)) |
|
|
|
$scope.nodes[findIndex({id: data.id})].stats.latency = data.latency; |
|
|
|
$scope.nodes[findIndex({id: data.id})].stats.latency = data.latency; |
|
|
|
|
|
|
|
|
|
|
|
break; |
|
|
|
break; |
|
|
@ -316,4 +316,4 @@ function StatsCtrl($scope, $filter, socket, _, toastr) { |
|
|
|
|
|
|
|
|
|
|
|
$scope.$apply(); |
|
|
|
$scope.$apply(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}); |