Merge lp://staging/~intellectronica/launchpad/bug-heat-in-listing into lp://staging/launchpad/db-devel

Proposed by Eleanor Berger
Status: Merged
Approved by: Deryck Hodge
Approved revision: not available
Merged at revision: not available
Proposed branch: lp://staging/~intellectronica/launchpad/bug-heat-in-listing
Merge into: lp://staging/launchpad/db-devel
Diff against target: 178 lines (+60/-15)
4 files modified
lib/canonical/launchpad/templates/bugs-listing-table-without-navlinks.pt (+9/-1)
lib/lp/bugs/browser/bugtask.py (+19/-8)
lib/lp/bugs/stories/bugtask-searches/xx-listing-basics.txt (+11/-0)
lib/lp/bugs/tests/bug.py (+21/-6)
To merge this branch: bzr merge lp://staging/~intellectronica/launchpad/bug-heat-in-listing
Reviewer Review Type Date Requested Status
Deryck Hodge (community) code Approve
Review via email: mp+17687@code.staging.launchpad.net
To post a comment you must log in.
Revision history for this message
Eleanor Berger (intellectronica) wrote :

This branch builds on work done in lp:~intellectronica/launchpad/bug-heat-view and displays the bug heat flames in bug listings. We've also added a minimal test to demonstrate that the heat now appear in listings. The heat functionality itself is tested independently.

Revision history for this message
Eleanor Berger (intellectronica) wrote :
Download full text (7.0 KiB)

This branch depends on a previous branch which still hasn't landed. The diff for this work is:

=== modified file 'lib/canonical/launchpad/templates/bugs-listing-table-without-navlinks.pt'
--- lib/canonical/launchpad/templates/bugs-listing-table-without-navlinks.pt 2009-07-17 17:59:07 +0000
+++ lib/canonical/launchpad/templates/bugs-listing-table-without-navlinks.pt 2010-01-19 20:12:24 +0000
@@ -22,7 +22,11 @@
           Importance</th>
         <th tal:condition="context/show_column/status|nothing">Status</th>
         <th tal:condition="context/show_column/date_last_updated|nothing">
- Date last updated</th>
+ Date last updated
+ </th>
+ <th tal:condition="context/show_column/heat|nothing">
+ Heat
+ </th>
       </tr>
     </thead>
     <tbody>
@@ -64,6 +68,10 @@
         <td tal:content="bugtask/bug/date_last_updated/fmt:date"
             tal:condition="context/show_column/date_last_updated|nothing">
             2007-11-25</td>
+ <td tal:condition="context/show_column/heat|nothing"
+ tal:content="structure bugtask/bug_heat_html"
+ style="text-align: center">
+ HEAT</td>
       </tr>
     </tbody>
   </table>

=== modified file 'lib/lp/bugs/browser/bugtask.py'
--- lib/lp/bugs/browser/bugtask.py 2010-01-19 16:43:20 +0000
+++ lib/lp/bugs/browser/bugtask.py 2010-01-19 20:11:00 +0000
@@ -1935,12 +1935,13 @@
     delegates(IBugTask, 'bugtask')

     def __init__(self, bugtask, has_mentoring_offer, has_bug_branch,
- has_specification):
+ has_specification, request=None):
         self.bugtask = bugtask
         self.review_action_widget = None
         self.has_mentoring_offer = has_mentoring_offer
         self.has_bug_branch = has_bug_branch
         self.has_specification = has_specification
+ self.request = request

     @property
     def last_significant_change_date(self):
@@ -1949,6 +1950,14 @@
                 self.bugtask.date_inprogress or self.bugtask.date_left_new or
                 self.bugtask.datecreated)

+ @property
+ def bug_heat_html(self):
+ """Returns the bug heat flames HTML."""
+ view = getMultiAdapter(
+ (self.bugtask.bug, self.request),
+ name='+bug-heat')
+ return view()
+

 class BugListingBatchNavigator(TableBatchNavigator):
     """A specialised batch navigator to load smartly extra bug information."""
@@ -1956,6 +1965,7 @@
     # to a mixin so that MilestoneView and others can use it.

     def __init__(self, tasks, request, columns_to_show, size):
+ self.request = request
         TableBatchNavigator.__init__(
             self, tasks, request, columns_to_show=columns_to_show, size=size)

