@cryptotaxi247 / netdata-1 / commits / 2f0e3e8f4

activate highlighted timeframe on page refresh

Costa Tsaousis (ktsaou) committed Nov 18, 2017 at 23:27 UTC 2f0e3e8f493e9f6135b4b08cfc62af4c673cfa08
1 file changed +14 -6
web/index.html
+14 -6
@@ -594,11 +594,19 @@
594 urlOptions[booleans[len]] = false;
595 }
596
597 - if(typeof urlOptions.after === 'string')
598 - urlOptions.after = parseInt(urlOptions.after);
599 -
600 - if(typeof urlOptions.before === 'string')
601 - urlOptions.before = parseInt(urlOptions.before);
597 + var numeric = [ 'after', 'before', 'highlight_after', 'highlight_before' ];
598 + len = numeric.length;
599 + while(len--) {
600 + if(typeof urlOptions[numeric[len]] === 'string') {
601 + try {
602 + urlOptions[numeric[len]] = parseInt(urlOptions[numeric[len]]);
603 + }
604 + catch(e) {
605 + console.log('failed to parse URL hash parameter ' + numeric[len]);
606 + urlOptions[numeric[len]] = 0;
607 + }
608 + }
609 + }
610
611 if(urlOptions.server !== null && urlOptions.server !== '')
612 netdataServer = urlOptions.server;
@@ -3684,7 +3692,7 @@
3692 NETDATA.globalPanAndZoom.callback = urlOptions.netdataPanAndZoomCallback;
3693 NETDATA.options.highlightCallback = urlOptions.netdataHighlightCallback;
3694
3687 - if(netdataSnapshotData !== null && urlOptions.highlight === true) {
3695 + if(urlOptions.highlight === true) {
3696 NETDATA.options.highlight_after = urlOptions.highlight_after;
3697 NETDATA.options.highlight_before = urlOptions.highlight_before;
3698 urlOptions.netdataHighlightCallback(urlOptions.highlight, urlOptions.highlight_after, urlOptions.highlight_before);