fixed offline class filter

pull/5/head
cubedro 10 years ago
parent 0b94a49ac2
commit f664d55107
  1. 25
      public/js/filters.js
  2. 2
      views/index.jade

@ -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'

@ -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}}

Loading…
Cancel
Save