@@ -1971,7 +1981,8 @@
             bugtask,
             badge_property['has_mentoring_offer'],
             badge_property['has_branch'],
- badge_property['has_specification'])
+ badge_property['has_specification'],
+ request=self.request)

     def getBugListingItems(self):
         """Return a decorated list of visible bug tasks."""
@@ -2191,11 +2202,11 @@

         if (upstream_context or productseries_co...

Read more...

Revision history for this message
Deryck Hodge (deryck) wrote :

Looks good. Bring the heat!

Cheers,
deryck

review: Approve (code)
Revision history for this message
Deryck Hodge (deryck) wrote :

Shouldn't have changed status, sorry. I guess you guys still need UI approval.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/canonical/launchpad/templates/bugs-listing-table-without-navlinks.pt'
2--- lib/canonical/launchpad/templates/bugs-listing-table-without-navlinks.pt 2010-01-19 20:26:39 +0000
3+++ lib/canonical/launchpad/templates/bugs-listing-table-without-navlinks.pt 2010-01-22 16:17:14 +0000
4@@ -22,7 +22,11 @@
5 Importance</th>
6 <th tal:condition="context/show_column/status|nothing">Status</th>
7 <th tal:condition="context/show_column/date_last_updated|nothing">
8- Date last updated</th>
9+ Date last updated
10+ </th>
11+ <th tal:condition="context/show_column/heat|nothing">
12+ Heat
13+ </th>
14 </tr>
15 </thead>
16 <tbody>
17@@ -64,6 +68,10 @@
18 <td tal:content="bugtask/bug/date_last_updated/fmt:date"
19 tal:condition="context/show_column/date_last_updated|nothing">
20 2007-11-25</td>
21+ <td tal:condition="context/show_column/heat|nothing"
22+ tal:content="structure bugtask/bug_heat_html"
23+ style="text-align: center">
24+ HEAT</td>
25 </tr>
26 </tbody>
27 </table>
28
29=== modified file 'lib/lp/bugs/browser/bugtask.py'
30--- lib/lp/bugs/browser/bugtask.py 2010-01-19 16:43:20 +0000
31+++ lib/lp/bugs/browser/bugtask.py 2010-01-22 16:17:14 +0000
32@@ -1935,12 +1935,13 @@
33 delegates(IBugTask, 'bugtask')
34
35 def __init__(self, bugtask, has_mentoring_offer, has_bug_branch,
36- has_specification):
37+ has_specification, request=None):
38 self.bugtask = bugtask
39 self.review_action_widget = None
40 self.has_mentoring_offer = has_mentoring_offer
41 self.has_bug_branch = has_bug_branch
42 self.has_specification = has_specification
43+ self.request = request
44
45 @property
46 def last_significant_change_date(self):
47@@ -1949,6 +1950,14 @@
48 self.bugtask.date_inprogress or self.bugtask.date_left_new or
49 self.bugtask.datecreated)
50
51+ @property
52+ def bug_heat_html(self):
53+ """Returns the bug heat flames HTML."""
54+ view = getMultiAdapter(
55+ (self.bugtask.bug, self.request),
56+ name='+bug-heat')
57+ return view()
58+
59
60 class BugListingBatchNavigator(TableBatchNavigator):
61 """A specialised batch navigator to load smartly extra bug information."""
62@@ -1956,6 +1965,7 @@
63 # to a mixin so that MilestoneView and others can use it.
64
65 def __init__(self, tasks, request, columns_to_show, size):
66+ self.request = request
67 TableBatchNavigator.__init__(
68 self, tasks, request, columns_to_show=columns_to_show, size=size)
69
70@@ -1971,7 +1981,8 @@
71 bugtask,
72 badge_property['has_mentoring_offer'],
73 badge_property['has_branch'],
74- badge_property['has_specification'])
75+ badge_property['has_specification'],
76+ request=self.request)
77
78 def getBugListingItems(self):
79 """Return a decorated list of visible bug tasks."""
80@@ -2191,11 +2202,11 @@
81
82 if (upstream_context or productseries_context or
83 distrosourcepackage_context or sourcepackage_context):
84- return ["id", "summary", "importance", "status"]
85+ return ["id", "summary", "importance", "status", "heat"]
86 elif distribution_context or distroseries_context:
87- return ["id", "summary", "packagename", "importance", "status"]
88+ return ["id", "summary", "packagename", "importance", "status", "heat"]
89 elif project_context:
90- return ["id", "summary", "productname", "importance", "status"]
91+ return ["id", "summary", "productname", "importance", "status", "heat"]
92 else:
93 raise AssertionError(
94 "Unrecognized context; don't know which report "
95@@ -3370,7 +3381,7 @@
96 """Search all bug reports."""
97
98 columns_to_show = ["id", "summary", "bugtargetdisplayname",
99- "importance", "status"]
100+ "importance", "status", "heat"]
101 schema = IFrontPageBugTaskSearch
102 custom_widget('scope', ProjectScopeWidget)
103 page_title = 'Search'
104@@ -3579,9 +3590,9 @@
105 """Show the columns that summarise expirable bugs."""
106 if (IDistribution.providedBy(self.context)
107 or IDistroSeries.providedBy(self.context)):
108- return ['id', 'summary', 'packagename', 'date_last_updated']
109+ return ['id', 'summary', 'packagename', 'date_last_updated', 'heat']
110 else:
111- return ['id', 'summary', 'date_last_updated']
112+ return ['id', 'summary', 'date_last_updated', 'heat']
113
114 @property
115 def search(self):
116
117=== modified file 'lib/lp/bugs/stories/bugtask-searches/xx-listing-basics.txt'
118--- lib/lp/bugs/stories/bugtask-searches/xx-listing-basics.txt 2009-11-27 14:39:43 +0000
119+++ lib/lp/bugs/stories/bugtask-searches/xx-listing-basics.txt 2010-01-22 16:17:14 +0000
120@@ -223,3 +223,14 @@
121 <a href="http://launchpad.dev/debian/+milestone/3.1" alt="milestone 3.1"
122 title="Linked to milestone 3.1" class="sprite milestone"></a>
123
124+
125+== Bug heat in listings ==
126+
127+Bug listings display the bug heat in the last column. Heat is displayed as four flame
128+images, marked here as '-'.
129+
130+ >>> user_browser.open("http://launchpad.dev/firefox/+bugs?field.searchtext=install&search=Search&advanced=&milestone=1&status=10&status=20&assignee=all")
131+ >>> print_bugtasks(user_browser.contents, show_heat=True)
132+ 5 Firefox install instructions should be complete Critical New ----
133+ 1 Firefox does not support SVG Low New ----
134+
135
136=== modified file 'lib/lp/bugs/tests/bug.py'
137--- lib/lp/bugs/tests/bug.py 2009-11-06 20:28:16 +0000
138+++ lib/lp/bugs/tests/bug.py 2010-01-22 16:17:14 +0000
139@@ -108,18 +108,33 @@
140 print extract_text(node)
141
142
143-def print_bugtasks(text):
144+def print_bugtasks(text, show_heat=None):
145 """Print all the bugtasks in the text."""
146- print '\n'.join(extract_bugtasks(text))
147-
148-
149-def extract_bugtasks(text):
150+ print '\n'.join(extract_bugtasks(text, show_heat=show_heat))
151+
152+
153+def extract_bugtasks(text, show_heat=None):
154 """Extracts a list of strings for all the bugtasks in the text."""
155 main_content = find_main_content(text)
156 table = main_content.find('table', {'id': 'buglisting'})
157 if table is None:
158 return []
159- return [extract_text(tr) for tr in table('tr') if tr.td is not None]
160+ rows = []
161+ for tr in table('tr'):
162+ if tr.td is not None:
163+ row_text = extract_text(tr)
164+ if show_heat:
165+ heat_text = ''
166+ for img in tr.findAll('img'):
167+ if img['src'] == '/@@/flame-icon':
168+ heat_text += '*'
169+ elif img['src'] == '/@@/flame-bw-icon':
170+ heat_text += '-'
171+ else:
172+ pass
173+ row_text += '\n' + heat_text
174+ rows.append(row_text)
175+ return rows
176
177
178 def create_task_from_strings(bug, owner, product, watchurl=None):

Subscribers

People subscribed via source and target branches

to status/vote changes: