]> arthur.barton.de Git - netdata.git/commitdiff
added url query options to allow sharing specific timeframes
authorCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Sun, 10 Apr 2016 02:56:46 +0000 (05:56 +0300)
committerCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Sun, 10 Apr 2016 02:56:46 +0000 (05:56 +0300)
web/index.html

index d2bab8791ffd43524fe04a2acb5f0002f1a99433..3e82b4ffa9fb88371f6f0ff7713a8e6dde28b153 100644 (file)
@@ -1781,6 +1781,21 @@ function notifyForUpdate(force) {
 
 // ----------------------------------------------------------------------------
 
+function getUrlParameter(sParam) {
+    var sPageURL = decodeURIComponent(window.location.search.substring(1)),
+        sURLVariables = sPageURL.split('&'),
+        sParameterName,
+        i;
+
+    for (i = 0; i < sURLVariables.length; i++) {
+        sParameterName = sURLVariables[i].split('=');
+
+        if (sParameterName[0] === sParam) {
+            return sParameterName[1] === undefined ? true : sParameterName[1];
+        }
+    }
+}
+
 function finalizePage() {
        // resize all charts - without starting the background thread
        // this has to be done while NETDATA is paused
@@ -1788,6 +1803,13 @@ function finalizePage() {
        // the Dom elements are initially zero-sized
        NETDATA.parseDom();
 
+       var before = 0, after = 0;
+       after = getUrlParameter('force_after_ms');
+       before = getUrlParameter('force_before_ms');
+
+       if(before > 0 && after > 0)
+               NETDATA.globalPanAndZoom.setMaster(NETDATA.options.targets[0], after, before);
+
        // let it run (update the charts)
        NETDATA.unpause();