more filters

pull/5/head
Marian Oancea 10 years ago
parent 3dd2e34371
commit a3968373c0
  1. 11
      public/js/filters.js
  2. 2
      views/index.jade

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

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

Loading…
Cancel
Save