fixed huge cpu load
This commit is contained in:
parent
403304947a
commit
89ba119123
2
dist/index.html
vendored
2
dist/index.html
vendored
File diff suppressed because one or more lines are too long
2
dist/js/netstats.min.js
vendored
2
dist/js/netstats.min.js
vendored
File diff suppressed because one or more lines are too long
2
dist/js/netstats.min.js.map
vendored
2
dist/js/netstats.min.js.map
vendored
File diff suppressed because one or more lines are too long
@ -63,10 +63,10 @@ netStatsApp.controller('StatsCtrl', function($scope, $filter, socket, _, toastr)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// var timeout = setInterval(function ()
|
var timeout = setInterval(function ()
|
||||||
// {
|
{
|
||||||
// $scope.$apply();
|
$scope.$apply();
|
||||||
// }, 200);
|
}, 200);
|
||||||
|
|
||||||
$scope.getNumber = function (num) {
|
$scope.getNumber = function (num) {
|
||||||
return new Array(num);
|
return new Array(num);
|
||||||
|
@ -7,48 +7,48 @@ angular.module('netStatsApp.directives', [])
|
|||||||
elm.text(version);
|
elm.text(version);
|
||||||
};
|
};
|
||||||
}])
|
}])
|
||||||
.directive('timeAgo', ['$interval', function($interval) {
|
// .directive('timeAgo', ['$interval', function($interval) {
|
||||||
function link (scope, element, attrs)
|
// function link (scope, element, attrs)
|
||||||
{
|
// {
|
||||||
var timestamp,
|
// var timestamp,
|
||||||
timeoutId;
|
// timeoutId;
|
||||||
|
|
||||||
function updateTime() {
|
// function updateTime() {
|
||||||
element.text(timeAgo())
|
// element.text(timeAgo())
|
||||||
}
|
// }
|
||||||
|
|
||||||
function timeAgo()
|
// function timeAgo()
|
||||||
{
|
// {
|
||||||
if(timestamp === 0)
|
// if(timestamp === 0)
|
||||||
return '∞';
|
// return '∞';
|
||||||
|
|
||||||
var time = (new Date()).getTime();
|
// var time = (new Date()).getTime();
|
||||||
var diff = Math.floor((time - timestamp)/1000);
|
// var diff = Math.floor((time - timestamp)/1000);
|
||||||
|
|
||||||
if(diff < 60)
|
// if(diff < 60)
|
||||||
return Math.round(diff) + ' s ago';
|
// return Math.round(diff) + ' s ago';
|
||||||
|
|
||||||
return moment.duration(Math.round(diff), 's').humanize() + ' ago';
|
// return moment.duration(Math.round(diff), 's').humanize() + ' ago';
|
||||||
};
|
// };
|
||||||
|
|
||||||
scope.$watch(attrs.timeAgo, function(value) {
|
// scope.$watch(attrs.timeAgo, function(value) {
|
||||||
timestamp = value;
|
// timestamp = value;
|
||||||
updateTime();
|
// updateTime();
|
||||||
});
|
// });
|
||||||
|
|
||||||
element.on('$destroy', function() {
|
// element.on('$destroy', function() {
|
||||||
$interval.cancel(timeoutId);
|
// $interval.cancel(timeoutId);
|
||||||
});
|
// });
|
||||||
|
|
||||||
timeoutId = $interval(function () {
|
// timeoutId = $interval(function () {
|
||||||
updateTime();
|
// updateTime();
|
||||||
}, 200);
|
// }, 200);
|
||||||
};
|
// };
|
||||||
|
|
||||||
return {
|
// return {
|
||||||
link: link
|
// link: link
|
||||||
};
|
// };
|
||||||
}])
|
// }])
|
||||||
|
|
||||||
.directive('sparkchart', function () {
|
.directive('sparkchart', function () {
|
||||||
return {
|
return {
|
||||||
|
@ -26,8 +26,8 @@ block content
|
|||||||
i.icon-time
|
i.icon-time
|
||||||
div.big-details-holder
|
div.big-details-holder
|
||||||
span.small-title last block
|
span.small-title last block
|
||||||
//- span.big-details {{ lastBlock | blockTimeFilter }}
|
span.big-details {{ lastBlock | blockTimeFilter }}
|
||||||
span.big-details(time-ago="lastBlock")
|
//- span.big-details(time-ago="lastBlock")
|
||||||
div.clearfix
|
div.clearfix
|
||||||
div.col-xs-2.stat-holder
|
div.col-xs-2.stat-holder
|
||||||
div.big-info.avgblocktime(class="{{ avgBlockTime | avgTimeClass }}")
|
div.big-info.avgblocktime(class="{{ avgBlockTime | avgTimeClass }}")
|
||||||
@ -205,7 +205,7 @@ block content
|
|||||||
span.small {{node.stats.block.totalDifficulty | number}}
|
span.small {{node.stats.block.totalDifficulty | number}}
|
||||||
td(style="padding-left: 14px;") {{node.stats.block.transactions.length || 0}}
|
td(style="padding-left: 14px;") {{node.stats.block.transactions.length || 0}}
|
||||||
td(style="padding-left: 14px;") {{node.stats.block.uncles.length || 0}}
|
td(style="padding-left: 14px;") {{node.stats.block.uncles.length || 0}}
|
||||||
td(class="{{ node.stats.block.received | timeClass : node.stats.active }}", time-ago="node.stats.block.received")
|
td(class="{{ node.stats.block.received | timeClass : node.stats.active }}") {{node.stats.block.received | blockTimeFilter }}
|
||||||
td(class="{{ node.stats | propagationTimeClass : bestBlock }}")
|
td(class="{{ node.stats | propagationTimeClass : bestBlock }}")
|
||||||
div.propagationBox
|
div.propagationBox
|
||||||
span {{node.stats.block.propagation | blockPropagationFilter}}
|
span {{node.stats.block.propagation | blockPropagationFilter}}
|
||||||
|
Loading…
Reference in New Issue
Block a user