From 5429e43c96ad56121e8e4cf05feb602a524e275c Mon Sep 17 00:00:00 2001 From: cubedro Date: Fri, 24 Apr 2015 08:37:03 +0300 Subject: [PATCH] added current block uncle count --- models/node.js | 3 ++- public/css/style.css | 5 ++++- public/js/controllers.js | 23 ++++++++++++++--------- views/index.jade | 6 +++--- 4 files changed, 23 insertions(+), 14 deletions(-) diff --git a/models/node.js b/models/node.js index e972a69..8030e56 100644 --- a/models/node.js +++ b/models/node.js @@ -23,7 +23,8 @@ var Node = function Node(data) arrival: 0, propagation: 0, received: 0, - transactions: [] + transactions: [], + uncles: [] }, blocktimeAvg: 0, blockTimes: [], diff --git a/public/css/style.css b/public/css/style.css index 9219734..9e9801b 100644 --- a/public/css/style.css +++ b/public/css/style.css @@ -115,8 +115,11 @@ div.small-title-miner { } span.small-title span.small { - letter-spacing: 0px; + font-size: 11px; + letter-spacing: -.5px; color: #666; + -webkit-font-smoothing: subpixel-antialiased; + -moz-font-smoothing: subpixel-antialiased; } .big-info .big-details { diff --git a/public/js/controllers.js b/public/js/controllers.js index 4221edb..7e181e7 100644 --- a/public/js/controllers.js +++ b/public/js/controllers.js @@ -9,6 +9,12 @@ 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; @@ -18,7 +24,7 @@ function StatsCtrl($scope, $filter, socket, _, toastr) { $scope.bestStats = {}; $scope.lastBlocksTime = []; - $scope.difficultyChange = []; + $scope.difficultyChart = []; $scope.transactionDensity = []; $scope.gasSpending = []; $scope.miners = []; @@ -213,18 +219,19 @@ function StatsCtrl($scope, $filter, socket, _, toastr) { var bestBlock = _.max($scope.nodes, function(node) { return parseInt(node.stats.block.number); - }).stats.block.number; + }).stats.block; - if(bestBlock > $scope.bestBlock) + if(bestBlock.number > $scope.bestBlock) { - $scope.bestBlock = bestBlock; + $scope.bestBlockObject = bestBlock; + $scope.bestBlock = bestBlock.number; $scope.bestStats = _.max($scope.nodes, function(node) { return parseInt(node.stats.block.number); }).stats; $scope.lastBlock = $scope.bestStats.block.received; $scope.lastBlocksTime = $scope.bestStats.blockTimes; - $scope.difficultyChange = $scope.bestStats.difficulty; + $scope.difficultyChart = $scope.bestStats.difficulty; $scope.transactionDensity = $scope.bestStats.txDensity; $scope.gasSpending = $scope.bestStats.gasSpending; @@ -233,14 +240,12 @@ function StatsCtrl($scope, $filter, socket, _, toastr) { } jQuery('.spark-blocktimes').sparkline($scope.lastBlocksTime.reverse(), {type: 'bar', tooltipSuffix: ' s'}); - jQuery('.spark-difficulty').sparkline($scope.difficultyChange.reverse(), {type: 'bar'}); + jQuery('.spark-difficulty').sparkline($scope.difficultyChart.reverse(), {type: 'bar'}); jQuery('.spark-transactions').sparkline($scope.transactionDensity.reverse(), {type: 'bar'}); jQuery('.spark-gasspending').sparkline($scope.gasSpending.reverse(), {type: 'bar'}); } - $scope.lastDifficulty = _.max($scope.nodes, function(node) { - return parseInt(node.stats.block.number); - }).stats.block.difficulty; + $scope.lastDifficulty = $scope.bestBlockObject.difficulty; $scope.avgBlockTime = _.max($scope.nodes, function(node) { return parseInt(node.stats.block.number); diff --git a/views/index.jade b/views/index.jade index 8e09561..54b7f53 100644 --- a/views/index.jade +++ b/views/index.jade @@ -15,13 +15,13 @@ block content span.big-details {{nodesActive}}/{{nodesTotal}} div.clearfix div.col-xs-2.stat-holder - div.big-info.uncleCount(class="{{ uncleCount | upTimeClass : true }}") + div.big-info.uncleCount.text-info div.pull-left.icon-full-width i.icon-uncle div.pull-left span.small-title uncles #[ ] - span.small (last 50 blocks) - span.big-details {{ uncleCount }} + span.small (current / last 50) + span.big-details {{ bestBlockObject.uncles.length + "/" + uncleCount }} div.clearfix //- div.col-xs-2.stat-holder //- div.big-info.uptime(class="{{ upTimeTotal | upTimeClass : true }}")