Merge pull request #134 from cubedro/develop

UI speed improvements
This commit is contained in:
Marian OANCΞA 2015-05-19 03:43:57 +03:00
commit b4ffcde9bd
4 changed files with 48 additions and 9 deletions

View File

@ -1,7 +1,6 @@
language: node_js language: node_js
node_js: node_js:
- "0.12" - "0.12"
- "0.11"
env: env:
global: global:
secure: Qdkmi13nqcXskABBhbuGZmRakh4orOW1dalkSCyUbzGuYf0OdYF8ttNVuJa0WSWI4KhNXhtz2p3I8dM95wL++LCVqXFmIvZtX8Nca36KlNxIPNXPjn0odayh+c4pgrhrbz8TDmDXl9IPuZmNz8HHtN7xmIn6YDcm13wA3gTmfwo= secure: Qdkmi13nqcXskABBhbuGZmRakh4orOW1dalkSCyUbzGuYf0OdYF8ttNVuJa0WSWI4KhNXhtz2p3I8dM95wL++LCVqXFmIvZtX8Nca36KlNxIPNXPjn0odayh+c4pgrhrbz8TDmDXl9IPuZmNz8HHtN7xmIn6YDcm13wA3gTmfwo=

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -113,17 +113,25 @@ netStatsApp.controller('StatsCtrl', function($scope, $filter, socket, _, toastr)
$scope.nodes = data; $scope.nodes = data;
_.forEach($scope.nodes, function(node, index) { _.forEach($scope.nodes, function(node, index) {
// Init hashrate
if(typeof node.stats.hashrate === 'undefined') if(typeof node.stats.hashrate === 'undefined')
$scope.nodes[index].stats.hashrate = 0; $scope.nodes[index].stats.hashrate = 0;
// Init history
if( _.isUndefined(data.history) )
{
data.history = new Array(40);
_.fill(data.history, -1);
}
// Init pin // Init pin
$scope.nodes[index].pinned = false; $scope.nodes[index].pinned = false;
$scope.$apply();
makePeerPropagationChart($scope.nodes[index]); makePeerPropagationChart($scope.nodes[index]);
}); });
$scope.$apply();
if($scope.nodes.length > 0) if($scope.nodes.length > 0)
toastr['success']("Got nodes list", "Got nodes!"); toastr['success']("Got nodes list", "Got nodes!");
@ -146,7 +154,7 @@ netStatsApp.controller('StatsCtrl', function($scope, $filter, socket, _, toastr)
var index = findIndex({id: data.id}); var index = findIndex({id: data.id});
if(typeof $scope.nodes[index].stats !== 'undefined') { if( !_.isUndefined($scope.nodes[index].stats) ) {
if($scope.nodes[index].stats.block.number < data.stats.block.number) if($scope.nodes[index].stats.block.number < data.stats.block.number)
{ {
@ -163,6 +171,9 @@ netStatsApp.controller('StatsCtrl', function($scope, $filter, socket, _, toastr)
$scope.nodes[index].stats = data.stats; $scope.nodes[index].stats = data.stats;
$scope.nodes[index].history = data.history; $scope.nodes[index].history = data.history;
$scope.$apply();
makePeerPropagationChart($scope.nodes[index]); makePeerPropagationChart($scope.nodes[index]);
} }
@ -203,6 +214,8 @@ netStatsApp.controller('StatsCtrl', function($scope, $filter, socket, _, toastr)
$scope.gasSpending = data.gasSpending; $scope.gasSpending = data.gasSpending;
$scope.miners = data.miners; $scope.miners = data.miners;
$scope.$apply();
getMinersNames(); getMinersNames();
jQuery('.spark-blocktimes').sparkline($scope.lastBlocksTime, {type: 'bar', tooltipSuffix: ' s'}); jQuery('.spark-blocktimes').sparkline($scope.lastBlocksTime, {type: 'bar', tooltipSuffix: ' s'});
@ -228,6 +241,8 @@ netStatsApp.controller('StatsCtrl', function($scope, $filter, socket, _, toastr)
if( !_.isUndefined(node) && !_.isUndefined(node.stats) && !_.isUndefined(node.stats.latency)) 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;
$scope.$apply();
break; break;
case "client-ping": case "client-ping":
@ -236,7 +251,10 @@ netStatsApp.controller('StatsCtrl', function($scope, $filter, socket, _, toastr)
break; break;
} }
updateStats(); if(action !== "latency")
{
updateStats();
}
} }
function findIndex(search) function findIndex(search)
@ -295,17 +313,39 @@ netStatsApp.controller('StatsCtrl', function($scope, $filter, socket, _, toastr)
data.pinned = false; data.pinned = false;
if( _.isUndefined(data.history) )
{
data.history = new Array(40);
_.fill(data.history, -1);
}
$scope.nodes.push(data); $scope.nodes.push(data);
return true; return true;
} }
if( !_.isUndefined($scope.nodes[index].pinned)) { if( !_.isUndefined($scope.nodes[index].pinned) )
{
data.pinned = $scope.nodes[index].pinned data.pinned = $scope.nodes[index].pinned
} else { }
else
{
data.pinned = false; data.pinned = false;
} }
if( !_.isUndefined($scope.nodes[index].pinned) )
{
data.history = $scope.nodes[index].history
}
else
{
if( _.isUndefined(data.history) )
{
data.history = new Array(40);
_.fill(data.history, -1);
}
}
$scope.nodes[index] = data; $scope.nodes[index] = data;
return false; return false;