Title: [opsview] [10969] Allow double clicks to stop the auto refresh, in debug mode only
Revision
10969
Author
tvoon
Date
2012-12-10 17:36:36 +0000 (Mon, 10 Dec 2012)

Log Message

Allow double clicks to stop the auto refresh, in debug mode only

Modified Paths


Modified: trunk/opsview-web/root/toolbar_items/refresh
===================================================================
--- trunk/opsview-web/root/toolbar_items/refresh	2012-12-10 16:19:24 UTC (rev 10968)
+++ trunk/opsview-web/root/toolbar_items/refresh	2012-12-10 17:36:36 UTC (rev 10969)
@@ -17,6 +17,7 @@
         left: rs_left +'px'
     });
     var stopRefresh = false;
+    var delay=500, clicks=0, refreshButtonClickTimer = null;
     $('#refresh_tooltip_launcher').bind('mouseenter', function(){
         var hasContent = $.trim($('#refresh_status_hover').text()).length
             || $.trim($('#refresh_status_nohover').text()).length;
@@ -26,16 +27,26 @@
     }).bind('mouseleave', function() {
         $('#refresh_status').hide();
     }).bind('click', function() {
-        [% IF debug %]
-        if ( stopRefresh ) {
-            refreshTimer.start();
+        [% IF ! debug %]
+        refresh_content();
+        [% ELSE; # This allows double clicks to stop the auto refreshing %]
+        clicks++;
+        if (clicks===1) {
+            refreshButtonClickTimer = setTimeout(function(){
+                clicks=0;
+                refresh_content();
+            }, delay);
         } else {
-            refreshTimer.stop();
+            clearTimeout(refreshButtonClickTimer);
+            if ( stopRefresh ) {
+                refreshTimer.start();
+            } else {
+                refreshTimer.stop();
+            }
+            stopRefresh ^= true;
+            clicks=0;
         }
-        stopRefresh ^= true;
-        [% ELSE; # IF debug %]
-        refresh_content();
-        [% END; # IF debug %]
+        [% END %]
     });
 });
 

_______________________________________________
Opsview-checkins mailing list
[email protected]
http://lists.opsview.org/lists/listinfo/opsview-checkins

Reply via email to