Merge pull request #225 from cubedro/develop

fixed nodes stats class
pull/5/head
Marian OANCΞA 9 years ago
commit 5b74302544
  1. 8
      src-lite/js/filters.js

@ -522,19 +522,19 @@ angular.module('netStatsApp.filters', [])
}) })
.filter('consensusClass', function() { .filter('consensusClass', function() {
return function(nodes, bestBlock) { return function(nodes, bestBlock) {
var status = 'success'; var status = 'text-success';
var now = (new Date()).getTime(); var now = (new Date()).getTime();
for(var x = 0; x < nodes.length; x++) for(var x = 0; x < nodes.length; x++)
{ {
if(nodes[x].stats.block.number === bestBlock.block.number && nodes[x].stats.block.hash !== bestBlock.block.hash) if(nodes[x].stats.block.number === bestBlock.block.number && nodes[x].stats.block.hash !== bestBlock.block.hash)
return 'danger'; return 'text-danger';
if((bestBlock.block.number - nodes[x].stats.block.number) > 1 && (now - bestBlock.block.received) >= 20*1000) if((bestBlock.block.number - nodes[x].stats.block.number) > 1 && (now - bestBlock.block.received) >= 20*1000)
status = 'orange'; status = 'text-orange';
if((bestBlock.block.number - nodes[x].stats.block.number) === 1 && (now - bestBlock.block.received) >= 10*1000 && status !== 'orange') if((bestBlock.block.number - nodes[x].stats.block.number) === 1 && (now - bestBlock.block.received) >= 10*1000 && status !== 'orange')
status = 'warning'; status = 'text-warning';
} }
return status; return status;

Loading…
Cancel
Save