added underscore + fixes
This commit is contained in:
@@ -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
@@ -24,4 +24,9 @@ app.factory('socket', function ($rootScope) {
|
||||
})
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
var underscore = angular.module('underscore', []);
|
||||
underscore.factory('_', function() {
|
||||
return window._;
|
||||
});
|
||||
Reference in New Issue
Block a user