Merge pull request #21 from cubedro/develop

added propagation time filter
This commit is contained in:
Marian OANCΞA 2015-03-05 00:12:35 +02:00
commit 8e06a6cea7
2 changed files with 29 additions and 2 deletions

View File

@ -113,7 +113,34 @@ angular.module('netStatsApp.filters', [])
return moment.duration(Math.round(diff), 's').humanize() + ' ago';
};
}).filter('avgTimeFilter', function() {
})
.filter('blockPropagationFilter', function() {
return function(miliseconds) {
if(miliseconds < 1000)
return miliseconds + " ms";
var result = 0;
if(miliseconds < 1000*60){
result = miliseconds/1000;
return result.format(1) + " s";
}
if(miliseconds < 1000*60*60){
result = miliseconds/1000/60;
return result.format(1) + " min";
}
if(miliseconds < 1000*60*60*24){
result = miliseconds/1000/60/60;
return result.format(1) + " h";
}
result = miliseconds/1000/60/60/24;
return result.format(1) + " days";
};
})
.filter('avgTimeFilter', function() {
return function(time) {
if(time < 60)
return Math.round(time) + ' s';

View File

@ -115,5 +115,5 @@ block content
//- div.small Difficulty: {{node.stats.block.difficulty | gasFilter}} | Gas used: {{node.stats.block.gasUsed | gasFilter}} | Min gas price: {{node.stats.block.minGasPrice | gasFilter}} | Gas limit: {{node.stats.block.gasLimit | gasFilter}}
td(style="padding-left: 18px;") {{node.stats.block.txCount}}
td(class="{{ node.stats.block.timestamp | timeClass }}") {{node.stats.block.timestamp | blockTimeFilter }}
td(class="{{ node.stats.block.propagation | propagationTimeClass }}") {{node.stats.block.propagation}} ms
td(class="{{ node.stats.block.propagation | propagationTimeClass }}") {{node.stats.block.propagation | blockPropagationFilter}}
td(class="{{ node.stats.uptime | upTimeClass }}") {{ node.stats.uptime | upTimeFilter }}