]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-3595 Support resizing of browser window (Timeline and Treemap)
authorDavid Gageot <david@gageot.net>
Wed, 20 Jun 2012 11:47:37 +0000 (13:47 +0200)
committerDavid Gageot <david@gageot.net>
Wed, 20 Jun 2012 17:22:44 +0000 (19:22 +0200)
plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/timeline.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/treemap/_treemap_container.html.erb
sonar-server/src/main/webapp/javascripts/dashboard.js

index e1cc75ddbb7a1b603f81fbfca97477be23a8a80f..cdfe4275d32945a39fcf90420613c982948335c5 100644 (file)
       .events(events);
     timeline.render();
 
+    autoResize(200, function() {
+      timeline.render();
+    });
   </script>
 
 <%
      end
-   end 
+   end
 %>
index 2afabddf5e704c19d328c4289a93ed046175dadd..24f9dab2f3ebba0ae6b26dd8ddc775f8cdaf5fa6 100644 (file)
 </div>
 
 <script>
-  new Treemap(<%= treemap_id -%>, '<%= size_metric ? size_metric.key : '' -%>', '<%= color_metric ? color_metric.key : '' -%>',
-    <%= height_in_percents -%>).init('<%= context_type -%>', <%= context_id -%>).load();
+  var treemap = new Treemap(<%= treemap_id -%>, '<%= size_metric ? size_metric.key : '' -%>', '<%= color_metric ? color_metric.key : '' -%>',
+      <%= height_in_percents -%>);
+  treemap.init('<%= context_type -%>', <%= context_id -%>).load();
+
+  autoResize(200, function() {
+    treemap.load();
+  });
 </script>
index d2fa3fd15aca00bcd14392b9d2cc87cb4b77d2bd..9f14490c8b96e5c2345acaacc3b4119a5726273b 100644 (file)
@@ -113,3 +113,14 @@ Portal.prototype = {
     }
 };
 
+autoResize = function(everyMs, callback) {
+  var resizeTimer = null;
+  Event.observe(window, 'resize', function() {
+    if (resizeTimer == null) {
+      resizeTimer = window.setTimeout(function() {
+        resizeTimer = null;
+        callback();
+      }, everyMs);
+    }
+  });
+};