diff --git a/public/js/filters.js b/public/js/filters.js index e004fbe..162150b 100644 --- a/public/js/filters.js +++ b/public/js/filters.js @@ -60,14 +60,6 @@ angular.module('netStatsApp.filters', []) return (typeof gas !== 'undefined' ? parseInt(gas) : '?'); } }) -.filter('latencyFilter', function() { - return function(stats) { - if(stats.active === false) - return 'offline'; - else - return stats.latency + ' ms'; - } -}) .filter('hashFilter', function() { return function(hash) { return hash.substr(0, 6) + '...' + hash.substr(58, 6); @@ -89,12 +81,23 @@ angular.module('netStatsApp.filters', []) return 'text-danger' }; }) +.filter('latencyFilter', function() { + return function(stats) { + if(stats.active === false) + return 'offline'; + else + return stats.latency + ' ms'; + } +}) .filter('latencyClass', function() { - return function(time) { - if(time <= 100) + return function(stats) { + if(stats.active === false) + return 'text-danger'; + + if(stats.latency <= 100) return 'text-success'; - if(time <= 1000) + if(stats.latency <= 1000) return 'text-warning'; return 'text-danger' diff --git a/views/index.jade b/views/index.jade index 0fa50ae..17930bc 100644 --- a/views/index.jade +++ b/views/index.jade @@ -117,7 +117,7 @@ block content td div.small(ng-bind-html="node.info.node | nodeVersion") //- div.small {{node.info.os}}, {{node.info.os_v}} - td.small(class="{{ node.stats.latency | latencyClass }}") {{node.stats | latencyFilter}} + td.small(class="{{ node.stats | latencyClass }}") {{node.stats | latencyFilter}} td(class="{{ node.stats.mining | miningClass }}") i.small(class="{{ node.stats.mining | miningIconClass }}") td(class="{{ node.stats.peers | peerClass }}", style="padding-left: 18px;") {{node.stats.peers}}