added block time bar chart

pull/5/head
cubedro 10 years ago
parent a01706c971
commit 92ae0e9144
  1. 2
      app.js
  2. 30
      public/css/style.css
  3. BIN
      public/images/favicon.png
  4. 10
      public/js/controllers.js
  5. 4
      public/js/filters.js
  6. 2
      public/js/lib/jquery.sparkline.min.js
  7. 23
      public/js/script.js
  8. 12
      views/index.jade
  9. 1
      views/layout.jade

@ -103,7 +103,7 @@ client.on('connection', function(spark) {
// view engine setup // view engine setup
app.set('views', path.join(__dirname, 'views')); app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'jade'); app.set('view engine', 'jade');
//app.use(favicon(__dirname + '/public/favicon.ico')); app.use(favicon(path.join(__dirname, '/public/images/favicon.png')));
app.use(bodyParser.json()); app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false })); app.use(bodyParser.urlencoded({ extended: false }));
app.use(express.static(path.join(__dirname, 'public'))); app.use(express.static(path.join(__dirname, 'public')));

@ -34,6 +34,10 @@ body {
color: #aaa !important; color: #aaa !important;
} }
.big-info.chart {
padding-left: 15px;
}
.big-info span.big-details { .big-info span.big-details {
display: block; display: block;
font-weight: 200; font-weight: 200;
@ -42,6 +46,32 @@ body {
letter-spacing: -4px; letter-spacing: -4px;
} }
.big-info.chart span.big-details {
padding-top: 15px;
}
.jqstooltip {
}
.jqsfield {
position: relative;
padding: 5px 0;
width: 40px;
left: -20px;
word-wrap: wrap;
text-align: center;
}
.jqsfield .tooltip-arrow {
position: absolute;
bottom: 0;
left: 50%;
margin-left: -5px;
border-width: 5px 5px 0;
border-top-color: #fff;
}
table i { table i {
-webkit-font-smoothing: subpixel-antialiased; -webkit-font-smoothing: subpixel-antialiased;
-moz-font-smoothing: subpixel-antialiased; -moz-font-smoothing: subpixel-antialiased;

Binary file not shown.

After

Width:  |  Height:  |  Size: 574 B

@ -15,6 +15,8 @@ function StatsCtrl($scope, $filter, socket, _, toastr) {
$scope.upTimeTotal = 0; $scope.upTimeTotal = 0;
$scope.avgBlockTime = 0; $scope.avgBlockTime = 0;
$scope.lastBlocksTime = [];
$scope.nodes = []; $scope.nodes = [];
$scope.map = []; $scope.map = [];
@ -135,6 +137,12 @@ function StatsCtrl($scope, $filter, socket, _, toastr) {
return total + node.stats.uptime; return total + node.stats.uptime;
}, 0) / $scope.nodes.length; }, 0) / $scope.nodes.length;
$scope.lastBlocksTime = _.max($scope.nodes, function(node) {
return parseInt(node.stats.block.number);
}).stats.blockTimes;
jQuery('.spark-blocktimes').sparkline($scope.lastBlocksTime, {type: 'bar', tooltipSuffix: 's'});
$scope.map = _.map($scope.nodes, function(node) { $scope.map = _.map($scope.nodes, function(node) {
if(node.geo != null) if(node.geo != null)
return { return {
@ -151,7 +159,7 @@ function StatsCtrl($scope, $filter, socket, _, toastr) {
}; };
}); });
console.log($scope.map); // console.log($scope.map);
} }
$scope.$apply(); $scope.$apply();

@ -41,12 +41,16 @@ angular.module('netStatsApp.filters', [])
}) })
.filter('nodeVersion', function($sce) { .filter('nodeVersion', function($sce) {
return function(version) { return function(version) {
if(typeof version !== 'undefined') {
version = version.replace('eth version ', 'v') version = version.replace('eth version ', 'v')
.replace("\n" + 'Network protocol version: ', ' (') .replace("\n" + 'Network protocol version: ', ' (')
.replace("\n" + 'Client database version: ', ',') .replace("\n" + 'Client database version: ', ',')
.replace("\n" + 'Build: ', ') - ') .replace("\n" + 'Build: ', ') - ')
.replace('/Debug', '') .replace('/Debug', '')
.replace('/.', ''); .replace('/.', '');
} else
return '';
return $sce.trustAsHtml(version); return $sce.trustAsHtml(version);
}; };
}) })

File diff suppressed because one or more lines are too long

@ -5,9 +5,22 @@
$(this).tooltip('hide'); $(this).tooltip('hide');
}); });
moment.relativeTimeTreshold('s', 60); $.fn.sparkline.defaults.bar.height = 50;
moment.relativeTimeTreshold('m', 60); $.fn.sparkline.defaults.bar.barWidth = 6;
moment.relativeTimeTreshold('h', 24); $.fn.sparkline.defaults.bar.barSpacing = 2;
moment.relativeTimeTreshold('d', 28); $.fn.sparkline.defaults.bar.tooltipClassname = 'jqstooltip';
moment.relativeTimeTreshold('M', 12); $.fn.sparkline.defaults.bar.tooltipOffsetX = 0;
$.fn.sparkline.defaults.bar.tooltipFormat = $.spformat('<div class="tooltip-arrow" style="left: 50%;"></div><div class="tooltip-inner"><span style="color: {{color}}">&#9679;</span><br>{{prefix}}{{value}}{{suffix}}</div>');
$.fn.sparkline.defaults.bar.colorMap = $.range_map({
'1:12': '#7bcc3a',
'12:19': '#10a0de',
'20:29': '#FFD162',
'30:': '#F74B4B'
});
moment.relativeTimeThreshold('s', 60);
moment.relativeTimeThreshold('m', 60);
moment.relativeTimeThreshold('h', 24);
moment.relativeTimeThreshold('d', 28);
moment.relativeTimeThreshold('M', 12);
})(); })();

@ -63,14 +63,10 @@ block content
div.col-xs.12 div.col-xs.12
div.col-lg-8(style="padding-top: 30px;") div.col-lg-8(style="padding-top: 30px;")
//- div.col-xs-3.stat-holder div.col-xs-3.stat-holder
//- div.row.big-info.nodesactive(class="{{ nodesActive | nodesActiveClass : nodesTotal }}") div.row.big-info.chart.nodesactive(class="{{ nodesActive | nodesActiveClass : nodesTotal }}")
//- div.pull-left.icon-full-width span.small-title block time
//- i.icon-node span.big-details.spark-blocktimes {{ lastBlocksTime.join(',') }}
//- div.pull-left
//- span.small-title active nodes
//- span.big-details {{nodesActive}}/{{nodesTotal}}
//- div.clearfix
div.clearfix div.clearfix

@ -21,6 +21,7 @@ html(ng-app="netStatsApp")
script(src="/js/lib/datamaps.min.js") script(src="/js/lib/datamaps.min.js")
script(src="/js/lib/moment.min.js") script(src="/js/lib/moment.min.js")
script(src="/js/lib/toastr.min.js") script(src="/js/lib/toastr.min.js")
script(src="/js/lib/jquery.sparkline.min.js")
script(src="/js/lib/locale/en-gb.js") script(src="/js/lib/locale/en-gb.js")
script(src="/js/lib/angular-moment.min.js") script(src="/js/lib/angular-moment.min.js")
script(src="/js/lib/bootstrap.min.js") script(src="/js/lib/bootstrap.min.js")

Loading…
Cancel
Save