Merge pull request #212 from cubedro/develop

Lite version
This commit is contained in:
Marian OANCΞA 2015-07-19 18:27:52 +03:00
commit 3f7d1df582
5 changed files with 41 additions and 8 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -540,6 +540,39 @@ angular.module('netStatsApp.filters', [])
return 'hidden'; return 'hidden';
}; };
})
.filter('consensusClass', function() {
return function(nodes, bestBlock) {
var status = 'success';
var now = _.now();
for(var x = 0; x < nodes.length; x++)
{
if(nodes[x].stats.block.number === bestBlock.number && nodes[x].stats.block.hash !== bestBlock.hash)
return 'danger';
if((bestBlock.number - nodes[x].stats.block.number) > 1 && (now - bestBlock.received) >= 20*1000)
status = 'orange';
if((bestBlock.number - nodes[x].stats.block.number) === 1 && (now - bestBlock.received) >= 10*1000 && status !== 'orange')
status = 'warning';
}
return status;
};
})
.filter('consensusFilter', function() {
return function(nodes, bestBlock) {
var cnt = 0;
for(var x = 0; x < nodes.length; x++)
{
if(nodes[x].stats.block.number === bestBlock.number && nodes[x].stats.block.hash === bestBlock.hash)
cnt++;
}
return cnt + '/' + nodes.length;
};
}); });
function compareVersions(v1, comparator, v2) function compareVersions(v1, comparator, v2)

View File

@ -66,10 +66,10 @@ block content
span.small-title active nodes span.small-title active nodes
span.small-value {{nodesActive}}/{{nodesTotal}} span.small-value {{nodesActive}}/{{nodesTotal}}
div.col-xs-3.stat-holder.box div.col-xs-3.stat-holder.box
div.gasprice.text-info div.gasprice(class="{{ nodes | consensusClass : bestStats }}")
i.icon-gasprice i.icon-check-o
span.small-title gas price span.small-title nodes status
span.small-value {{ bestStats.gasPrice.toString() | gasPriceFilter }} span.small-value {{ nodes | consensusFilter : bestStats }}
div.col-xs-3.stat-holder.box div.col-xs-3.stat-holder.box
div.page-latency(class="{{ {active: true, latency: latency} | latencyClass }}") div.page-latency(class="{{ {active: true, latency: latency} | latencyClass }}")
i.icon-clock i.icon-clock
@ -122,7 +122,7 @@ block content
span.small-title gas spending span.small-title gas spending
sparkchart.big-details.spark-gasspending(data="{{gasSpending.join(',')}}") sparkchart.big-details.spark-gasspending(data="{{gasSpending.join(',')}}")
div.col-xs-4.stat-holder.map-holder //- div.col-xs-4.stat-holder.map-holder
nodemap#mapHolder(data="map") nodemap#mapHolder(data="map")
div.row(ng-cloak, style="padding-top: 10px") div.row(ng-cloak, style="padding-top: 10px")