Merge lp:~lifeless/launchpad/showtimes into lp:launchpad

Proposed by Robert Collins
Status: Merged
Approved by: Curtis Hovey
Approved revision: no longer in the source branch.
Merged at revision: 12347
Proposed branch: lp:~lifeless/launchpad/showtimes
Merge into: lp:launchpad
Diff against target: 170 lines (+52/-7)
7 files modified
lib/canonical/launchpad/icing/style-3-0.css.in (+6/-0)
lib/canonical/launchpad/pagetests/basics/user-requested-oops.txt (+6/-2)
lib/canonical/launchpad/templates/launchpad-loginstatus.pt (+1/-0)
lib/lp/app/browser/tests/base-layout.txt (+6/-4)
lib/lp/app/templates/base-layout.pt (+15/-1)
lib/lp/services/features/flags.py (+4/-0)
lib/lp/services/features/rulesource.py (+14/-0)
To merge this branch: bzr merge lp:~lifeless/launchpad/showtimes
Reviewer Review Type Date Requested Status
Curtis Hovey (community) code Approve
Review via email: mp+48754@code.launchpad.net

Commit message

[r=sinzui][bug=715474] Permit showing server side render times in the visible page (controlled by feature flag visible_render_time).

Description of the change

With thanks to Huw for the javascript, this branch adds the server render time to the left of the logged in user. Its only shown when visible_render_time is set as a feature flag : so we can set this to team:launchpad and show it just for launchpad developers.

To post a comment you must log in.
Revision history for this message
Robert Collins (lifeless) wrote :

This is a screenshot without huw's shininess improvement. http://people.ubuntu.com/~lifeless/showtime.png

Revision history for this message
Curtis Hovey (sinzui) wrote :

