added block time bar chart
This commit is contained in:
parent
a01706c971
commit
92ae0e9144
2
app.js
2
app.js
@ -103,7 +103,7 @@ client.on('connection', function(spark) {
|
||||
// view engine setup
|
||||
app.set('views', path.join(__dirname, 'views'));
|
||||
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.urlencoded({ extended: false }));
|
||||
app.use(express.static(path.join(__dirname, 'public')));
|
||||
|
@ -34,6 +34,10 @@ body {
|
||||
color: #aaa !important;
|
||||
}
|
||||
|
||||
.big-info.chart {
|
||||
padding-left: 15px;
|
||||
}
|
||||
|
||||
.big-info span.big-details {
|
||||
display: block;
|
||||
font-weight: 200;
|
||||
@ -42,6 +46,32 @@ body {
|
||||
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 {
|
||||
-webkit-font-smoothing: subpixel-antialiased;
|
||||
-moz-font-smoothing: subpixel-antialiased;
|
||||
|
BIN
public/images/favicon.png
Normal file
BIN
public/images/favicon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 574 B |
@ -15,6 +15,8 @@ function StatsCtrl($scope, $filter, socket, _, toastr) {
|
||||
$scope.upTimeTotal = 0;
|
||||
$scope.avgBlockTime = 0;
|
||||
|
||||
$scope.lastBlocksTime = [];
|
||||
|
||||
$scope.nodes = [];
|
||||
$scope.map = [];
|
||||
|
||||
@ -135,6 +137,12 @@ function StatsCtrl($scope, $filter, socket, _, toastr) {
|
||||
return total + node.stats.uptime;
|
||||
}, 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) {
|
||||
if(node.geo != null)
|
||||
return {
|
||||
@ -151,7 +159,7 @@ function StatsCtrl($scope, $filter, socket, _, toastr) {
|
||||
};
|
||||
});
|
||||
|
||||
console.log($scope.map);
|
||||
// console.log($scope.map);
|
||||
}
|
||||
|
||||
$scope.$apply();
|
||||
|
@ -41,12 +41,16 @@ angular.module('netStatsApp.filters', [])
|
||||
})
|
||||
.filter('nodeVersion', function($sce) {
|
||||
return function(version) {
|
||||
version = version.replace('eth version ', 'v')
|
||||
.replace("\n" + 'Network protocol version: ', ' (')
|
||||
.replace("\n" + 'Client database version: ', ',')
|
||||
.replace("\n" + 'Build: ', ') - ')
|
||||
.replace('/Debug', '')
|
||||
.replace('/.', '');
|
||||
if(typeof version !== 'undefined') {
|
||||
version = version.replace('eth version ', 'v')
|
||||
.replace("\n" + 'Network protocol version: ', ' (')
|
||||
.replace("\n" + 'Client database version: ', ',')
|
||||
.replace("\n" + 'Build: ', ') - ')
|
||||
.replace('/Debug', '')
|
||||
.replace('/.', '');
|
||||
} else
|
||||
return '';
|
||||
|
||||
return $sce.trustAsHtml(version);
|
||||
};
|
||||
})
|
||||
|
4
public/js/lib/jquery.sparkline.min.js
vendored
4
public/js/lib/jquery.sparkline.min.js
vendored
File diff suppressed because one or more lines are too long
@ -5,9 +5,22 @@
|
||||
$(this).tooltip('hide');
|
||||
});
|
||||
|
||||
moment.relativeTimeTreshold('s', 60);
|
||||
moment.relativeTimeTreshold('m', 60);
|
||||
moment.relativeTimeTreshold('h', 24);
|
||||
moment.relativeTimeTreshold('d', 28);
|
||||
moment.relativeTimeTreshold('M', 12);
|
||||
$.fn.sparkline.defaults.bar.height = 50;
|
||||
$.fn.sparkline.defaults.bar.barWidth = 6;
|
||||
$.fn.sparkline.defaults.bar.barSpacing = 2;
|
||||
$.fn.sparkline.defaults.bar.tooltipClassname = 'jqstooltip';
|
||||
$.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}}">●</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-lg-8(style="padding-top: 30px;")
|
||||
//- div.col-xs-3.stat-holder
|
||||
//- div.row.big-info.nodesactive(class="{{ nodesActive | nodesActiveClass : nodesTotal }}")
|
||||
//- div.pull-left.icon-full-width
|
||||
//- i.icon-node
|
||||
//- div.pull-left
|
||||
//- span.small-title active nodes
|
||||
//- span.big-details {{nodesActive}}/{{nodesTotal}}
|
||||
//- div.clearfix
|
||||
div.col-xs-3.stat-holder
|
||||
div.row.big-info.chart.nodesactive(class="{{ nodesActive | nodesActiveClass : nodesTotal }}")
|
||||
span.small-title block time
|
||||
span.big-details.spark-blocktimes {{ lastBlocksTime.join(',') }}
|
||||
|
||||
div.clearfix
|
||||
|
||||
|
@ -21,6 +21,7 @@ html(ng-app="netStatsApp")
|
||||
script(src="/js/lib/datamaps.min.js")
|
||||
script(src="/js/lib/moment.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/angular-moment.min.js")
|
||||
script(src="/js/lib/bootstrap.min.js")
|
||||
|
Loading…
Reference in New Issue
Block a user