added location tooltip

This commit is contained in:
Marian Oancea 2015-02-05 10:27:12 +02:00
parent 81ce05ca1a
commit 11158060bf
4 changed files with 11 additions and 3 deletions

View File

@ -25,6 +25,5 @@ function StatsCtrl($scope, socket, _) {
$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;
$scope.lastBlock = _.max($scope.nodes, function(node){ return parseInt(node.stats.block.timestamp); }).stats.block.timestamp;
$scope.apply();
}
}

View File

@ -54,6 +54,10 @@ angular.module('netStatsApp.filters', [])
return function(timestamp) {
return timeClass(timestamp);
};
}).filter('geoTooltip', function() {
return function(geo) {
return geo.city + ", " + geo.country;
};
});
function peerClass(peers)

View File

@ -80,5 +80,9 @@
console.log(data);
});
$('[data-toggle="tooltip"]').tooltip();
$('body').on('mouseenter', '[data-toggle="tooltip"]', function( event ) {
$(this).tooltip('show');
}).on('mouseleave', '[data-toggle="tooltip"]', function( event ) {
$(this).tooltip('hide');
})
})();

View File

@ -74,7 +74,8 @@ block content
i.icon-clock(data-toggle="tooltip", data-placement="top", title="Up-time")
tbody
tr(ng-repeat='node in nodes', class="{{ node.stats | mainClass : bestBlock }}")
td(rel="{{node.id}}") {{node.name}}
td(rel="{{node.id}}")
span(data-toggle="tooltip", data-placement="top", data-original-title="{{node.geo | geoTooltip}}") {{node.name}}
td {{node.type}}
td(class="{{ node.stats.peers | peerClass }}") {{node.stats.peers}}
td(class="{{ node.stats.mining | miningClass }}")