added underscore + fixes
This commit is contained in:
parent
be62d895b1
commit
8427f59ca7
9
app.js
9
app.js
@ -29,14 +29,7 @@ for(i in config) {
|
|||||||
console.log(node);
|
console.log(node);
|
||||||
node.update();
|
node.update();
|
||||||
nodes[i] = node;
|
nodes[i] = node;
|
||||||
nodeStatus[i] = {
|
nodeStatus[i] = node.info;
|
||||||
name: node.info.name,
|
|
||||||
type: 'C++',
|
|
||||||
active: (node.info.stats.peers > 0),
|
|
||||||
peers: node.info.stats.peers || 0,
|
|
||||||
mining: node.info.stats.mining || false,
|
|
||||||
block: node.info.stats.block
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
app.get('/', function(req, res) {
|
app.get('/', function(req, res) {
|
||||||
|
@ -1,21 +1,7 @@
|
|||||||
var nodes = [
|
var nodes = [
|
||||||
// {
|
|
||||||
// name: 'poc-7.ethdev.com',
|
|
||||||
// rpcHost: '207.12.89.180',
|
|
||||||
// rpcPort: '8080'
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// name: '54.204.10.41',
|
|
||||||
// rpcHost: '54.204.10.41',
|
|
||||||
// rpcPort: '8080'
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// name: 'poc-7.ethdev.com - new IP',
|
|
||||||
// rpcHost: '5.45.179.140',
|
|
||||||
// rpcPort: '8080'
|
|
||||||
// },
|
|
||||||
{
|
{
|
||||||
name: 'local',
|
name: 'local',
|
||||||
|
type: 'C++',
|
||||||
rpcHost: 'localhost',
|
rpcHost: 'localhost',
|
||||||
rpcPort: '8080'
|
rpcPort: '8080'
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var app = angular.module('netStatsApp', ['netStatsApp.filters', 'netStatsApp.directives']);
|
var app = angular.module('netStatsApp', ['underscore', 'netStatsApp.filters', 'netStatsApp.directives']);
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
/* Controllers */
|
/* Controllers */
|
||||||
|
|
||||||
function StatsCtrl($scope, socket) {
|
function StatsCtrl($scope, socket, _) {
|
||||||
|
|
||||||
// Socket listeners
|
// Socket listeners
|
||||||
// ----------------
|
// ----------------
|
||||||
@ -10,6 +10,7 @@ function StatsCtrl($scope, socket) {
|
|||||||
socket.on('init', function(data){
|
socket.on('init', function(data){
|
||||||
$scope.nodes = data.nodes;
|
$scope.nodes = data.nodes;
|
||||||
$scope.nodesTotal = $scope.nodes.length;
|
$scope.nodesTotal = $scope.nodes.length;
|
||||||
$scope.nodesActive = $scope.nodes.length;
|
$scope.nodesActive = _.filter($scope.nodes, function(node){ return node.stats.active == true; }).length;
|
||||||
|
$scope.bestBlock = _.max($scope.nodes, function(node){ return parseInt(node.stats.block.height); }).stats.block.height;
|
||||||
});
|
});
|
||||||
}
|
}
|
6
public/js/lib/underscore.min.js
vendored
Normal file
6
public/js/lib/underscore.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -24,4 +24,9 @@ app.factory('socket', function ($rootScope) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
var underscore = angular.module('underscore', []);
|
||||||
|
underscore.factory('_', function() {
|
||||||
|
return window._;
|
||||||
});
|
});
|
@ -16,7 +16,7 @@ block content
|
|||||||
i.icon-bulb
|
i.icon-bulb
|
||||||
div.pull-left
|
div.pull-left
|
||||||
span.small-title nodes active
|
span.small-title nodes active
|
||||||
span.big-details {{nodesTotal}}/{{nodesActive}}
|
span.big-details {{nodesActive}}/{{nodesTotal}}
|
||||||
div.clearfix
|
div.clearfix
|
||||||
div.col-xs-6.stat-holder
|
div.col-xs-6.stat-holder
|
||||||
div.row.big-info.bestblock.text-info
|
div.row.big-info.bestblock.text-info
|
||||||
@ -24,7 +24,7 @@ block content
|
|||||||
i.icon-block
|
i.icon-block
|
||||||
div.pull-left
|
div.pull-left
|
||||||
span.small-title best block
|
span.small-title best block
|
||||||
span.big-details {{bestBlock}}
|
span.big-details {{"#" + bestBlock}}
|
||||||
div.clearfix
|
div.clearfix
|
||||||
div.col-xs-6.stat-holder
|
div.col-xs-6.stat-holder
|
||||||
div.row.big-info.blocktime.text-success
|
div.row.big-info.blocktime.text-success
|
||||||
@ -74,15 +74,15 @@ block content
|
|||||||
th
|
th
|
||||||
i.icon-clock
|
i.icon-clock
|
||||||
tbody
|
tbody
|
||||||
tr(ng-repeat='node in nodes', class="{{ node.active ? 'text-success' : 'text-danger' }}")
|
tr(ng-repeat='node in nodes', class="{{ node.stats.active ? 'text-success' : 'text-danger' }}")
|
||||||
td(rel="{{node.id}}") {{node.name}}
|
td(rel="{{node.id}}") {{node.name}}
|
||||||
td {{node.type}}
|
td {{node.type}}
|
||||||
td {{node.peers}}
|
td {{node.stats.peers}}
|
||||||
td(class="{{(node.mining === false) ? 'text-danger' : 'text-success'}}")
|
td(class="{{(node.stats.mining === false) ? 'text-danger' : 'text-success'}}")
|
||||||
i(class="{{(node.mining === false) ? 'icon-cancel' : 'icon-check'}}")
|
i(class="{{(node.stats.mining === false) ? 'icon-cancel' : 'icon-check'}}")
|
||||||
td {{'#' + node.block.height}}
|
td {{'#' + node.stats.block.height}}
|
||||||
td.hidden-sm.hidden-xs
|
td.hidden-sm.hidden-xs
|
||||||
span.small {{node.block.hash}}
|
span.small {{node.stats.block.hash}}
|
||||||
td 16 sec
|
td 16 sec
|
||||||
td 98.3%
|
td 98.3%
|
||||||
//- tr.text-success
|
//- tr.text-success
|
||||||
|
@ -13,6 +13,7 @@ html(ng-app="netStatsApp")
|
|||||||
|
|
||||||
script(src="/js/lib/angular.min.js")
|
script(src="/js/lib/angular.min.js")
|
||||||
script(src="/socket.io/socket.io.js")
|
script(src="/socket.io/socket.io.js")
|
||||||
|
script(src="/js/lib/underscore.min.js")
|
||||||
script(src="/js/lib/jquery.min.js")
|
script(src="/js/lib/jquery.min.js")
|
||||||
script(src="/js/lib/d3.v3.min.js")
|
script(src="/js/lib/d3.v3.min.js")
|
||||||
script(src="/js/lib/topojson.v1.min.js")
|
script(src="/js/lib/topojson.v1.min.js")
|
||||||
|
Loading…
Reference in New Issue
Block a user