From 604f7e99a624f14ac407216733f1251e30f80e24 Mon Sep 17 00:00:00 2001 From: cubedro Date: Tue, 28 Apr 2015 04:25:49 +0300 Subject: [PATCH] added client version check and advise --- public/js/controllers.js | 2 ++ public/js/filters.js | 11 +++++++++++ views/index.jade | 2 ++ 3 files changed, 15 insertions(+) diff --git a/public/js/controllers.js b/public/js/controllers.js index 7acfab2..a7fe11c 100644 --- a/public/js/controllers.js +++ b/public/js/controllers.js @@ -32,6 +32,8 @@ function StatsCtrl($scope, $filter, socket, _, toastr) { $scope.latency = 0; + $scope.currentApiVersion = "0.0.5"; + $scope.predicate = ['-stats.active', '-stats.block.number', 'stats.block.propagation']; $scope.reverse = false; diff --git a/public/js/filters.js b/public/js/filters.js index dd257a3..bfb97db 100644 --- a/public/js/filters.js +++ b/public/js/filters.js @@ -371,6 +371,17 @@ angular.module('netStatsApp.filters', []) return prefix + 'danger'; }; +}) +.filter('nodeClientClass', function() { + return function(info, current) { + if(typeof info === 'undefined' || typeof info.client === 'undefined' || typeof info.client === '') + return 'text-danger'; + + if(current.localeCompare(info.client) > 0) + return 'text-warning'; + + return 'hidden'; + }; }); function mainClass(node, bestBlock) diff --git a/views/index.jade b/views/index.jade index a04e36a..f7964d5 100644 --- a/views/index.jade +++ b/views/index.jade @@ -178,6 +178,8 @@ block content td.nodeInfo(rel="{{node.id}}") span.small(data-toggle="tooltip", data-placement="top", data-html="true", data-original-title="{{node | geoTooltip}}") {{node.info.name}} span.small #[ ]({{node.info.ip}}) + span.small(data-toggle="tooltip", data-placement="top", data-html="true", data-original-title="Netstats client needs update", class="{{ node.info | nodeClientClass : currentApiVersion }}") + i.icon-warning-o td div.small(ng-bind-html="node.info.node | nodeVersion") td(class="{{ node.stats | latencyClass }}")