fix menu offset to properly select the menu on click; minor fixes to index.html
Costa Tsaousis (ktsaou) committed
May 7, 2017 at 01:47 UTC
ae6ea537a126595846d20127d25c8a32d9cf42af
1 file changed
+20
-18
web/index.html
+20
-18
@@ -625,7 +625,7 @@
625
len = sorted.length;
626
while(len--) {
627
hostname = sorted[i].hostname;
628
- if(hostname == master) {
628
+ if(hostname === master) {
629
url = base + "/";
630
icon = "home";
631
}
@@ -936,6 +936,8 @@
936
};
937
938
function chartsPerRow(total) {
939
+ void(total);
940
+
941
if(options.chartsPerRow === 0) {
942
return 1;
943
//var width = Math.floor(total / options.chartsMinWidth);
@@ -980,10 +982,10 @@
982
// scroll to a section, without changing the browser history
983
984
function scrollToId(hash) {
983
- if(hash && hash != '' && document.getElementById(hash) !== null) {
985
+ if(hash && hash !== '' && document.getElementById(hash) !== null) {
986
var offset = $('#' + hash).offset();
987
if(typeof offset !== 'undefined')
986
- $('html, body').animate({ scrollTop: offset.top - 50 }, 0);
988
+ $('html, body').animate({ scrollTop: offset.top - 30 }, 0);
989
}
990
991
// we must return false to prevent the default action
@@ -1490,7 +1492,7 @@
1492
1493
sidebar += '<li class="" style="padding-top:15px;"><a href="https://github.com/firehol/netdata/wiki/Add-more-charts-to-netdata" target="_blank"><i class="fa fa-plus" aria-hidden="true"></i> add more charts</a></li>';
1494
sidebar += '<li class=""><a href="https://github.com/firehol/netdata/wiki/Add-more-alarms-to-netdata" target="_blank"><i class="fa fa-plus" aria-hidden="true"></i> add more alarms</a></li>';
1493
- sidebar += '<li class="" style="margin:20px;color:#666;"><small>netdata on <b>' + data.hostname.toString() + '</b>, collects every ' + ((data.update_every == 1)?'second':data.update_every.toString() + ' seconds') + ' <b>' + data.dimensions_count.toLocaleString() + '</b> metrics, presented as <b>' + data.charts_count.toLocaleString() + '</b> charts and monitored by <b>' + data.alarms_count.toLocaleString() + '</b> alarms, using ' + Math.round(data.rrd_memory_bytes / 1024 / 1024).toLocaleString() + ' MB of memory for ' + seconds4human(data.update_every * data.history) + ' of real-time history.<br/> <br/><b>netdata</b><br/>v' + data.version.toString() +'</small></li>';
1495
+ sidebar += '<li class="" style="margin:20px;color:#666;"><small>netdata on <b>' + data.hostname.toString() + '</b>, collects every ' + ((data.update_every === 1)?'second':data.update_every.toString() + ' seconds') + ' <b>' + data.dimensions_count.toLocaleString() + '</b> metrics, presented as <b>' + data.charts_count.toLocaleString() + '</b> charts and monitored by <b>' + data.alarms_count.toLocaleString() + '</b> alarms, using ' + Math.round(data.rrd_memory_bytes / 1024 / 1024).toLocaleString() + ' MB of memory for ' + seconds4human(data.update_every * data.history) + ' of real-time history.<br/> <br/><b>netdata</b><br/>v' + data.version.toString() +'</small></li>';
1496
sidebar += '</ul>';
1497
div.innerHTML = html;
1498
document.getElementById('sidebar').innerHTML = sidebar;
@@ -1638,7 +1640,7 @@
1640
var t = new Date(timestamp * 1000);
1641
var now = new Date();
1642
1641
- if(t.toDateString() == now.toDateString())
1643
+ if(t.toDateString() === now.toDateString())
1644
return t.toLocaleTimeString();
1645
1646
return t.toLocaleDateString() + space + t.toLocaleTimeString();
@@ -1695,8 +1697,8 @@
1697
}
1698
1699
var delay = '';
1698
- if((alarm.delay_up_duration > 0 || alarm.delay_down_duration > 0) && alarm.delay_multiplier != 0 && alarm.delay_max_duration > 0) {
1699
- if(alarm.delay_up_duration == alarm.delay_down_duration) {
1700
+ if((alarm.delay_up_duration > 0 || alarm.delay_down_duration > 0) && alarm.delay_multiplier !== 0 && alarm.delay_max_duration > 0) {
1701
+ if(alarm.delay_up_duration === alarm.delay_down_duration) {
1702
delay += '<small><br/>hysteresis ' + seconds4human(alarm.delay_up_duration, { negative_suffix: '' });
1703
}
1704
else {
@@ -1708,7 +1710,7 @@
1710
delay += 'on recovery <code>' + seconds4human(alarm.delay_down_duration, { negative_suffix: '' }) + '</code>, ';
1711
}
1712
}
1711
- if(alarm.delay_multiplier != 1.0) {
1713
+ if(alarm.delay_multiplier !== 1.0) {
1714
delay += 'multiplied by <code>' + alarm.delay_multiplier.toString() + '</code>';
1715
delay += ', up to <code>' + seconds4human(alarm.delay_max_duration, { negative_suffix: '' }) + '</code>';
1716
}
@@ -2272,7 +2274,7 @@
2274
if(hours > 1) txt += hours.toString() + options.space + options.hours;
2275
else if(hours === 1) txt += hours.toString() + options.space + options.hour;
2276
2275
- if(hours > 0 && minutes > 0 && seconds == 0)
2277
+ if(hours > 0 && minutes > 0 && seconds === 0)
2278
txt += options.space + options.and + options.space;
2279
else if(hours > 0 && minutes > 0 && seconds > 0)
2280
txt += ',' + options.space;
@@ -2312,7 +2314,7 @@
2314
options.version = data.version;
2315
netdataDashboard.os = data.os;
2316
2315
- if(typeof data.hosts != 'undefined')
2317
+ if(typeof data.hosts !=='undefined')
2318
options.hosts = data.hosts;
2319
2320
// update the dashboard hostname
@@ -2356,7 +2358,7 @@
2358
2359
// download all the charts the server knows
2360
NETDATA.chartRegistry.downloadAll(netdata_url, function(data) {
2359
- if(data != null) {
2361
+ if(data !== null) {
2362
if(typeof data.custom_info !== 'undefined' && data.custom_info !== "") {
2363
loadJs(data.custom_info, function () {
2364
$.extend(true, netdataDashboard, customDashboard);
@@ -2381,7 +2383,7 @@
2383
var s = options.version.split('-');
2384
2385
if(s.length !== 3) return null;
2384
- if(s[2][0] == 'g') {
2386
+ if(s[2][0] === 'g') {
2387
var v = s[2].split('_')[0].substring(1, 8);
2388
if(v.length === 7) {
2389
versionLog('Installed git commit id of netdata is ' + v);
@@ -2585,17 +2587,17 @@
2587
var tagName = null;
2588
2589
for (var i = 0, r = 0; r <= config.showChars; i++) {
2588
- if (content[i] == '<' && !inTag) {
2590
+ if (content[i] === '<' && !inTag) {
2591
inTag = true;
2592
2593
// This could be "tag" or "/tag"
2594
tagName = content.substring(i + 1, content.indexOf('>', i));
2595
2596
// If its a closing tag
2595
- if (tagName[0] == '/') {
2597
+ if (tagName[0] === '/') {
2598
2599
2598
- if (tagName != '/' + openTags[0]) {
2600
+ if (tagName !== ('/' + openTags[0])) {
2601
config.errMsg = 'ERROR en HTML: the top of the stack should be the tag that closes';
2602
} else {
2603
openTags.shift(); // Pops the last tag from the open tag stack (the tag is closed in the retult HTML!)
@@ -2603,12 +2605,12 @@
2605
2606
} else {
2607
// There are some nasty tags that don't have a close tag like <br/>
2606
- if (tagName.toLowerCase() != 'br') {
2608
+ if (tagName.toLowerCase() !== 'br') {
2609
openTags.unshift(tagName); // Add to start the name of the tag that opens
2610
}
2611
}
2612
}
2611
- if (inTag && content[i] == '>') {
2613
+ if (inTag && content[i] === '>') {
2614
inTag = false;
2615
}
2616
@@ -2696,7 +2698,7 @@
2698
$sidebar.on('activate.bs.scrollspy', function (e) {
2699
//console.log(e);
2700
var el = $(e.target);
2699
- //if(el.find('ul').size() == 0) {
2701
+ //if(el.find('ul').size() === 0) {
2702
var hash = el.find('a').attr('href');
2703
// console.log(hash);
2704
if(typeof hash === 'string' && hash.substring(0, 1) === '#' && urlOptions.hash.startsWith(hash + '_submenu_') === false) {