fixed offline class filter

This commit is contained in:
cubedro 2015-03-27 13:35:23 +02:00
parent 0b94a49ac2
commit f664d55107
2 changed files with 15 additions and 12 deletions

View File

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

View File

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