added propagation time filter

pull/5/head
cubedro 10 years ago
parent 8c49a9dd24
commit 41b9002863
  1. 29
      public/js/filters.js
  2. 2
      views/index.jade

@ -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';

@ -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 }}

Loading…
Cancel
Save