We discussed the Bugtask decorated resultset changes. They are from another branch that is already approved to land, So I only reviewed the base-layout and rendertime changes. These are good to land.

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/canonical/launchpad/icing/style-3-0.css.in'
--- lib/canonical/launchpad/icing/style-3-0.css.in 2011-02-03 21:08:58 +0000
+++ lib/canonical/launchpad/icing/style-3-0.css.in 2011-02-09 05:43:36 +0000
@@ -1162,6 +1162,12 @@
1162 top: .5em;1162 top: .5em;
1163 right: 1.5em;1163 right: 1.5em;
1164 }1164 }
1165#rendertime {
1166 float: left;
1167 margin: 0.2em 1.2em 0 0;
1168 color: #666;
1169 font-size: 77%;
1170 }
1165div.watermark-apps-portlet {1171div.watermark-apps-portlet {
1166 clear: both;1172 clear: both;
1167 margin-bottom: .5em;1173 margin-bottom: .5em;
11681174
=== modified file 'lib/canonical/launchpad/pagetests/basics/user-requested-oops.txt'
--- lib/canonical/launchpad/pagetests/basics/user-requested-oops.txt 2010-09-01 18:55:59 +0000
+++ lib/canonical/launchpad/pagetests/basics/user-requested-oops.txt 2011-02-09 05:43:36 +0000
@@ -12,21 +12,25 @@
1212
13The OOPS id is put into the comment at the end of the document.13The OOPS id is put into the comment at the end of the document.
1414
15 >>> (page, summary) = browser.contents.split('</html>')15 >>> (page, summary) = browser.contents.split('</body>')
16 >>> print summary16 >>> print summary
17 ...
17 <!-- ...18 <!-- ...
18 At least ... actions issued in ... seconds OOPS-...19 At least ... actions issued in ... seconds OOPS-...
19 <BLANKLINE>20 <BLANKLINE>
20 r...21 r...
21 -->22 -->
23 ...
2224
23The ++oops++ can be anywhere in the traversal.25The ++oops++ can be anywhere in the traversal.
2426
25 >>> browser.open("http://launchpad.dev/gnome-terminal/++oops++/trunk")27 >>> browser.open("http://launchpad.dev/gnome-terminal/++oops++/trunk")
26 >>> (page, summary) = browser.contents.split('</html>')28 >>> (page, summary) = browser.contents.split('</body>')
27 >>> print summary29 >>> print summary
30 ...
28 <!-- ...31 <!-- ...
29 At least ... actions issued in ... seconds OOPS-...32 At least ... actions issued in ... seconds OOPS-...
30 <BLANKLINE>33 <BLANKLINE>
31 r...34 r...
32 -->35 -->
36 ...
3337
=== modified file 'lib/canonical/launchpad/templates/launchpad-loginstatus.pt'
--- lib/canonical/launchpad/templates/launchpad-loginstatus.pt 2010-08-12 15:31:11 +0000
+++ lib/canonical/launchpad/templates/launchpad-loginstatus.pt 2011-02-09 05:43:36 +0000
@@ -9,6 +9,7 @@
9<div id="logincontrol" tal:condition="view/logged_in">9<div id="logincontrol" tal:condition="view/logged_in">
10 <form action="+logout" method="post">10 <form action="+logout" method="post">
11 <input type="hidden" name="loggingout" value="1" />11 <input type="hidden" name="loggingout" value="1" />
12 <div id="rendertime" tal:condition="request/features/visible_render_time">Loading... &bull;</div>
12 <a tal:replace="structure request/lp:person/fmt:name_link" /> &bull;13 <a tal:replace="structure request/lp:person/fmt:name_link" /> &bull;
13 <input type="submit" name="logout" value="Log Out" />14 <input type="submit" name="logout" value="Log Out" />
14 </form>15 </form>
1516
=== modified file 'lib/lp/app/browser/tests/base-layout.txt'
--- lib/lp/app/browser/tests/base-layout.txt 2010-11-05 17:24:55 +0000
+++ lib/lp/app/browser/tests/base-layout.txt 2011-02-09 05:43:36 +0000
@@ -125,9 +125,10 @@
125Page Diagnostics125Page Diagnostics
126----------------126----------------
127127
128The page includes a comment after the document with diagnostic information.128The page includes a comment after the body with diagnostic information.
129129
130 >>> print html[html.index('</html>') + 7:]130 >>> print html[html.index('</body>') + 7:]
131 ...
131 <!--132 <!--
132 Facet name: overview133 Facet name: overview
133 Page type: locationless134 Page type: locationless
@@ -135,10 +136,11 @@
135 Has application tabs: False136 Has application tabs: False
136 Has side portlets: False137 Has side portlets: False
137 At least ... queries... issued in ... seconds138 At least ... queries... issued in ... seconds
138 Features: {}139 Features: {...}
139 in scopes {}140 in scopes {...}
140 r...141 r...
141 -->142 -->
143 ...
142144
143Page Headings145Page Headings
144-------------146-------------
145147
=== modified file 'lib/lp/app/templates/base-layout.pt'
--- lib/lp/app/templates/base-layout.pt 2010-12-13 18:04:24 +0000
+++ lib/lp/app/templates/base-layout.pt 2011-02-09 05:43:36 +0000
@@ -169,7 +169,6 @@
169 <metal:lp-client-cache169 <metal:lp-client-cache
170 use-macro="context/@@+base-layout-macros/lp-client-cache" />170 use-macro="context/@@+base-layout-macros/lp-client-cache" />
171 </body>171 </body>
172</html>
173172
174<tal:template>173<tal:template>
175 <tal:comment174 <tal:comment
@@ -189,4 +188,19 @@
189 r${revno}188 r${revno}
190 --&gt;" />189 --&gt;" />
191</tal:template>190</tal:template>
191
192<tal:comment
193 tal:condition="request/features/visible_render_time"
194 define="render_time modules/canonical.launchpad.webapp.adapter/summarize_requests;"
195 replace='structure string:&lt;script type="text/javascript"&gt;
196 var render_time = "${render_time} &amp;bull;";
197 LPS.use("node", function(Y) {
198 Y.on("domready", function() {
199 var node = Y.one("#rendertime");
200 node.set("innerHTML", render_time);
201 });
202 });
203&lt;/script&gt;' />
204
205</html>
192</metal:page>206</metal:page>
193207
=== modified file 'lib/lp/services/features/flags.py'
--- lib/lp/services/features/flags.py 2011-01-13 22:09:52 +0000
+++ lib/lp/services/features/flags.py 2011-02-09 05:43:36 +0000
@@ -40,6 +40,10 @@
40 '[on|off]',40 '[on|off]',
41 'redirect to private URLs instead of proxying',41 'redirect to private URLs instead of proxying',
42 'off'),42 'off'),
43 ('visible_render_time',
44 'empty|nonempty',
45 'enables showing the page render overheads in the login widget',
46 ''),
43 ])47 ])
4448
45# The set of all flag names that are documented.49# The set of all flag names that are documented.
4650
=== modified file 'lib/lp/services/features/rulesource.py'
--- lib/lp/services/features/rulesource.py 2011-01-05 21:15:31 +0000
+++ lib/lp/services/features/rulesource.py 2011-02-09 05:43:36 +0000
@@ -16,6 +16,7 @@
1616
17from storm.locals import Desc17from storm.locals import Desc
1818
19from canonical.launchpad.webapp import adapter
19from lp.services.features.model import (20from lp.services.features.model import (
20 FeatureFlag,21 FeatureFlag,
21 getFeatureStore,22 getFeatureStore,
@@ -90,6 +91,19 @@
90 """91 """
9192
92 def getAllRulesAsTuples(self):93 def getAllRulesAsTuples(self):
94 try:
95 # This LBYL may look odd but it is needed. Rendering OOPSes and
96 # timeouts also looks up flags, but doing such a lookup can
97 # will cause a doom if the db request is not executed or is
98 # canceled by the DB - and then results in a failure in
99 # zope.app.publications.ZopePublication.handleError when it
100 # calls transaction.commit.
101 # By Looking this up first, we avoid this and also permit
102 # code using flags to work in timed out requests (by appearing to
103 # have no rules).
104 adapter.get_request_remaining_seconds()
105 except adapter.RequestExpired:
106 return
93 store = getFeatureStore()107 store = getFeatureStore()
94 rs = (store108 rs = (store
95 .find(FeatureFlag)109 .find(FeatureFlag)