From 581db973e4d4f384c96cc31c25415c1f55e5daef Mon Sep 17 00:00:00 2001 From: cubedro Date: Mon, 6 Apr 2015 13:47:11 +0300 Subject: [PATCH 1/2] fixed block time filters --- public/css/style.css | 4 ++++ public/js/filters.js | 17 +++++++++++------ views/index.jade | 4 ++-- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/public/css/style.css b/public/css/style.css index 8d7816c..7c87c80 100644 --- a/public/css/style.css +++ b/public/css/style.css @@ -26,6 +26,10 @@ body { background: #F74B4B; } +.text-gray { + color: #999 !important; +} + .container-fluid { padding-left: 30px; padding-right: 30px; diff --git a/public/js/filters.js b/public/js/filters.js index 3147cb5..0edf6f4 100644 --- a/public/js/filters.js +++ b/public/js/filters.js @@ -71,15 +71,22 @@ angular.module('netStatsApp.filters', []) }) .filter('timeClass', function() { return function(timestamp) { + console.log(timestamp); return timeClass(timestamp); }; }) .filter('propagationTimeClass', function() { - return function(propagation) { - if(propagation <= 3000) + return function(block, bestBlock) { + if(block.number < bestBlock) + return 'text-gray'; + + if(block.propagation < 1000) return 'text-success'; - if(propagation <= 7000) + if(block.propagation < 3000) + return 'text-info'; + + if(block.propagation < 7000) return 'text-warning'; return 'text-danger' @@ -230,9 +237,7 @@ function peerClass(peers) function timeClass(timestamp) { - // var time = Math.floor((new Date()).getTime() / 1000); - var time = (new Date()).getTime(); - var diff = time - timestamp; + var diff = ((new Date()).getTime() - timestamp)/1000; return blockTimeClass(diff); } diff --git a/views/index.jade b/views/index.jade index fed7cb5..f07a753 100644 --- a/views/index.jade +++ b/views/index.jade @@ -47,7 +47,7 @@ block content span.big-details {{ lastBlock | blockTimeFilter }} div.clearfix div.col-xs-2.stat-holder - div.big-info.avgblocktime(class="{{ avgBlockTime | timeClass }}") + div.big-info.avgblocktime(class="{{ avgBlockTime | avgTimeClass }}") div.pull-left.icon-full-width i.icon-gas div.pull-left @@ -149,5 +149,5 @@ block content span.small {{node.stats.block.hash}} td(style="padding-left: 14px;") {{node.stats.block.transactions.length || 0}} td(class="{{ node.stats.block.received | timeClass }}") {{node.stats.block.received | blockTimeFilter }} - td(class="{{ node.stats.block.propagation | propagationTimeClass }}") {{node.stats.block.propagation | blockPropagationFilter}} + td(class="{{ node.stats.block | propagationTimeClass : bestBlock }}") {{node.stats.block.propagation | blockPropagationFilter}} td(class="{{ node.stats.uptime | upTimeClass }}") {{ node.stats.uptime | upTimeFilter }} From 4b7d803533936fec998f8959d39974019e8f5233 Mon Sep 17 00:00:00 2001 From: cubedro Date: Mon, 6 Apr 2015 13:49:38 +0300 Subject: [PATCH 2/2] changed old block propagation time color to darker --- public/css/style.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/css/style.css b/public/css/style.css index 7c87c80..5e0f6ad 100644 --- a/public/css/style.css +++ b/public/css/style.css @@ -27,7 +27,7 @@ body { } .text-gray { - color: #999 !important; + color: #777 !important; } .container-fluid {