added hashrate filter
This commit is contained in:
parent
3a81372329
commit
df87857692
@ -133,6 +133,10 @@ span.small-title span.small {
|
|||||||
word-spacing: nowrap !important;
|
word-spacing: nowrap !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.big-info .big-details .small-hash {
|
||||||
|
font-size: 87%;
|
||||||
|
}
|
||||||
|
|
||||||
.big-info .big-details-holder {
|
.big-info .big-details-holder {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 15px;
|
top: 15px;
|
||||||
|
@ -178,7 +178,7 @@ function StatsCtrl($scope, $filter, socket, _, toastr) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case "inactive":
|
case "inactive":
|
||||||
if(typeof data.stats !== 'undefined')
|
if( !_.isUndefined(data.stats) )
|
||||||
$scope.nodes[findIndex({id: data.id})].stats = data.stats;
|
$scope.nodes[findIndex({id: data.id})].stats = data.stats;
|
||||||
|
|
||||||
toastr['error']("Node "+ $scope.nodes[findIndex({id: data.id})].info.name +" went away!", "Node connection was lost!");
|
toastr['error']("Node "+ $scope.nodes[findIndex({id: data.id})].info.name +" went away!", "Node connection was lost!");
|
||||||
@ -186,9 +186,10 @@ function StatsCtrl($scope, $filter, socket, _, toastr) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case "latency":
|
case "latency":
|
||||||
|
if( !_.isUndefined(data.id) )
|
||||||
var node = $scope.nodes[findIndex({id: data.id})];
|
var node = $scope.nodes[findIndex({id: data.id})];
|
||||||
|
|
||||||
if(typeof node.stats !== 'undefined' && typeof node.stats.latency !== 'undefined')
|
if( !_.isUndefined(node) && !_.isUndefined(node.stats) && !_.isUndefined(node.stats.latency))
|
||||||
$scope.nodes[findIndex({id: data.id})].stats.latency = data.latency;
|
$scope.nodes[findIndex({id: data.id})].stats.latency = data.latency;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -231,35 +231,42 @@ angular.module('netStatsApp.filters', [])
|
|||||||
return moment.duration(Math.round(diff), 's').humanize() + ' ago';
|
return moment.duration(Math.round(diff), 's').humanize() + ' ago';
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
.filter('networkHashrateFilter', function($sce) {
|
.filter('networkHashrateFilter', ['$sce', '$filter', function($sce, filter) {
|
||||||
return function(hashes) {
|
return function(hashes, isMining) {
|
||||||
var result = 0;
|
var result = 0;
|
||||||
|
var unit = 'K';
|
||||||
|
|
||||||
if(hashes < 1000) {
|
if(hashes !== 0 && hashes < 1000) {
|
||||||
return $sce.trustAsHtml(result.toFixed(1) + ' <span class="small">H/s</span>');
|
result = hashes;
|
||||||
|
unit = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if(hashes < Math.pow(1000, 2)) {
|
if(hashes >= 1000 && hashes < Math.pow(1000, 2)) {
|
||||||
result = hashes / 1000;
|
result = hashes / 1000;
|
||||||
return $sce.trustAsHtml(result.toFixed(1) + ' <span class="small">KH/s</span>');
|
unit = 'K';
|
||||||
}
|
}
|
||||||
|
|
||||||
if(hashes < Math.pow(1000, 3)) {
|
if(hashes >= Math.pow(1000, 2) && hashes < Math.pow(1000, 3)) {
|
||||||
result = hashes / Math.pow(1000, 2);
|
result = hashes / Math.pow(1000, 2);
|
||||||
return $sce.trustAsHtml(result.toFixed(1) + ' <span class="small">MH/s</span>');
|
unit = 'M';
|
||||||
}
|
}
|
||||||
|
|
||||||
if(hashes < Math.pow(1000, 4)) {
|
if(hashes >= Math.pow(1000, 3) && hashes < Math.pow(1000, 4)) {
|
||||||
result = hashes / Math.pow(1000, 3);
|
result = hashes / Math.pow(1000, 3);
|
||||||
return $sce.trustAsHtml(result.toFixed(1) + ' <span class="small">GH/s</span>');
|
unit = 'G';
|
||||||
}
|
}
|
||||||
|
|
||||||
if(hashes < Math.pow(1000, 5)) {
|
if(hashes >= Math.pow(1000, 4) && hashes < Math.pow(1000, 5)) {
|
||||||
result = hashes / Math.pow(1000, 4);
|
result = hashes / Math.pow(1000, 4);
|
||||||
return $sce.trustAsHtml(result.toFixed(1) + ' <span class="small">TH/s</span>');
|
unit = 'T';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( !isMining )
|
||||||
|
return $sce.trustAsHtml(filter('number')(result.toFixed(1)) + ' <span class="small-hash">' + unit + 'H/s</span>');
|
||||||
|
|
||||||
|
return $sce.trustAsHtml('? <span class="small-hash">' + unit + 'KH/s</span>');
|
||||||
};
|
};
|
||||||
})
|
}])
|
||||||
.filter('blockPropagationFilter', function() {
|
.filter('blockPropagationFilter', function() {
|
||||||
return function(ms, prefix) {
|
return function(ms, prefix) {
|
||||||
if(typeof prefix === 'undefined')
|
if(typeof prefix === 'undefined')
|
||||||
|
@ -104,7 +104,7 @@ block content
|
|||||||
div.big-info.chart.xdouble-chart(class="{{ blockPropagationAvg | propagationAvgTimeClass : true }}")
|
div.big-info.chart.xdouble-chart(class="{{ blockPropagationAvg | propagationAvgTimeClass : true }}")
|
||||||
//- i.icon-gas
|
//- i.icon-gas
|
||||||
span.small-title block propagation
|
span.small-title block propagation
|
||||||
span.small-value {{ blockPropagationAvg | blockPropagationFilter : '' }}
|
//- span.small-value {{ blockPropagationAvg | blockPropagationFilter : '' }}
|
||||||
histogram.big-details.d3-blockpropagation(data="blockPropagationChart")
|
histogram.big-details.d3-blockpropagation(data="blockPropagationChart")
|
||||||
|
|
||||||
div.col-xs-3.stat-holder.pull-right
|
div.col-xs-3.stat-holder.pull-right
|
||||||
@ -192,7 +192,8 @@ block content
|
|||||||
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 | hashrateClass : node.stats.active }}")
|
td(class="{{ node.stats.mining | hashrateClass : node.stats.active }}")
|
||||||
span.small {{node.stats.hashrate | hashrateFilter}} kH/s
|
span.small(ng-bind-html="node.stats.hashrate | networkHashrateFilter")
|
||||||
|
//- {{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}}
|
||||||
td(class="{{ node.stats | blockClass : bestBlock }}") {{'#'}}{{ node.stats.block.number | number }}
|
td(class="{{ node.stats | blockClass : bestBlock }}") {{'#'}}{{ node.stats.block.number | number }}
|
||||||
|
Loading…
Reference in New Issue
Block a user