fixed times
This commit is contained in:
parent
21a598bd7a
commit
469adc33b2
@ -117,7 +117,7 @@ function StatsCtrl($scope, $filter, socket, _, toastr) {
|
|||||||
|
|
||||||
$scope.lastBlock = _.max($scope.nodes, function(node) {
|
$scope.lastBlock = _.max($scope.nodes, function(node) {
|
||||||
return parseInt(node.stats.block.timestamp);
|
return parseInt(node.stats.block.timestamp);
|
||||||
}).stats.block.blocktime;
|
}).stats.block.timestamp;
|
||||||
|
|
||||||
$scope.lastDifficulty = _.max($scope.nodes, function(node) {
|
$scope.lastDifficulty = _.max($scope.nodes, function(node) {
|
||||||
return parseInt(node.stats.block.timestamp);
|
return parseInt(node.stats.block.timestamp);
|
||||||
|
@ -66,14 +66,23 @@ angular.module('netStatsApp.filters', [])
|
|||||||
};
|
};
|
||||||
})
|
})
|
||||||
.filter('blockTimeFilter', function() {
|
.filter('blockTimeFilter', function() {
|
||||||
return function(time) {
|
return function(timestamp) {
|
||||||
if(time === 0)
|
var time = Math.floor((new Date()).getTime() / 1000);
|
||||||
|
var diff = time - timestamp;
|
||||||
|
|
||||||
|
if(diff === 0)
|
||||||
return '∞';
|
return '∞';
|
||||||
|
|
||||||
return moment.duration(Math.round(time), 's').humanize() + ' ago';
|
if(diff < 60)
|
||||||
|
return Math.round(diff) + ' s';
|
||||||
|
|
||||||
|
return moment.duration(Math.round(diff), 's').humanize() + ' ago';
|
||||||
};
|
};
|
||||||
}).filter('avgTimeFilter', function() {
|
}).filter('avgTimeFilter', function() {
|
||||||
return function(time) {
|
return function(time) {
|
||||||
|
if(time < 60)
|
||||||
|
return Math.round(time) + ' s';
|
||||||
|
|
||||||
return moment.duration(Math.round(time), 's').humanize();
|
return moment.duration(Math.round(time), 's').humanize();
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
|
@ -103,5 +103,5 @@ block content
|
|||||||
td(class="{{ node.stats.block.number | blockClass : bestBlock }}").hidden-sm.hidden-xs
|
td(class="{{ node.stats.block.number | blockClass : bestBlock }}").hidden-sm.hidden-xs
|
||||||
span.small {{node.stats.block.hash}}
|
span.small {{node.stats.block.hash}}
|
||||||
//- 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(class="{{ node.stats.block.timestamp | timeClass }}") {{node.stats.block.blocktime | blockTimeFilter }}
|
td(class="{{ node.stats.block.timestamp | timeClass }}") {{node.stats.block.timestamp | blockTimeFilter }}
|
||||||
td(class="{{ node.stats.uptime | upTimeClass }}") {{ node.stats.uptime | upTimeFilter }}
|
td(class="{{ node.stats.uptime | upTimeClass }}") {{ node.stats.uptime | upTimeFilter }}
|
||||||
|
Loading…
Reference in New Issue
Block a user