fixed hashrate filters

This commit is contained in:
cubedro 2015-04-24 12:39:29 +03:00
parent 3ed44af73f
commit 1305d954a3
2 changed files with 8 additions and 8 deletions

View File

@ -42,22 +42,22 @@ angular.module('netStatsApp.filters', [])
return (! mining ? 'icon-cancel' : 'icon-check'); return (! mining ? 'icon-cancel' : 'icon-check');
}; };
}) })
.filter('hashpowerClass', function() { .filter('hashrateClass', function() {
return function(mining) { return function(mining, active) {
if(! mining) if(! mining || ! active)
return 'text-gray'; return 'text-gray';
return 'text-success'; return 'text-success';
}; };
}) })
.filter('hashrateFilter', function() { .filter('hashrateFilter', ['$filter', function(filter) {
return function(hashrate) { return function(hashrate) {
if(typeof hashrate === 'undefined' || !hashrate) if(typeof hashrate === 'undefined' || !hashrate)
return 0; return 0;
return hashrate/1000; return filter('number')((hashrate/1000).toFixed(2));
} }
}) }])
.filter('nodeVersion', function($sce) { .filter('nodeVersion', function($sce) {
return function(version) { return function(version) {
if(typeof version !== 'undefined') if(typeof version !== 'undefined')
@ -101,7 +101,7 @@ angular.module('netStatsApp.filters', [])
}; };
}) })
.filter('gasPriceFilter', ['$filter', function(filter) { .filter('gasPriceFilter', ['$filter', function(filter) {
var numberFilter = filter('number') var numberFilter = filter('number');
return function(price) { return function(price) {
console.log("--------------------"); console.log("--------------------");
console.log(price.length); console.log(price.length);

View File

@ -184,7 +184,7 @@ block content
span.small {{node.stats | latencyFilter}} span.small {{node.stats | latencyFilter}}
td(class="{{ node.stats.mining | miningClass : node.stats.active }}") td(class="{{ node.stats.mining | miningClass : node.stats.active }}")
i(class="{{ node.stats.mining | miningIconClass }}") i(class="{{ node.stats.mining | miningIconClass }}")
td(class="{{ node.stats.mining | hashpowerClass }}") td(class="{{ node.stats.mining | hashrateClass : node.stats.active }}")
span.small {{node.stats.hashrate | hashrateFilter}} kH/s span.small {{node.stats.hashrate | hashrateFilter}} kH/s
td(class="{{ node.stats.peers | peerClass : node.stats.active }}", style="padding-left: 11px;") {{node.stats.peers}} td(class="{{ node.stats.peers | peerClass : node.stats.active }}", style="padding-left: 11px;") {{node.stats.peers}}
td(style="padding-left: 15px;") {{node.stats.pending}} td(style="padding-left: 15px;") {{node.stats.pending}}