Merge pull request #113 from cubedro/develop
Joined mining and hashrate columns
This commit is contained in:
commit
699a53fb72
@ -50,13 +50,41 @@ angular.module('netStatsApp.filters', [])
|
||||
return 'text-success';
|
||||
};
|
||||
})
|
||||
.filter('hashrateFilter', ['$filter', function(filter) {
|
||||
return function(hashrate) {
|
||||
if(typeof hashrate === 'undefined' || !hashrate)
|
||||
return 0;
|
||||
.filter('hashrateFilter', ['$sce', '$filter', function($sce, filter) {
|
||||
return function(hashes, isMining) {
|
||||
var result = 0;
|
||||
var unit = 'K';
|
||||
|
||||
return filter('number')((hashrate/1000).toFixed(2));
|
||||
}
|
||||
if( !isMining )
|
||||
return $sce.trustAsHtml('<i class="icon-cancel"></i>');
|
||||
|
||||
if(hashes !== 0 && hashes < 1000) {
|
||||
result = hashes;
|
||||
unit = '';
|
||||
}
|
||||
|
||||
if(hashes >= 1000 && hashes < Math.pow(1000, 2)) {
|
||||
result = hashes / 1000;
|
||||
unit = 'K';
|
||||
}
|
||||
|
||||
if(hashes >= Math.pow(1000, 2) && hashes < Math.pow(1000, 3)) {
|
||||
result = hashes / Math.pow(1000, 2);
|
||||
unit = 'M';
|
||||
}
|
||||
|
||||
if(hashes >= Math.pow(1000, 3) && hashes < Math.pow(1000, 4)) {
|
||||
result = hashes / Math.pow(1000, 3);
|
||||
unit = 'G';
|
||||
}
|
||||
|
||||
if(hashes >= Math.pow(1000, 4) && hashes < Math.pow(1000, 5)) {
|
||||
result = hashes / Math.pow(1000, 4);
|
||||
unit = 'T';
|
||||
}
|
||||
|
||||
return $sce.trustAsHtml('<span class="small">' + filter('number')(result.toFixed(1)) + ' <span class="small-hash">' + unit + 'H/s</span></span>');
|
||||
};
|
||||
}])
|
||||
.filter('nodeVersion', function($sce) {
|
||||
return function(version) {
|
||||
|
@ -156,8 +156,6 @@ block content
|
||||
i.icon-clock(data-toggle="tooltip", data-placement="top", title="Node latency", ng-click="orderTable(['-stats.active', 'stats.latency'], false)")
|
||||
th
|
||||
i.icon-mining(data-toggle="tooltip", data-placement="top", title="Is mining", ng-click="orderTable(['-stats.active', '-stats.mining'], false)")
|
||||
th
|
||||
i.icon-hashrate(data-toggle="tooltip", data-placement="top", title="Hashrate", ng-click="orderTable(['-stats.active', '-stats.mining', '-stats.hashrate'], false)")
|
||||
th
|
||||
i.icon-group(data-toggle="tooltip", data-placement="top", title="Peers", ng-click="orderTable(['-stats.active', '-stats.peers'], false)")
|
||||
th
|
||||
@ -189,11 +187,7 @@ block content
|
||||
div.small(ng-bind-html="node.info.node | nodeVersion")
|
||||
td(class="{{ node.stats | latencyClass }}")
|
||||
span.small {{node.stats | latencyFilter}}
|
||||
td(class="{{ node.stats.mining | miningClass : node.stats.active }}")
|
||||
i(class="{{ node.stats.mining | miningIconClass }}")
|
||||
td(class="{{ node.stats.mining | hashrateClass : node.stats.active }}")
|
||||
span.small(ng-bind-html="node.stats.hashrate | networkHashrateFilter")
|
||||
//- {{node.stats.hashrate | hashrateFilter}} kH/s
|
||||
td(class="{{ node.stats.mining | hashrateClass : node.stats.active }}", ng-bind-html="node.stats.hashrate | hashrateFilter : node.stats.mining")
|
||||
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(class="{{ node.stats | blockClass : bestBlock }}") {{'#'}}{{ node.stats.block.number | number }}
|
||||
|
Loading…
Reference in New Issue
Block a user