|
|
@ -20,50 +20,60 @@ angular.module('netStatsApp.filters', []) |
|
|
|
}; |
|
|
|
}; |
|
|
|
}) |
|
|
|
}) |
|
|
|
.filter('mainClass', function() { |
|
|
|
.filter('mainClass', function() { |
|
|
|
return function(node, bestBlock) { |
|
|
|
return function(node, bestBlock) { |
|
|
|
if( ! node.active) |
|
|
|
if( ! node.active) |
|
|
|
return 'text-danger'; |
|
|
|
return 'text-danger'; |
|
|
|
|
|
|
|
|
|
|
|
if(node.peers === 0) |
|
|
|
if(node.peers === 0) |
|
|
|
return 'text-danger'; |
|
|
|
return 'text-danger'; |
|
|
|
|
|
|
|
|
|
|
|
return (node.peers <= 1 ? 'text-danger' : (node.peers > 1 && node.peers < 4 ? 'text-warning' : 'text-success')); |
|
|
|
return timeClass(node.block.timestamp); |
|
|
|
}; |
|
|
|
}; |
|
|
|
}) |
|
|
|
}) |
|
|
|
.filter('peerClass', function() { |
|
|
|
.filter('peerClass', function() { |
|
|
|
return function(peers) { |
|
|
|
return function(peers) { |
|
|
|
return (peers <= 1 ? 'text-danger' : (peers > 1 && peers < 4 ? 'text-warning' : 'text-success')); |
|
|
|
return peerClass(peers); |
|
|
|
}; |
|
|
|
}; |
|
|
|
}) |
|
|
|
}) |
|
|
|
.filter('miningClass', function() { |
|
|
|
.filter('miningClass', function() { |
|
|
|
return function(mining) { |
|
|
|
return function(mining) { |
|
|
|
return (! mining ? 'text-danger' : ''); |
|
|
|
return (! mining ? 'text-danger' : ''); |
|
|
|
}; |
|
|
|
}; |
|
|
|
}) |
|
|
|
}) |
|
|
|
.filter('miningIconClass', function() { |
|
|
|
.filter('miningIconClass', function() { |
|
|
|
return function(mining) { |
|
|
|
return function(mining) { |
|
|
|
return (! mining ? 'icon-cancel' : 'icon-check'); |
|
|
|
return (! mining ? 'icon-cancel' : 'icon-check'); |
|
|
|
}; |
|
|
|
}; |
|
|
|
}) |
|
|
|
}) |
|
|
|
.filter('blockClass', function() { |
|
|
|
.filter('blockClass', function() { |
|
|
|
return function(current, best) { |
|
|
|
return function(current, best) { |
|
|
|
return (best - current <= 1 ? '' : (best - current > 1 && best - current < 4 ? 'text-warning' : 'text-danger')); |
|
|
|
return (best - current <= 1 ? '' : (best - current > 1 && best - current < 4 ? 'text-warning' : 'text-danger')); |
|
|
|
}; |
|
|
|
}; |
|
|
|
}) |
|
|
|
}) |
|
|
|
.filter('timeClass', function() { |
|
|
|
.filter('timeClass', function() { |
|
|
|
return function(timestamp) { |
|
|
|
return function(timestamp) { |
|
|
|
var time = Math.floor((new Date()).getTime() / 1000); |
|
|
|
return timeClass(timestamp); |
|
|
|
var diff = time - timestamp; |
|
|
|
}; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
if(diff <= 12) |
|
|
|
function peerClass(peers) |
|
|
|
return 'text-success'; |
|
|
|
{ |
|
|
|
|
|
|
|
return (peers <= 1 ? 'text-danger' : (peers > 1 && peers < 4 ? 'text-warning' : 'text-success')); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(diff <= 20) |
|
|
|
function timeClass(timestamp) |
|
|
|
return 'text-info'; |
|
|
|
{ |
|
|
|
|
|
|
|
var time = Math.floor((new Date()).getTime() / 1000); |
|
|
|
|
|
|
|
var diff = time - timestamp; |
|
|
|
|
|
|
|
|
|
|
|
if(diff <= 30) |
|
|
|
if(diff <= 12) |
|
|
|
return 'text-warning'; |
|
|
|
return 'text-success'; |
|
|
|
|
|
|
|
|
|
|
|
return 'text-danger'; |
|
|
|
if(diff <= 20) |
|
|
|
}; |
|
|
|
return 'text-info'; |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
if(diff <= 30) |
|
|
|
|
|
|
|
return 'text-warning'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return 'text-danger'; |
|
|
|
|
|
|
|
} |