Merge pull request #96 from cubedro/develop

Added coinbase in info for matching with miners
This commit is contained in:
Marian OANCΞA 2015-04-24 13:22:24 +03:00
commit 0c4ddfbfff
3 changed files with 30 additions and 3 deletions

View File

@ -23,10 +23,12 @@ function StatsCtrl($scope, $filter, socket, _, toastr) {
$scope.gasSpending = []; $scope.gasSpending = [];
$scope.miners = []; $scope.miners = [];
$scope.nodes = []; $scope.nodes = [];
$scope.map = []; $scope.map = [];
$scope.blockPropagationChart = []; $scope.blockPropagationChart = [];
$scope.uncleCountChart = []; $scope.uncleCountChart = [];
$scope.coinbases = [];
$scope.latency = 0; $scope.latency = 0;
@ -230,6 +232,28 @@ function StatsCtrl($scope, $filter, socket, _, toastr) {
if(typeof $scope.bestStats.miners !== 'undefined') { if(typeof $scope.bestStats.miners !== 'undefined') {
$scope.miners = $scope.bestStats.miners; $scope.miners = $scope.bestStats.miners;
console.log($scope.miners);
_.forIn($scope.miners, function(value, key)
{
if(value.name !== false)
return;
console.error(key, value);
var name = _.result(_.find(_.pluck($scope.nodes, 'info'), 'coinbase', value.miner), 'name');
if(typeof name !== 'undefined')
$scope.miners[key].name = name;
console.warn("Name: ", name);
});
var addresses = _.pluck(_.filter($scope.miners, 'name', false), 'miner');
console.info('Addresses', addresses);
var coinbases = _.pluck($scope.nodes, 'info');
console.info('Coinbases', coinbases);
console.info('Nodes', $scope.nodes);
} }
jQuery('.spark-blocktimes').sparkline($scope.lastBlocksTime.reverse(), {type: 'bar', tooltipSuffix: ' s'}); jQuery('.spark-blocktimes').sparkline($scope.lastBlocksTime.reverse(), {type: 'bar', tooltipSuffix: ' s'});

View File

@ -188,7 +188,9 @@ angular.module('netStatsApp.directives', []).
} }
scope.$watch('data', function() { scope.$watch('data', function() {
scope.init(); if(scope.data.length > 0) {
scope.init();
}
}, true); }, true);
} }
}; };

View File

@ -103,8 +103,9 @@ angular.module('netStatsApp.filters', [])
.filter('gasPriceFilter', ['$filter', function(filter) { .filter('gasPriceFilter', ['$filter', function(filter) {
var numberFilter = filter('number'); var numberFilter = filter('number');
return function(price) { return function(price) {
console.log("--------------------"); if(typeof price === 'undefined')
console.log(price.length); return "0 wei";
if(price.length < 4) if(price.length < 4)
return price + " wei"; return price + " wei";