more filters

This commit is contained in:
Marian Oancea 2015-01-30 23:37:38 +02:00
parent 3dd2e34371
commit a3968373c0
2 changed files with 12 additions and 1 deletions

View File

@ -3,6 +3,17 @@
/* Filters */
angular.module('netStatsApp.filters', [])
.filter('mainClass', function() {
return function(node, bestBlock) {
if( ! node.active)
return 'text-danger';
if( node.peers === 0)
return 'text-danger';
return (node.peers <= 1 ? 'text-danger' : (node.peers > 1 && node.peers < 4 ? 'text-warning' : 'text-success'));
}
})
.filter('peerClass', function() {
return function(peers) {
return (peers <= 1 ? 'text-danger' : (peers > 1 && peers < 4 ? 'text-warning' : 'text-success'));

View File

@ -73,7 +73,7 @@ block content
th
i.icon-clock
tbody
tr(ng-repeat='node in nodes', class="{{ node.stats.active ? 'text-success' : 'text-danger' }}")
tr(ng-repeat='node in nodes', class="{{ node.stats | mainClass : bestBlock }}")
td(rel="{{node.id}}") {{node.name}}
td {{node.type}}
td(class="{{ node.stats.peers | peerClass }}") {{node.stats.peers}}