added second top row

This commit is contained in:
cubedro
2015-04-24 11:44:21 +03:00
parent dd1b642c23
commit 3adf1aa2d8
5 changed files with 113 additions and 65 deletions

View File

@@ -9,12 +9,6 @@ function StatsCtrl($scope, $filter, socket, _, toastr) {
$scope.nodesTotal = 0;
$scope.nodesActive = 0;
$scope.bestBlockObject = {
number: 0,
hash: "0x?",
transactions: [],
uncles: []
}
$scope.bestBlock = 0;
$scope.lastBlock = 0;
$scope.lastDifficulty = 0;
@@ -219,12 +213,11 @@ function StatsCtrl($scope, $filter, socket, _, toastr) {
var bestBlock = _.max($scope.nodes, function(node) {
return parseInt(node.stats.block.number);
}).stats.block;
}).stats.block.number;
if(bestBlock.number > $scope.bestBlock)
if(bestBlock > $scope.bestBlock)
{
$scope.bestBlockObject = bestBlock;
$scope.bestBlock = bestBlock.number;
$scope.bestBlock = bestBlock;
$scope.bestStats = _.max($scope.nodes, function(node) {
return parseInt(node.stats.block.number);
}).stats;
@@ -245,7 +238,7 @@ function StatsCtrl($scope, $filter, socket, _, toastr) {
jQuery('.spark-gasspending').sparkline($scope.gasSpending.reverse(), {type: 'bar'});
}
$scope.lastDifficulty = $scope.bestBlockObject.difficulty;
$scope.lastDifficulty = $scope.bestStats.block.difficulty;
$scope.avgBlockTime = _.max($scope.nodes, function(node) {
return parseInt(node.stats.block.number);

View File

@@ -60,19 +60,9 @@ angular.module('netStatsApp.directives', []).
scope.init();
window.onresize = function() {
scope.$apply();
};
scope.$watch('data', function() {
scope.map.bubbles(scope.data, bubbleConfig);
}, true);
scope.$watch(function() {
return angular.element(window)[0].innerWidth;
}, function() {
scope.init();
});
}
};
}]).

View File

@@ -100,6 +100,32 @@ angular.module('netStatsApp.filters', [])
return (best - current.block.number <= 1 ? 'text-success' : (best - current.block.number > 1 && best - current.block.number < 4 ? 'text-warning' : 'text-danger'));
};
})
.filter('gasPriceFilter', ['$filter', function(filter) {
var numberFilter = filter('number')
return function(price) {
console.log("--------------------");
console.log(price.length);
if(price.length < 4)
return price + " wei";
if(price.length < 7)
return (price/1000) + " kwei";
if(price.length < 10)
return (price/1000000) + " mwei";
if(price.length < 13)
return (price/1000000000) + " gwei";
if(price.length < 16)
return (price/1000000000000) + " szabo";
if(price.length < 19)
return (price.substr(0, price.length - 15)) + " finney";
return numberFilter(price.substr(0, price.length - 18)) + " ether";
}
}])
.filter('gasFilter', function() {
return function(gas) {
return (typeof gas !== 'undefined' ? parseInt(gas) : '?');