← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~rvb/launchpad/trace-report into lp:launchpad

 

Raphaël Victor Badin has proposed merging lp:~rvb/launchpad/trace-report into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~rvb/launchpad/trace-report/+merge/70839

This branch changes the pages generated by utilities/page-performance-report.py so that the graphs will only be plotted when actually displayed. This avoid having to wait with the page blocked while all the graphs are being plotted.

This uses a jquery plugin jquery-appear (http://code.google.com/p/jquery-appear/) that does all the heavy lifting.

I've put it in http://people.canonical.com/~rvb/serve/jquery.appear-1.1.1.min.js for now but we might want to put it in http://people.canonical.com/~stub like the rest of the jquery plugins used by the pages generated from the script.
-- 
https://code.launchpad.net/~rvb/launchpad/trace-report/+merge/70839
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~rvb/launchpad/trace-report into lp:launchpad.
=== modified file 'lib/lp/scripts/utilities/pageperformancereport.py'
--- lib/lp/scripts/utilities/pageperformancereport.py	2011-05-04 19:38:40 +0000
+++ lib/lp/scripts/utilities/pageperformancereport.py	2011-08-09 09:52:32 +0000
@@ -1023,6 +1023,9 @@
             src="http://people.canonical.com/~stub/flot/jquery.min.js";
             ></script>
         <script language="javascript" type="text/javascript"
+            src="http://people.canonical.com/~rvb/serve/jquery.appear-1.1.1.min.js";
+            ></script>
+        <script language="javascript" type="text/javascript"
             src="http://people.canonical.com/~stub/flot/jquery.flot.min.js";
             ></script>
         <script language="javascript" type="text/javascript"
@@ -1213,13 +1216,18 @@
         if histogram.count == 0:
             continue
         print >> outf, dedent("""\
-            var d = %s;
-
-            $.plot(
-                $("#histogram%d"),
-                [{data: d}], options);
-
-            """ % (json.dumps(histogram.bins_relative), i))
+            function plot_histogram_%d() {
+                var d = %s;
+
+                $.plot(
+                    $("#histogram%d"),
+                    [{data: d}], options);
+            }
+            $('#histogram%d').appear(function() {
+                plot_histogram_%d();
+            });
+
+            """ % (i, json.dumps(histogram.bins_relative), i, i, i))
 
     print >> outf, dedent("""\
             });


Follow ups