Merge lp:~wallyworld/launchpad/sort-buglisting-informationtype-1024235 into lp:launchpad

Proposed by Ian Booth
Status: Merged
Approved by: Curtis Hovey
Approved revision: no longer in the source branch.
Merged at revision: 15633
Proposed branch: lp:~wallyworld/launchpad/sort-buglisting-informationtype-1024235
Merge into: lp:launchpad
Diff against target: 348 lines (+79/-8)
8 files modified
lib/canonical/launchpad/icing/css/components/bug_listing.css (+15/-1)
lib/lp/bugs/browser/bugtask.py (+3/-0)
lib/lp/bugs/browser/tests/test_bugtask.py (+16/-3)
lib/lp/bugs/javascript/buglisting_utils.js (+1/-0)
lib/lp/bugs/javascript/tests/test_buglisting_utils.js (+12/-0)
lib/lp/bugs/model/bugtasksearch.py (+5/-4)
lib/lp/bugs/templates/buglisting.mustache (+7/-0)
lib/lp/bugs/tests/test_bugtask_search.py (+20/-0)
To merge this branch: bzr merge lp:~wallyworld/launchpad/sort-buglisting-informationtype-1024235
Reviewer Review Type Date Requested Status
Curtis Hovey (community) code Approve
Review via email: mp+115053@code.launchpad.net

Commit message

Dynamic bug listing page now displays information type and supports sorting by information type too.

Description of the change

== Implementation ==

Bugs can be filtered by information type so supported needed to be added to the dynamic bug listing page to support display and sorting by information type as well.

I used the spare space under the status and importance fields to display the information type. I think it belongs there as it is a key piece of information and would otherwise get lost in all the text if it were displayed on the right with the other fields. It's the only place also that I could make it look good.

== Demo ==

An example of how it looks:

http://people.canonical.com/~ianb/buglisting-information_type.png

== Tests ==

I simply updated existing tests cases to add some new tests for checking the information type behaviour, including display, sorting, and rendering in the data model.

== Lint ==

Checking for conflicts and issues in changed files.

Linting changed files:
  lib/canonical/launchpad/icing/css/components/bug_listing.css
  lib/lp/bugs/browser/bugtask.py
  lib/lp/bugs/browser/tests/test_bugtask.py
  lib/lp/bugs/javascript/buglisting_utils.js
  lib/lp/bugs/javascript/tests/test_buglisting_utils.js
  lib/lp/bugs/model/bugtasksearch.py
  lib/lp/bugs/templates/buglisting.mustache
  lib/lp/bugs/tests/test_bugtask_search.py

To post a comment you must log in.
Revision history for this message
Curtis Hovey (sinzui) wrote :

