Minor cleanup of main.js (#4634)
* Applied automatic formatting * Balance else clauses
George Moschovitis committed
Nov 13, 2018 at 21:23 UTC
0f8b440c39d61a64e6c700199f7e22153f22b416
1 file changed
+84
-128
web/gui/main.js
+84
-128
@@ -119,8 +119,7 @@ var urlOptions = {
119
if (urlOptions.hasProperty(p[0]) && typeof p[1] !== 'undefined') {
120
urlOptions[p[0]] = decodeURIComponent(p[1]);
121
}
122
- }
123
- else {
122
+ } else {
123
if (variables[len].length > 0) {
124
urlOptions.hash = variables[len];
125
}
@@ -155,23 +154,20 @@ var urlOptions = {
154
netdataServerStatic = document.location.origin.toString() + document.location.pathname.toString();
155
netdataServer = urlOptions.server;
156
netdataCheckXSS = true;
158
- }
159
- else {
157
+ } else {
158
urlOptions.server = null;
159
}
160
161
if (urlOptions.before > 0 && urlOptions.after > 0) {
162
urlOptions.pan_and_zoom = true;
163
urlOptions.nowelcome = true;
166
- }
167
- else {
164
+ } else {
165
urlOptions.pan_and_zoom = false;
166
}
167
168
if (urlOptions.highlight_before > 0 && urlOptions.highlight_after > 0) {
169
urlOptions.highlight = true;
173
- }
174
- else {
170
+ } else {
171
urlOptions.highlight = false;
172
}
173
@@ -259,11 +255,10 @@ var urlOptions = {
255
256
$('.highlight-tooltip').tooltip({
257
html: true,
262
- delay: { show: 500, hide: 0 },
258
+ delay: {show: 500, hide: 0},
259
container: 'body'
260
});
265
- }
266
- else {
261
+ } else {
262
$('.navbar-highlight').hide();
263
}
264
},
@@ -304,8 +299,7 @@ function localStorageTest() {
299
console.log(e);
300
localStorageTested = false;
301
}
307
- }
308
- else {
302
+ } else {
303
localStorageTested = false;
304
}
305
@@ -381,16 +375,14 @@ var netdataShowHelp = true;
375
if (urlOptions.theme !== null) {
376
setTheme(urlOptions.theme);
377
netdataTheme = urlOptions.theme;
384
-}
385
-else {
378
+} else {
379
urlOptions.theme = netdataTheme;
380
}
381
382
if (urlOptions.help !== null) {
383
saveLocalStorage('options.show_help', urlOptions.help);
384
netdataShowHelp = urlOptions.help;
392
-}
393
-else {
385
+} else {
386
urlOptions.help = loadLocalStorage('options.show_help');
387
}
388
@@ -640,7 +632,7 @@ function renderMachines(machinesArray) {
632
<div></div>
633
</div>
634
`
643
- );
635
+ );
636
}
637
}
638
@@ -768,14 +760,12 @@ function gotoServerValidateUrl(id, guid, url) {
760
window.open(verifyURL(finalURL), '_blank');
761
gotoServerMiddleClick = false;
762
document.getElementById('gotoServerResponse').innerHTML = '<b>Opening new window to ' + NETDATA.registry.machines[guid].name + '<br/><a href="' + verifyURL(finalURL) + '">' + escapeUserInputHTML(url) + '</a></b><br/>(check your pop-up blocker if it fails)';
771
- }
772
- else {
763
+ } else {
764
document.getElementById('gotoServerResponse').innerHTML += 'found it! It is at:<br/><small>' + escapeUserInputHTML(url) + '</small>';
765
document.location = verifyURL(finalURL);
766
}
767
}
777
- }
778
- else {
768
+ } else {
769
if (typeof data !== 'undefined' && data !== null && typeof data.machine_guid === 'string' && data.machine_guid !== guid) {
770
error = 'wrong machine';
771
}
@@ -837,8 +827,7 @@ function gotoServerInit() {
827
if (e.which === 2) {
828
e.preventDefault();
829
gotoServerMiddleClick = true;
840
- }
841
- else {
830
+ } else {
831
gotoServerMiddleClick = false;
832
}
833
@@ -861,13 +850,11 @@ function notifyForSwitchRegistry() {
850
if (result !== null) {
851
$('#switchRegistryModal').modal('hide');
852
NETDATA.registry.init();
864
- }
865
- else {
853
+ } else {
854
document.getElementById('switchRegistryResponse').innerHTML = "<b>Sorry! The registry rejected your request.</b>";
855
}
856
});
869
- }
870
- else {
857
+ } else {
858
document.getElementById('switchRegistryResponse').innerHTML = "<b>The ID you have entered is not a GUID.</b>";
859
}
860
}
@@ -892,8 +879,7 @@ function notifyForDeleteRegistry() {
879
deleteRegistryUrl = null;
880
$('#deleteRegistryModal').modal('hide');
881
NETDATA.registry.init();
895
- }
896
- else {
882
+ } else {
883
document.getElementById('deleteRegistryResponse').innerHTML = "<b>Sorry! this command was rejected by the registry server.</b>";
884
}
885
});
@@ -924,8 +910,7 @@ function chartsPerRow(total) {
910
//var width = Math.floor(total / options.chartsMinWidth);
911
//if(width === 0) width = 1;
912
//return width;
927
- }
928
- else {
913
+ } else {
914
return options.chartsPerRow;
915
}
916
}
@@ -976,7 +961,7 @@ function scrollToId(hash) {
961
var offset = $('#' + hash).offset();
962
if (typeof offset !== 'undefined') {
963
//console.log('scrolling to ' + hash + ' at ' + offset.top.toString());
979
- $('html, body').animate({ scrollTop: offset.top - 30 }, 0);
964
+ $('html, body').animate({scrollTop: offset.top - 30}, 0);
965
}
966
}
967
@@ -1028,7 +1013,7 @@ var netdataDashboard = {
1013
}
1014
1015
if (typeof this.sparklines_registry[key] === 'undefined') {
1031
- this.sparklines_registry[key] = { count: 1 };
1016
+ this.sparklines_registry[key] = {count: 1};
1017
} else {
1018
this.sparklines_registry[key].count++;
1019
}
@@ -1628,7 +1613,7 @@ function renderPage(menus, data) {
1613
1614
sidebar += '<li class="" style="padding-top:15px;"><a href="https://github.com/netdata/netdata/wiki/Add-more-charts-to-netdata" target="_blank"><i class="fas fa-plus"></i> add more charts</a></li>';
1615
sidebar += '<li class=""><a href="https://github.com/netdata/netdata/wiki/Add-more-alarms-to-netdata" target="_blank"><i class="fas fa-plus"></i> add more alarms</a></li>';
1631
- 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 ' + NETDATA.seconds4human(data.update_every * data.history, { space: ' ' }) + ' of real-time history.<br/> <br/><b>netdata</b><br/>v' + data.version.toString() + '</small></li>';
1616
+ 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 ' + NETDATA.seconds4human(data.update_every * data.history, {space: ' '}) + ' of real-time history.<br/> <br/><b>netdata</b><br/>v' + data.version.toString() + '</small></li>';
1617
sidebar += '</ul>';
1618
div.innerHTML = html;
1619
document.getElementById('sidebar').innerHTML = sidebar;
@@ -1679,8 +1664,7 @@ function renderChartsAndMenu(data) {
1664
info: netdataDashboard.menuInfo(chart),
1665
height: netdataDashboard.menuHeight(chart) * options.chartsHeight
1666
};
1682
- }
1683
- else {
1667
+ } else {
1668
if (typeof (menus[m].menu_pattern) === 'undefined') {
1669
menus[m].menu_pattern = chart.menu_pattern;
1670
}
@@ -1701,8 +1685,7 @@ function renderChartsAndMenu(data) {
1685
info: netdataDashboard.submenuInfo(menu_key, chart.submenu),
1686
height: netdataDashboard.submenuHeight(menu_key, chart.submenu, menus[m].height)
1687
};
1704
- }
1705
- else {
1688
+ } else {
1689
if (chart.priority < menus[m].submenus[chart.submenu].priority) {
1690
menus[m].submenus[chart.submenu].priority = chart.priority;
1691
}
@@ -1727,8 +1710,7 @@ function renderChartsAndMenu(data) {
1710
// set the family using a name
1711
if (typeof options.submenu_names[s] !== 'undefined') {
1712
menus[m].submenus[s].title = s + ' (' + options.submenu_names[s] + ')';
1730
- }
1731
- else {
1713
+ } else {
1714
menu_key = (typeof (menus[m].menu_pattern) !== 'undefined') ? menus[m].menu_pattern : m;
1715
menus[m].submenus[s].title = netdataDashboard.submenuTitle(menu_key, s);
1716
}
@@ -1745,7 +1727,7 @@ function loadJs(url, callback) {
1727
url: url,
1728
cache: true,
1729
dataType: "script",
1748
- xhrFields: { withCredentials: true } // required for the cookie
1730
+ xhrFields: {withCredentials: true} // required for the cookie
1731
})
1732
.fail(function () {
1733
alert('Cannot load required JS library: ' + url);
@@ -1763,8 +1745,7 @@ function loadClipboard(callback) {
1745
if (clipboardLoaded === false) {
1746
clipboardLoaded = true;
1747
loadJs('lib/clipboard-polyfill-be05dad.js', callback);
1766
- }
1767
- else {
1748
+ } else {
1749
callback();
1750
}
1751
}
@@ -1779,8 +1760,7 @@ function loadBootstrapTable(callback) {
1760
loadJs('lib/tableExport-1.6.0.min.js', callback);
1761
})
1762
});
1782
- }
1783
- else {
1763
+ } else {
1764
callback();
1765
}
1766
}
@@ -1794,8 +1774,7 @@ function loadBootstrapSlider(callback) {
1774
NETDATA._loadCSS('css/bootstrap-slider-10.0.0.min.css');
1775
callback();
1776
});
1797
- }
1798
- else {
1777
+ } else {
1778
callback();
1779
}
1780
}
@@ -1806,8 +1785,7 @@ function loadLzString(callback) {
1785
if (lzStringLoaded === false) {
1786
lzStringLoaded = true;
1787
loadJs('lib/lz-string-1.4.4.min.js', callback);
1809
- }
1810
- else {
1788
+ } else {
1789
callback();
1790
}
1791
}
@@ -1818,8 +1796,7 @@ function loadPako(callback) {
1796
if (pakoLoaded === false) {
1797
pakoLoaded = true;
1798
loadJs('lib/pako-1.0.6.min.js', callback);
1821
- }
1822
- else {
1799
+ } else {
1800
callback();
1801
}
1802
}
@@ -1852,8 +1829,8 @@ function alarmsUpdateModal() {
1829
if (data === null) {
1830
document.getElementById('alarms_active').innerHTML =
1831
document.getElementById('alarms_all').innerHTML =
1855
- document.getElementById('alarms_log').innerHTML =
1856
- 'failed to load alarm data!';
1832
+ document.getElementById('alarms_log').innerHTML =
1833
+ 'failed to load alarm data!';
1834
return;
1835
}
1836
@@ -1903,7 +1880,7 @@ function alarmsUpdateModal() {
1880
1881
return '<code>' + alarm.lookup_method + '</code> '
1882
+ dimensions + ', of chart <code>' + alarm.chart + '</code>'
1906
- + ', starting <code>' + NETDATA.seconds4human(alarm.lookup_after + alarm.lookup_before, { space: ' ' }) + '</code> and up to <code>' + NETDATA.seconds4human(alarm.lookup_before, { space: ' ' }) + '</code>'
1883
+ + ', starting <code>' + NETDATA.seconds4human(alarm.lookup_after + alarm.lookup_before, {space: ' '}) + '</code> and up to <code>' + NETDATA.seconds4human(alarm.lookup_before, {space: ' '}) + '</code>'
1884
+ ((alarm.lookup_options) ? (', with options <code>' + alarm.lookup_options.replace(/ /g, ', ') + '</code>') : '')
1885
+ '.';
1886
}
@@ -1953,8 +1930,7 @@ function alarmsUpdateModal() {
1930
space: ' ',
1931
negative_suffix: ''
1932
});
1956
- }
1957
- else {
1933
+ } else {
1934
delay = '<small><br/>hysteresis ';
1935
if (alarm.delay_up_duration > 0) {
1936
delay += 'on escalation <code>' + NETDATA.seconds4human(alarm.delay_up_duration, {
@@ -1980,9 +1956,9 @@ function alarmsUpdateModal() {
1956
}
1957
1958
html += '<tr><td width="10%" style="text-align:right">check every</td><td>' + NETDATA.seconds4human(alarm.update_every, {
1983
- space: ' ',
1984
- negative_suffix: ''
1985
- }) + '</td></tr>'
1959
+ space: ' ',
1960
+ negative_suffix: ''
1961
+ }) + '</td></tr>'
1962
+ ((has_alarm === true) ? ('<tr><td width="10%" style="text-align:right">execute</td><td><span style="font-family: monospace;">' + alarm.exec + '</span>' + delay + '</td></tr>') : '')
1963
+ '<tr><td width="10%" style="text-align:right">source</td><td><span style="font-family: monospace;">' + alarm.source + '</span></td></tr>'
1964
+ '</table></td></tr>';
@@ -2027,7 +2003,7 @@ function alarmsUpdateModal() {
2003
// not found - this should never happen!
2004
if (typeof chart === 'undefined') {
2005
console.log('WARNING: alarm ' + x + ' is linked to chart ' + alarm.chart + ', which is not found in the list of chart got from the server.');
2030
- chart = { priority: 9999999 };
2006
+ chart = {priority: 9999999};
2007
}
2008
else if (typeof chart.menu !== 'undefined' && typeof chart.submenu !== 'undefined')
2009
// the family based on the chart
@@ -2164,16 +2140,16 @@ function alarmsUpdateModal() {
2140
2141
switch (row.status) {
2142
case 'CRITICAL':
2167
- return { classes: 'danger' };
2143
+ return {classes: 'danger'};
2144
break;
2145
case 'WARNING':
2170
- return { classes: 'warning' };
2146
+ return {classes: 'warning'};
2147
break;
2148
case 'UNDEFINED':
2173
- return { classes: 'info' };
2149
+ return {classes: 'info'};
2150
break;
2151
case 'CLEAR':
2176
- return { classes: 'success' };
2152
+ return {classes: 'success'};
2153
break;
2154
}
2155
return {};
@@ -2361,7 +2337,7 @@ function alarmsUpdateModal() {
2337
formatter: function (value, row, index) {
2338
void (row);
2339
void (index);
2364
- return NETDATA.seconds4human(value, { negative_suffix: '', space: ' ', now: 'no time' });
2340
+ return NETDATA.seconds4human(value, {negative_suffix: '', space: ' ', now: 'no time'});
2341
},
2342
align: 'center',
2343
valign: 'middle',
@@ -2375,7 +2351,7 @@ function alarmsUpdateModal() {
2351
formatter: function (value, row, index) {
2352
void (row);
2353
void (index);
2378
- return NETDATA.seconds4human(value, { negative_suffix: '', space: ' ', now: 'no time' });
2354
+ return NETDATA.seconds4human(value, {negative_suffix: '', space: ' ', now: 'no time'});
2355
},
2356
align: 'center',
2357
valign: 'middle',
@@ -2507,7 +2483,7 @@ function alarmsUpdateModal() {
2483
void (row);
2484
void (index);
2485
2510
- return NETDATA.seconds4human(value, { negative_suffix: '', space: ' ', now: 'no time' });
2486
+ return NETDATA.seconds4human(value, {negative_suffix: '', space: ' ', now: 'no time'});
2487
},
2488
align: 'center',
2489
valign: 'middle',
@@ -2646,8 +2622,7 @@ function initializeChartsAndCustomInfo() {
2622
loadCustomDashboardInfo(NETDATA.serverDefault + data.custom_info, function () {
2623
initializeDynamicDashboardWithData(data);
2624
});
2649
- }
2650
- else {
2625
+ } else {
2626
//console.log('not loading custom dashboard decorations from server ' + initializeConfig.url);
2627
initializeDynamicDashboardWithData(data);
2628
}
@@ -2690,8 +2665,7 @@ function initializeDynamicDashboard(netdata_url) {
2665
//$("#loadOverlay").css("display","none");
2666
document.getElementById('netdataXssModalServer').innerText = initializeConfig.url;
2667
$('#xssModal').modal('show');
2693
- }
2694
- else {
2668
+ } else {
2669
initializeChartsAndCustomInfo();
2670
}
2671
});
@@ -2727,7 +2701,7 @@ function getNetdataCommitId(force, callback) {
2701
url: 'version.txt',
2702
async: true,
2703
cache: false,
2730
- xhrFields: { withCredentials: true } // required for the cookie
2704
+ xhrFields: {withCredentials: true} // required for the cookie
2705
})
2706
.done(function (data) {
2707
data = data.replace(/(\r\n|\n|\r| |\t)/gm, "");
@@ -2753,8 +2727,7 @@ function getNetdataCommitId(force, callback) {
2727
versionLog('Cannot find the git commit id of netdata.');
2728
}
2729
callback(c);
2756
- }
2757
- else {
2730
+ } else {
2731
callback(null);
2732
}
2733
});
@@ -2818,16 +2791,13 @@ function notifyForUpdate(force) {
2791
if (sha1 === null) {
2792
save = false;
2793
versionLog('<p><big>Failed to get your netdata git commit id!</big></p><p>You can always get the latest netdata from <a href="https://github.com/netdata/netdata" target="_blank">its github page</a>.</p>');
2821
- }
2822
- else if (sha2 === null) {
2794
+ } else if (sha2 === null) {
2795
save = false;
2796
versionLog('<p><big>Failed to get the latest git commit id from github.</big></p><p>You can always get the latest netdata from <a href="https://github.com/netdata/netdata" target="_blank">its github page</a>.</p>');
2825
- }
2826
- else if (sha1 === sha2) {
2797
+ } else if (sha1 === sha2) {
2798
save = true;
2799
versionLog('<p><big>You already have the latest netdata!</big></p><p>No update yet?<br/>Probably, we need some motivation to keep going on!</p><p>If you haven\'t already, <a href="https://github.com/netdata/netdata" target="_blank">give netdata a <b><i class="fas fa-star"></i></b> at its github page</a>.</p>');
2829
- }
2830
- else {
2800
+ } else {
2801
save = true;
2802
var compare = 'https://github.com/netdata/netdata/compare/' + sha1.toString() + '...' + sha2.toString();
2803
@@ -2914,8 +2884,7 @@ function printPage() {
2884
2885
if (idx > 0) {
2886
update_chart(idx);
2917
- }
2918
- else {
2887
+ } else {
2888
print_is_rendering = false;
2889
$('#printModal').modal('hide');
2890
window.print();
@@ -2978,7 +2947,7 @@ var snapshotOptions = {
2947
bytes_per_point_disk: 1.9,
2948
2949
compress: function (s) {
2981
- return btoa(pako.deflate(s, { to: 'string' }));
2950
+ return btoa(pako.deflate(s, {to: 'string'}));
2951
},
2952
2953
compressed_length: function (s) {
@@ -2986,7 +2955,7 @@ var snapshotOptions = {
2955
},
2956
2957
uncompress: function (s) {
2989
- return pako.inflate(atob(s), { to: 'string' });
2958
+ return pako.inflate(atob(s), {to: 'string'});
2959
}
2960
},
2961
@@ -2995,7 +2964,7 @@ var snapshotOptions = {
2964
bytes_per_point_disk: 3.2,
2965
2966
compress: function (s) {
2998
- return pako.deflate(s, { to: 'string' });
2967
+ return pako.deflate(s, {to: 'string'});
2968
},
2969
2970
compressed_length: function (s) {
@@ -3003,7 +2972,7 @@ var snapshotOptions = {
2972
},
2973
2974
uncompress: function (s) {
3006
- return pako.inflate(s, { to: 'string' });
2975
+ return pako.inflate(s, {to: 'string'});
2976
}
2977
},
2978
@@ -3139,8 +3108,7 @@ function loadSnapshot() {
3108
urlOptions.highlight_after = tmpSnapshotData.highlight_after_ms;
3109
urlOptions.highlight_before = tmpSnapshotData.highlight_before_ms;
3110
urlOptions.highlight = true;
3142
- }
3143
- else {
3111
+ } else {
3112
urlOptions.highlight_after = 0;
3113
urlOptions.highlight_before = 0;
3114
urlOptions.highlight = false;
@@ -3233,8 +3201,7 @@ function loadSnapshotDragAndDropSetup() {
3201
.on('drop', function (e) {
3202
if (e.originalEvent.dataTransfer.files.length) {
3203
loadSnapshotPreflightFile(e.originalEvent.dataTransfer.files.item(0));
3236
- }
3237
- else {
3204
+ } else {
3205
loadSnapshotPreflightEmpty();
3206
loadSnapshotModalLog('danger', 'No file selected');
3207
}
@@ -3495,8 +3462,7 @@ function saveSnapshot() {
3462
var cstr = compress(str);
3463
saveData.data[state.chartDataUniqueID()] = cstr;
3464
return compressed_length(cstr);
3498
- }
3499
- else {
3465
+ } else {
3466
return 0;
3467
}
3468
}
@@ -3580,8 +3546,7 @@ function saveSnapshot() {
3546
charts_ok++;
3547
// state.log('ok');
3548
size += pack_api1_v1_chart_data(state);
3583
- }
3584
- else {
3549
+ } else {
3550
charts_failed++;
3551
state.log('failed to be updated: ' + reason);
3552
}
@@ -3590,8 +3555,7 @@ function saveSnapshot() {
3555
3556
if (idx > 0) {
3557
update_chart(idx);
3593
- }
3594
- else {
3558
+ } else {
3559
saveData.charts_ok = charts_ok;
3560
saveData.charts_failed = charts_failed;
3561
saveData.data_size = size;
@@ -3648,8 +3612,7 @@ function dashboardSettingsSetup() {
3612
if (self.prop('checked') === true) {
3613
$('#settingsLocaleTempRow').show();
3614
$('#settingsLocaleTimeRow').show();
3651
- }
3652
- else {
3615
+ } else {
3616
$('#settingsLocaleTempRow').hide();
3617
$('#settingsLocaleTimeRow').hide();
3618
}
@@ -3692,8 +3655,7 @@ function dashboardSettingsSetup() {
3655
3656
if (NETDATA.getOption('parallel_refresher') === false) {
3657
$('#concurrent_refreshes_row').hide();
3695
- }
3696
- else {
3658
+ } else {
3659
$('#concurrent_refreshes_row').show();
3660
}
3661
};
@@ -3775,8 +3737,7 @@ function scrollDashboardTo() {
3737
if (netdataSnapshotData !== null && typeof netdataSnapshotData.hash !== 'undefined') {
3738
//console.log(netdataSnapshotData.hash);
3739
scrollToId(netdataSnapshotData.hash.replace('#', ''));
3778
- }
3779
- else {
3740
+ } else {
3741
// check if we have to jump to a specific section
3742
scrollToId(urlOptions.hash.replace('#', ''));
3743
@@ -3804,7 +3765,7 @@ function enableTooltipsAndPopovers() {
3765
animated: 'fade',
3766
trigger: 'hover',
3767
html: true,
3807
- delay: { show: 500, hide: 0 },
3768
+ delay: {show: 500, hide: 0},
3769
container: 'body'
3770
});
3771
$('[data-toggle="popover"]').popover();
@@ -3857,8 +3818,7 @@ function runOnceOnDashboardWithjQuery() {
3818
NETDATA.pause(function () {
3819
});
3820
netdata_paused_on_modal = true;
3860
- }
3861
- else {
3821
+ } else {
3822
netdata_paused_on_modal = false;
3823
}
3824
}
@@ -3883,7 +3843,7 @@ function runOnceOnDashboardWithjQuery() {
3843
3844
// scroll to the position we had open before the modal
3845
$('html, body')
3886
- .animate({ scrollTop: scrollPos }, 0);
3846
+ .animate({scrollTop: scrollPos}, 0);
3847
3848
// unpause netdata, if we paused it
3849
if (netdata_paused_on_modal === true) {
@@ -4040,8 +4000,8 @@ function runOnceOnDashboardWithjQuery() {
4000
.on('hidden.bs.modal', function () {
4001
document.getElementById('alarms_active').innerHTML =
4002
document.getElementById('alarms_all').innerHTML =
4043
- document.getElementById('alarms_log').innerHTML =
4044
- 'loading...';
4003
+ document.getElementById('alarms_log').innerHTML =
4004
+ 'loading...';
4005
});
4006
4007
// ------------------------------------------------------------------------
@@ -4091,16 +4051,15 @@ function runOnceOnDashboardWithjQuery() {
4051
if ($this.hasClass('less')) {
4052
$this.removeClass('less');
4053
$this.html(config.moreText);
4094
- $this.parent().prev().animate({ 'height': '0' + '%' }, 0, function () {
4054
+ $this.parent().prev().animate({'height': '0' + '%'}, 0, function () {
4055
$this.parent().prev().prev().show();
4056
}).hide(0, function () {
4057
config.onLess();
4058
});
4099
-
4059
} else {
4060
$this.addClass('less');
4061
$this.html(config.lessText);
4103
- $this.parent().prev().animate({ 'height': '100' + '%' }, 0, function () {
4062
+ $this.parent().prev().animate({'height': '100' + '%'}, 0, function () {
4063
$this.parent().prev().prev().hide();
4064
}).show(0, function () {
4065
config.onMore();
@@ -4148,22 +4107,24 @@ function runOnceOnDashboardWithjQuery() {
4107
}
4108
}
4109
}
4110
+
4111
if (inTag && content[i] === '>') {
4112
inTag = false;
4113
}
4114
4115
if (inTag) {
4116
bag += content.charAt(i);
4157
- } // Add tag name chars to the result
4158
- else {
4117
+ } else {
4118
+ // Add tag name chars to the result
4119
r++;
4120
if (countChars <= config.showChars) {
4121
bag += content.charAt(i); // Fix to ie 7 not allowing you to reference string characters using the []
4122
countChars++;
4163
- } else // Now I have the characters needed
4164
- {
4165
- if (openTags.length > 0) // I have unclosed tags
4166
- {
4123
+ } else {
4124
+ // Now I have the characters needed
4125
+ if (openTags.length > 0) {
4126
+ // I have unclosed tags
4127
+
4128
//console.log('They were open tags');
4129
//console.log(openTags);
4130
for (var j = 0; j < openTags.length; j++) {
@@ -4251,8 +4212,7 @@ function finalizePage() {
4212
ga('create', 'UA-64295674-3', 'auto');
4213
ga('send', 'pageview');
4214
}, 2000);
4254
- }
4255
- else {
4215
+ } else {
4216
notifyForUpdate();
4217
}
4218
@@ -4316,8 +4276,7 @@ var netdataPrepCallback = function () {
4276
4277
if (isdemo()) {
4278
document.getElementById('masthead').style.display = 'block';
4319
- }
4320
- else {
4279
+ } else {
4280
if (urlOptions.update_always === true) {
4281
NETDATA.setOption('stop_updates_when_focus_is_lost', !urlOptions.update_always);
4282
}
@@ -4344,19 +4303,16 @@ var selected_server_timezone = function (timezone, status) {
4303
4304
document.getElementById('timezone_error_message').innerHTML = 'Ooops! That timezone was not accepted by your browser. Please open a github issue to help us fix it.';
4305
NETDATA.setOption('user_set_server_timezone', NETDATA.options.server_timezone);
4347
- }
4348
- else {
4306
+ } else {
4307
if ($('#local_timezone').prop('checked')) {
4308
$('#local_timezone').bootstrapToggle('off');
4309
}
4310
}
4353
- }
4354
- else if (status === true) {
4311
+ } else if (status === true) {
4312
// the user wants the browser default timezone to be activated
4313
4314
NETDATA.dateTime.init();
4358
- }
4359
- else {
4315
+ } else {
4316
// the user wants the server default timezone to be activated
4317
//console.log('found ' + NETDATA.options.current.user_set_server_timezone);
4318