added more filters

This commit is contained in:
cubedro 2015-02-24 23:38:14 +02:00
parent eb7186e9a4
commit 146ac437b8
2 changed files with 30 additions and 2 deletions

View File

@ -78,6 +78,34 @@ angular.module('netStatsApp.filters', [])
return timeClass(timestamp); return timeClass(timestamp);
}; };
}) })
.filter('propagationTimeClass', function() {
return function(propagation) {
if(propagation <= 2000)
return 'text-success';
if(propagation <= 4000)
return 'text-info';
if(propagation <= 5000)
return 'text-warning';
return 'text-danger'
};
})
.filter('latencyClass', function() {
return function(time) {
if(time <= 1000)
return 'text-success';
if(time <= 2000)
return 'text-info';
if(time <= 3000)
return 'text-warning';
return 'text-danger'
};
})
.filter('blockTimeFilter', function() { .filter('blockTimeFilter', function() {
return function(timestamp) { return function(timestamp) {
if(timestamp === 0) if(timestamp === 0)

View File

@ -104,7 +104,7 @@ block content
td td
div.small(ng-bind-html="node.info.node | nodeVersion") div.small(ng-bind-html="node.info.node | nodeVersion")
//- div.small {{node.info.os}}, {{node.info.os_v}} //- div.small {{node.info.os}}, {{node.info.os_v}}
td.small(class="{{ node.stats | mainClass : bestBlock }}") {{node.stats | latencyFilter}} td.small(class="{{ node.stats.latency | latencyClass }}") {{node.stats | latencyFilter}}
td(class="{{ node.stats.mining | miningClass }}") td(class="{{ node.stats.mining | miningClass }}")
i.small(class="{{ node.stats.mining | miningIconClass }}") i.small(class="{{ node.stats.mining | miningIconClass }}")
td(class="{{ node.stats.peers | peerClass }}", style="padding-left: 18px;") {{node.stats.peers}} td(class="{{ node.stats.peers | peerClass }}", style="padding-left: 18px;") {{node.stats.peers}}
@ -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}} //- 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(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.timestamp | timeClass }}") {{node.stats.block.timestamp | blockTimeFilter }}
td(class="{{ node.stats.block.timestamp | timeClass }}") {{node.stats.block.propagation}} ms td(class="{{ node.stats.block.propagation | propagationTimeClass }}") {{node.stats.block.propagation}} ms
td(class="{{ node.stats.uptime | upTimeClass }}") {{ node.stats.uptime | upTimeFilter }} td(class="{{ node.stats.uptime | upTimeClass }}") {{ node.stats.uptime | upTimeFilter }}