Merge pull request #61 from cubedro/develop

Grayed out fix
pull/5/head
Marian OANCΞA 10 years ago
commit d516351e22
  1. 48
      public/js/filters.js
  2. 18
      views/index.jade

@ -25,12 +25,15 @@ angular.module('netStatsApp.filters', [])
};
})
.filter('peerClass', function() {
return function(peers) {
return peerClass(peers);
return function(peers, active) {
return peerClass(peers, active);
};
})
.filter('miningClass', function() {
return function(mining) {
return function(mining, active) {
if(! active)
return 'text-gray';
return (! mining ? 'text-danger' : 'text-success');
};
})
@ -56,7 +59,10 @@ angular.module('netStatsApp.filters', [])
})
.filter('blockClass', function() {
return function(current, best) {
return (best - current <= 1 ? 'text-success' : (best - current > 1 && best - current < 4 ? 'text-warning' : 'text-danger'));
if( ! current.active)
return 'text-gray';
return (best - current.block.number <= 1 ? 'text-success' : (best - current.block.number > 1 && best - current.block.number < 4 ? 'text-warning' : 'text-danger'));
};
})
.filter('gasFilter', function() {
@ -70,25 +76,31 @@ angular.module('netStatsApp.filters', [])
}
})
.filter('timeClass', function() {
return function(timestamp) {
return function(timestamp, active) {
if( ! active)
return 'text-gray';
return timeClass(timestamp);
};
})
.filter('propagationTimeClass', function() {
return function(block, bestBlock) {
if(block.number < bestBlock)
return function(stats, bestBlock) {
if( ! stats.active)
return 'text-gray';
if(block.propagation == 0)
if(stats.block.number < bestBlock)
return 'text-gray';
if(stats.block.propagation == 0)
return 'text-info';
if(block.propagation < 1000)
if(stats.block.propagation < 1000)
return 'text-success';
if(block.propagation < 3000)
if(stats.block.propagation < 3000)
return 'text-warning';
if(block.propagation < 7000)
if(stats.block.propagation < 7000)
return 'text-orange';
return 'text-danger'
@ -105,7 +117,7 @@ angular.module('netStatsApp.filters', [])
.filter('latencyClass', function() {
return function(stats) {
if(stats.active === false)
return 'text-gray';
return 'text-danger';
if(stats.latency <= 100)
return 'text-success';
@ -177,7 +189,10 @@ angular.module('netStatsApp.filters', [])
};
})
.filter('upTimeClass', function() {
return function(uptime) {
return function(uptime, active) {
if( ! active )
return 'text-gray';
if(uptime >= 90)
return 'text-success';
@ -232,11 +247,14 @@ function mainClass(node, bestBlock)
return 'text-danger';
// return timeClass(node.block.timestamp);
return peerClass(node.peers);
return peerClass(node.peers, node.active);
}
function peerClass(peers)
function peerClass(peers, active)
{
if( ! active)
return 'text-gray';
return (peers <= 1 ? 'text-danger' : (peers > 1 && peers < 4 ? 'text-warning' : 'text-success'));
}

@ -15,7 +15,7 @@ block content
span.big-details {{nodesActive}}/{{nodesTotal}}
div.clearfix
div.col-xs-2.stat-holder
div.big-info.uptime(class="{{ upTimeTotal | upTimeClass }}")
div.big-info.uptime(class="{{ upTimeTotal | upTimeClass : true }}")
div.pull-left.icon-full-width
i.icon-bulb
div.pull-left
@ -39,7 +39,7 @@ block content
span.big-details {{"#" + bestBlock}}
div.clearfix
div.col-xs-2.stat-holder
div.big-info.blocktime(class="{{ lastBlock | timeClass }}")
div.big-info.blocktime(class="{{ lastBlock | timeClass : true }}")
div.pull-left.icon-full-width
i.icon-time
div.pull-left
@ -141,15 +141,15 @@ block content
div.small(ng-bind-html="node.info.node | nodeVersion")
//- div.small {{node.info.os}}, {{node.info.os_v}}
td.small(class="{{ node.stats | latencyClass }}") {{node.stats | latencyFilter}}
td(class="{{ node.stats.mining | miningClass }}")
td(class="{{ node.stats.mining | miningClass : node.stats.active }}")
i.small(class="{{ node.stats.mining | miningIconClass }}")
td(class="{{ node.stats.peers | peerClass }}", style="padding-left: 11px;") {{node.stats.peers}}
td(class="{{ node.stats.peers | peerClass : node.stats.active }}", style="padding-left: 11px;") {{node.stats.peers}}
td(style="padding-left: 15px;") {{node.stats.pending}}
td(class="{{ node.stats.block.number | blockClass : bestBlock }}") {{'#' + node.stats.block.number}}
td(class="{{ node.stats.block.number | blockClass : bestBlock }}")
td(class="{{ node.stats | blockClass : bestBlock }}") {{'#' + node.stats.block.number}}
td(class="{{ node.stats | blockClass : bestBlock }}")
span.small {{node.stats.block.hash | hashFilter}}
td(style="padding-left: 14px;") {{node.stats.block.transactions.length || 0}}
td(class="{{ node.stats.block.received | timeClass }}") {{node.stats.block.received | blockTimeFilter }}
td(class="{{ node.stats.block | propagationTimeClass : bestBlock }}") {{node.stats.block.propagation | blockPropagationFilter}}
td(class="{{ node.stats.block.received | timeClass : node.stats.active }}") {{node.stats.block.received | blockTimeFilter }}
td(class="{{ node.stats | propagationTimeClass : bestBlock }}") {{node.stats.block.propagation | blockPropagationFilter}}
td.peerPropagationChart(class="{{node.id}}")
td(class="{{ node.stats.uptime | upTimeClass }}") {{ node.stats.uptime | upTimeFilter }}
td(class="{{ node.stats.uptime | upTimeClass : node.stats.active }}") {{ node.stats.uptime | upTimeFilter }}

Loading…
Cancel
Save