lite version

This commit is contained in:
cubedro 2015-07-19 18:26:34 +03:00
parent dae19583ee
commit 99cfea0350
2 changed files with 38 additions and 5 deletions

View File

@ -540,6 +540,39 @@ angular.module('netStatsApp.filters', [])
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)

View File

@ -66,10 +66,10 @@ block content
span.small-title active nodes
span.small-value {{nodesActive}}/{{nodesTotal}}
div.col-xs-3.stat-holder.box
div.gasprice.text-info
i.icon-gasprice
span.small-title gas price
span.small-value {{ bestStats.gasPrice.toString() | gasPriceFilter }}
div.gasprice(class="{{ nodes | consensusClass : bestStats }}")
i.icon-check-o
span.small-title nodes status
span.small-value {{ nodes | consensusFilter : bestStats }}
div.col-xs-3.stat-holder.box
div.page-latency(class="{{ {active: true, latency: latency} | latencyClass }}")
i.icon-clock
@ -122,7 +122,7 @@ block content
span.small-title gas spending
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")
div.row(ng-cloak, style="padding-top: 10px")