Thank you.

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/canonical/launchpad/icing/css/components/bug_listing.css'
2--- lib/canonical/launchpad/icing/css/components/bug_listing.css 2012-01-12 11:28:03 +0000
3+++ lib/canonical/launchpad/icing/css/components/bug_listing.css 2012-07-16 01:38:20 +0000
4@@ -3,6 +3,7 @@
5 width: 100%;
6 color: #666;
7 }
8+
9 div.buglisting-row {
10 float: left;
11 margin-top: 5px;
12@@ -11,17 +12,21 @@
13 min-width: 585px;
14 width: 100%;
15 }
16+
17 div.buglisting-col1 {
18 float: left;
19 padding-right: 10px;
20 }
21+
22 div.buglisting-col2 {
23 float: left;
24 margin-top: 2px;
25 width: 68%;
26 }
27+
28 div#client-listing .status,
29-div#client-listing .importance {
30+div#client-listing .importance,
31+div#client-listing .information_type {
32 float: left;
33 height: 1.5em;
34 font-size: 0.8em;
35@@ -31,18 +36,27 @@
36 text-align: center;
37 margin: 5px 10px 0 0;
38 }
39+
40 div#client-listing .importance {
41 width: 65px;
42 }
43+
44 div#client-listing .status {
45 width: 90px;
46 }
47+
48+div#client-listing .information_type {
49+ height: 1em;
50+ width: 160px;
51+ }
52+
53 div#client-listing .field {
54 display: inline-block;
55 min-width: 13em;
56 line-height: 16px;
57 margin-right: 5px;
58 }
59+
60 div#client-listing .field a {
61 color: #333;
62 }
63
64=== modified file 'lib/lp/bugs/browser/bugtask.py'
65--- lib/lp/bugs/browser/bugtask.py 2012-07-11 01:24:42 +0000
66+++ lib/lp/bugs/browser/bugtask.py 2012-07-16 01:38:20 +0000
67@@ -2244,6 +2244,7 @@
68 'id': self.bug.id,
69 'importance': self.importance.title,
70 'importance_class': 'importance' + self.importance.name,
71+ 'information_type': self.bug.information_type.title,
72 'last_updated': last_updated,
73 'milestone_name': milestone_name,
74 'reporter': reporter.displayname,
75@@ -2279,6 +2280,7 @@
76 'show_heat': True,
77 'show_id': True,
78 'show_importance': True,
79+ 'show_information_type': True,
80 'show_date_last_updated': False,
81 'show_milestone_name': False,
82 'show_reporter': False,
83@@ -2511,6 +2513,7 @@
84 SORT_KEYS = [
85 ('importance', 'Importance', 'desc'),
86 ('status', 'Status', 'asc'),
87+ ('information_type', 'Information Type', 'asc'),
88 ('id', 'Number', 'desc'),
89 ('title', 'Title', 'asc'),
90 ('targetname', 'Package/Project/Series name', 'asc'),
91
92=== modified file 'lib/lp/bugs/browser/tests/test_bugtask.py'
93--- lib/lp/bugs/browser/tests/test_bugtask.py 2012-07-10 16:04:02 +0000
94+++ lib/lp/bugs/browser/tests/test_bugtask.py 2012-07-16 01:38:20 +0000
95@@ -2191,7 +2191,8 @@
96 '&show_id=true&show_targetname=true'
97 '&show_milestone_name=true&show_date_last_updated=true'
98 '&show_assignee=true&show_heat=true&show_tag=true'
99- '&show_importance=true&show_status=true')
100+ '&show_importance=true&show_status=true'
101+ '&show_information_type=true')
102 with dynamic_listings():
103 view = self.makeView(
104 task, memo=1, forwards=False, size=1, cookie=cookie)
105@@ -2207,7 +2208,8 @@
106 '&show_id=true&show_targetname=true'
107 '&show_milestone_name=true&show_date_last_updated=true'
108 '&show_assignee=true&show_heat=true&show_tag=true'
109- '&show_importance=true&show_status=true&show_title=true')
110+ '&show_importance=true&show_status=true'
111+ '&show_information_type=true&show_title=true')
112 with dynamic_listings():
113 view = self.makeView(
114 task, memo=1, forwards=False, size=1, cookie=cookie)
115@@ -2223,7 +2225,8 @@
116 '&show_id=true&show_targetname=true'
117 '&show_milestone_name=true&show_date_last_updated=true'
118 '&show_assignee=true&show_heat=true&show_tag=true'
119- '&show_importance=true&show_title=true')
120+ '&show_importance=true&show_title=true'
121+ '&show_information_type=true')
122 with dynamic_listings():
123 view = self.makeView(
124 task, memo=1, forwards=False, size=1, cookie=cookie)
125@@ -2299,6 +2302,7 @@
126 'id': '3.14159',
127 'importance': 'importance1',
128 'importance_class': 'importance_class1',
129+ 'information_type': 'User Data',
130 'last_updated': 'updated1',
131 'milestone_name': 'milestone_name1',
132 'status': 'status1',
133@@ -2337,6 +2341,13 @@
134 self.assertNotIn('importance1', navigator.mustache)
135 self.assertNotIn('importance_class1', navigator.mustache)
136
137+ def test_hiding_information_type(self):
138+ """Hiding information_type removes the text."""
139+ navigator, mustache_model = self.getNavigator()
140+ self.assertIn('User Data', navigator.mustache)
141+ mustache_model['items'][0]['show_information_type'] = False
142+ self.assertNotIn('User Data', navigator.mustache)
143+
144 def test_hiding_bugtarget(self):
145 """Hiding bugtarget removes the text and CSS."""
146 navigator, mustache_model = self.getNavigator()
147@@ -2493,6 +2504,8 @@
148 self.assertEqual('importanceUNDECIDED', model['importance_class'])
149 self.assertEqual('New', model['status'])
150 self.assertEqual('statusNEW', model['status_class'])
151+ self.assertEqual(
152+ item.bug.information_type.title, model['information_type'])
153 self.assertEqual(item.bug.title, model['title'])
154 self.assertEqual(item.bug.id, model['id'])
155 self.assertEqual(canonical_url(item.bugtask), model['bug_url'])
156
157=== modified file 'lib/lp/bugs/javascript/buglisting_utils.js'
158--- lib/lp/bugs/javascript/buglisting_utils.js 2012-01-19 02:00:52 +0000
159+++ lib/lp/bugs/javascript/buglisting_utils.js 2012-07-16 01:38:20 +0000
160@@ -52,6 +52,7 @@
161 show_id: 'Number',
162 show_importance: 'Importance',
163 show_status: 'Status',
164+ show_information_type: 'Information Type',
165 show_heat: 'Heat',
166 show_targetname: 'Package/Project/Series name',
167 show_datecreated: 'Age',
168
169=== modified file 'lib/lp/bugs/javascript/tests/test_buglisting_utils.js'
170--- lib/lp/bugs/javascript/tests/test_buglisting_utils.js 2012-06-27 18:50:07 +0000
171+++ lib/lp/bugs/javascript/tests/test_buglisting_utils.js 2012-07-16 01:38:20 +0000
172@@ -33,6 +33,7 @@
173 show_id: false,
174 show_importance: false,
175 show_status: true,
176+ show_information_type: false,
177 show_heat: true,
178 show_targetname: true,
179 show_datecreated: false,
180@@ -48,6 +49,7 @@
181 show_id: true,
182 show_importance: true,
183 show_status: true,
184+ show_information_type: true,
185 show_heat: true,
186 show_targetname: true,
187 show_datecreated: false,
188@@ -140,6 +142,7 @@
189 'show_id',
190 'show_importance',
191 'show_status',
192+ 'show_information_type',
193 'show_heat',
194 'show_targetname',
195 'show_datecreated',
196@@ -154,6 +157,7 @@
197 false,
198 false,
199 true,
200+ false,
201 true,
202 true,
203 false,
204@@ -186,6 +190,7 @@
205 'show_id',
206 'show_importance',
207 'show_status',
208+ 'show_information_type',
209 'show_heat',
210 'show_targetname',
211 'show_datecreated',
212@@ -200,6 +205,7 @@
213 true,
214 true,
215 false,
216+ true,
217 false,
218 true,
219 false,
220@@ -245,6 +251,7 @@
221 show_id: false,
222 show_importance: false,
223 show_status: true,
224+ show_information_type: false,
225 show_heat: false,
226 show_targetname: false,
227 show_datecreated: false,
228@@ -292,6 +299,7 @@
229 show_id: false,
230 show_importance: false,
231 show_status: true,
232+ show_information_type: false,
233 show_heat: true,
234 show_targetname: false,
235 show_datecreated: false,
236@@ -366,6 +374,7 @@
237 'show_id',
238 'show_importance',
239 'show_status',
240+ 'show_information_type',
241 'show_heat',
242 'show_targetname',
243 'show_datecreated',
244@@ -382,6 +391,7 @@
245 true,
246 true,
247 true,
248+ true,
249 false,
250 false,
251 false,
252@@ -427,6 +437,7 @@
253 show_id: false,
254 show_importance: true,
255 show_status: true,
256+ show_information_type: true,
257 show_heat: true,
258 show_targetname: true,
259 show_datecreated: false,
260@@ -443,6 +454,7 @@
261 ['title', 'Title'],
262 ['importance', 'Importance'],
263 ['status', 'Status'],
264+ ['information_type', 'Information Type'],
265 ['heat', 'Heat'],
266 ['reporter', 'Reporter'],
267 ['assignee', 'Assignee'],
268
269=== modified file 'lib/lp/bugs/model/bugtasksearch.py'
270--- lib/lp/bugs/model/bugtasksearch.py 2012-07-10 09:51:13 +0000
271+++ lib/lp/bugs/model/bugtasksearch.py 2012-07-16 01:38:20 +0000
272@@ -118,6 +118,7 @@
273 ]),
274 "targetname": (BugTask.targetnamecache, [bugtask_join]),
275 "status": (BugTaskFlat.status, []),
276+ "information_type": (BugTaskFlat.information_type, []),
277 "title": (Bug.title, [bug_join]),
278 "milestone": (BugTaskFlat.milestone_id, []),
279 "dateassigned": (BugTask.date_assigned, [bugtask_join]),
280@@ -803,15 +804,15 @@
281 # strings.
282 extra_joins = []
283 ambiguous = True
284- # Sorting by milestone only is a very "coarse" sort order.
285- # If no additional sort order is specified, add the bug task
286+ # Sorting by milestone or information type only is a very "coarse"
287+ # sort order. If no additional sort order is specified, add the bug task
288 # importance as a secondary sort order.
289 if len(orderby) == 1:
290- if orderby[0] == 'milestone_name':
291+ if orderby[0] in ('milestone_name', 'information_type'):
292 # We want the most important bugtasks first; these have
293 # larger integer values.
294 orderby.append('-importance')
295- elif orderby[0] == '-milestone_name':
296+ elif orderby[0] in ('-milestone_name', '-information_type'):
297 orderby.append('importance')
298 else:
299 # Other sort orders don't need tweaking.
300
301=== modified file 'lib/lp/bugs/templates/buglisting.mustache'
302--- lib/lp/bugs/templates/buglisting.mustache 2012-07-02 14:55:38 +0000
303+++ lib/lp/bugs/templates/buglisting.mustache 2012-07-16 01:38:20 +0000
304@@ -13,6 +13,13 @@
305 {{status}}
306 </div>
307 {{/show_status}}
308+ <div class="buginfo-extra">
309+ {{#show_information_type}}
310+ <div class="information_type">
311+ {{information_type}}
312+ </div>
313+ {{/show_information_type}}
314+ </div>
315 </div>
316
317 <div class="buglisting-col2">
318
319=== modified file 'lib/lp/bugs/tests/test_bugtask_search.py'
320--- lib/lp/bugs/tests/test_bugtask_search.py 2012-07-10 09:51:13 +0000
321+++ lib/lp/bugs/tests/test_bugtask_search.py 2012-07-16 01:38:20 +0000
322@@ -519,6 +519,26 @@
323 user=None, orderby='-specification')
324 self.assertSearchFinds(params, expected)
325
326+ def test_sort_by_information_type(self):
327+ with person_logged_in(self.owner):
328+ self.bugtasks[0].bug.transitionToInformationType(
329+ InformationType.USERDATA, self.owner)
330+ self.bugtasks[1].bug.transitionToInformationType(
331+ InformationType.PUBLIC, self.owner)
332+ self.bugtasks[2].bug.transitionToInformationType(
333+ InformationType.USERDATA, self.owner)
334+ # Importance is secondary sort key.
335+ self.bugtasks[2].importance = BugTaskImportance.MEDIUM
336+
337+ expected = [self.bugtasks[1], self.bugtasks[0], self.bugtasks[2]]
338+ params = self.getBugTaskSearchParams(
339+ user=self.owner, orderby='information_type')
340+ self.assertSearchFinds(params, expected)
341+ expected.reverse()
342+ params = self.getBugTaskSearchParams(
343+ user=self.owner, orderby='-information_type')
344+ self.assertSearchFinds(params, expected)
345+
346
347 class TargetTests:
348 """Tests which are useful for every target."""