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);
|
||||
node.update();
|
||||
nodes[i] = node;
|
||||
nodeStatus[i] = {
|
||||
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
|
||||
};
|
||||
nodeStatus[i] = node.info;
|
||||
}
|
||||
|
||||
app.get('/', function(req, res) {
|
||||
|
@ -1,21 +1,7 @@
|
||||
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',
|
||||
type: 'C++',
|
||||
rpcHost: 'localhost',
|
||||
rpcPort: '8080'
|
||||
}
|
||||
|
@ -1,3 +1,3 @@
|
||||
'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 */
|
||||
|
||||
function StatsCtrl($scope, socket) {
|
||||
function StatsCtrl($scope, socket, _) {
|
||||
|
||||
// Socket listeners
|
||||
// ----------------
|
||||
@ -10,6 +10,7 @@ function StatsCtrl($scope, socket) {
|
||||
socket.on('init', function(data){
|
||||
$scope.nodes = data.nodes;
|
||||
$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
@ -25,3 +25,8 @@ app.factory('socket', function ($rootScope) {
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
var underscore = angular.module('underscore', []);
|
||||
underscore.factory('_', function() {
|
||||
return window._;
|
||||
});
|
@ -16,7 +16,7 @@ block content
|
||||
i.icon-bulb
|
||||
div.pull-left
|
||||
span.small-title nodes active
|
||||
span.big-details {{nodesTotal}}/{{nodesActive}}
|
||||
span.big-details {{nodesActive}}/{{nodesTotal}}
|
||||
div.clearfix
|
||||
div.col-xs-6.stat-holder
|
||||
div.row.big-info.bestblock.text-info
|
||||
@ -24,7 +24,7 @@ block content
|
||||
i.icon-block
|
||||
div.pull-left
|
||||
span.small-title best block
|
||||
span.big-details {{bestBlock}}
|
||||
span.big-details {{"#" + bestBlock}}
|
||||
div.clearfix
|
||||
div.col-xs-6.stat-holder
|
||||
div.row.big-info.blocktime.text-success
|
||||
@ -74,15 +74,15 @@ block content
|
||||
th
|
||||
i.icon-clock
|
||||
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 {{node.type}}
|
||||
td {{node.peers}}
|
||||
td(class="{{(node.mining === false) ? 'text-danger' : 'text-success'}}")
|
||||
i(class="{{(node.mining === false) ? 'icon-cancel' : 'icon-check'}}")
|
||||
td {{'#' + node.block.height}}
|
||||
td {{node.stats.peers}}
|
||||
td(class="{{(node.stats.mining === false) ? 'text-danger' : 'text-success'}}")
|
||||
i(class="{{(node.stats.mining === false) ? 'icon-cancel' : 'icon-check'}}")
|
||||
td {{'#' + node.stats.block.height}}
|
||||
td.hidden-sm.hidden-xs
|
||||
span.small {{node.block.hash}}
|
||||
span.small {{node.stats.block.hash}}
|
||||
td 16 sec
|
||||
td 98.3%
|
||||
//- tr.text-success
|
||||
|
@ -13,6 +13,7 @@ html(ng-app="netStatsApp")
|
||||
|
||||
script(src="/js/lib/angular.min.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/d3.v3.min.js")
|
||||
script(src="/js/lib/topojson.v1.min.js")
|
||||
|
Loading…
Reference in New Issue
Block a user