more filters

This commit is contained in:
cubedro 2015-04-29 13:30:38 +03:00
parent df87857692
commit ab72cab4fe
2 changed files with 24 additions and 1 deletions

View File

@ -174,6 +174,29 @@ angular.module('netStatsApp.filters', [])
return 'text-danger'
};
})
.filter('propagationNodeAvgTimeClass', function() {
return function(stats, bestBlock) {
if( ! stats.active)
return 'text-gray';
if(stats.block.number < bestBlock)
return 'text-gray';
if(stats.propagationAvg == 0)
return 'text-info';
if(stats.propagationAvg < 1000)
return 'text-success';
if(stats.propagationAvg < 3000)
return 'text-warning';
if(stats.propagationAvg < 7000)
return 'text-orange';
return 'text-danger'
};
})
.filter('propagationAvgTimeClass', function() {
return function(propagationAvg, active) {
if( ! active)

View File

@ -206,5 +206,5 @@ block content
div.propagationBox
span {{node.stats.block.propagation | blockPropagationFilter}}
td.peerPropagationChart(class="{{node.id}}")
td(class="{{ node.stats.propagationAvg | propagationAvgTimeClass : node.stats.active }}") {{ node.stats.propagationAvg | blockPropagationFilter : '' }}
td(class="{{ node.stats | propagationNodeAvgTimeClass : node.stats.active }}") {{ node.stats.propagationAvg | blockPropagationFilter : '' }}
td(class="{{ node.stats.uptime | upTimeClass : node.stats.active }}") {{ node.stats.uptime | upTimeFilter }}