Merge pull request #61 from cubedro/develop

Grayed out fix
This commit is contained in:
Marian OANCΞA 2015-04-09 01:49:10 +03:00
commit d516351e22
2 changed files with 42 additions and 24 deletions

View File

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

View File

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