launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #09934
lp:~wallyworld/launchpad/sort-buglisting-informationtype-1024235 into lp:launchpad
Ian Booth has proposed merging lp:~wallyworld/launchpad/sort-buglisting-informationtype-1024235 into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #1024235 in Launchpad itself: "bug listings are not sortable by information type"
https://bugs.launchpad.net/launchpad/+bug/1024235
For more details, see:
https://code.launchpad.net/~wallyworld/launchpad/sort-buglisting-informationtype-1024235/+merge/115053
== 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
--
https://code.launchpad.net/~wallyworld/launchpad/sort-buglisting-informationtype-1024235/+merge/115053
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wallyworld/launchpad/sort-buglisting-informationtype-1024235 into lp:launchpad.
=== modified file 'lib/canonical/launchpad/icing/css/components/bug_listing.css'
--- lib/canonical/launchpad/icing/css/components/bug_listing.css 2012-01-12 11:28:03 +0000
+++ lib/canonical/launchpad/icing/css/components/bug_listing.css 2012-07-16 01:33:21 +0000
@@ -3,6 +3,7 @@
width: 100%;
color: #666;
}
+
div.buglisting-row {
float: left;
margin-top: 5px;
@@ -11,17 +12,21 @@
min-width: 585px;
width: 100%;
}
+
div.buglisting-col1 {
float: left;
padding-right: 10px;
}
+
div.buglisting-col2 {
float: left;
margin-top: 2px;
width: 68%;
}
+
div#client-listing .status,
-div#client-listing .importance {
+div#client-listing .importance,
+div#client-listing .information_type {
float: left;
height: 1.5em;
font-size: 0.8em;
@@ -31,18 +36,27 @@
text-align: center;
margin: 5px 10px 0 0;
}
+
div#client-listing .importance {
width: 65px;
}
+
div#client-listing .status {
width: 90px;
}
+
+div#client-listing .information_type {
+ height: 1em;
+ width: 160px;
+ }
+
div#client-listing .field {
display: inline-block;
min-width: 13em;
line-height: 16px;
margin-right: 5px;
}
+
div#client-listing .field a {
color: #333;
}
=== modified file 'lib/lp/bugs/browser/bugtask.py'
--- lib/lp/bugs/browser/bugtask.py 2012-07-11 01:24:42 +0000
+++ lib/lp/bugs/browser/bugtask.py 2012-07-16 01:33:21 +0000
@@ -2244,6 +2244,7 @@
'id': self.bug.id,
'importance': self.importance.title,
'importance_class': 'importance' + self.importance.name,
+ 'information_type': self.bug.information_type.title,
'last_updated': last_updated,
'milestone_name': milestone_name,
'reporter': reporter.displayname,
@@ -2279,6 +2280,7 @@
'show_heat': True,
'show_id': True,
'show_importance': True,
+ 'show_information_type': True,
'show_date_last_updated': False,
'show_milestone_name': False,
'show_reporter': False,
@@ -2511,6 +2513,7 @@
SORT_KEYS = [
('importance', 'Importance', 'desc'),
('status', 'Status', 'asc'),
+ ('information_type', 'Information Type', 'asc'),
('id', 'Number', 'desc'),
('title', 'Title', 'asc'),
('targetname', 'Package/Project/Series name', 'asc'),
=== modified file 'lib/lp/bugs/browser/tests/test_bugtask.py'
--- lib/lp/bugs/browser/tests/test_bugtask.py 2012-07-10 16:04:02 +0000
+++ lib/lp/bugs/browser/tests/test_bugtask.py 2012-07-16 01:33:21 +0000
@@ -2191,7 +2191,8 @@
'&show_id=true&show_targetname=true'
'&show_milestone_name=true&show_date_last_updated=true'
'&show_assignee=true&show_heat=true&show_tag=true'
- '&show_importance=true&show_status=true')
+ '&show_importance=true&show_status=true'
+ '&show_information_type=true')
with dynamic_listings():
view = self.makeView(
task, memo=1, forwards=False, size=1, cookie=cookie)
@@ -2207,7 +2208,8 @@
'&show_id=true&show_targetname=true'
'&show_milestone_name=true&show_date_last_updated=true'
'&show_assignee=true&show_heat=true&show_tag=true'
- '&show_importance=true&show_status=true&show_title=true')
+ '&show_importance=true&show_status=true'
+ '&show_information_type=true&show_title=true')
with dynamic_listings():
view = self.makeView(
task, memo=1, forwards=False, size=1, cookie=cookie)
@@ -2223,7 +2225,8 @@
'&show_id=true&show_targetname=true'
'&show_milestone_name=true&show_date_last_updated=true'
'&show_assignee=true&show_heat=true&show_tag=true'
- '&show_importance=true&show_title=true')
+ '&show_importance=true&show_title=true'
+ '&show_information_type=true')
with dynamic_listings():
view = self.makeView(
task, memo=1, forwards=False, size=1, cookie=cookie)
@@ -2299,6 +2302,7 @@
'id': '3.14159',
'importance': 'importance1',
'importance_class': 'importance_class1',
+ 'information_type': 'User Data',
'last_updated': 'updated1',
'milestone_name': 'milestone_name1',
'status': 'status1',
@@ -2337,6 +2341,13 @@
self.assertNotIn('importance1', navigator.mustache)
self.assertNotIn('importance_class1', navigator.mustache)
+ def test_hiding_information_type(self):
+ """Hiding importance removes the text."""
+ navigator, mustache_model = self.getNavigator()
+ self.assertIn('User Data', navigator.mustache)
+ mustache_model['items'][0]['show_information_type'] = False
+ self.assertNotIn('User Data', navigator.mustache)
+
def test_hiding_bugtarget(self):
"""Hiding bugtarget removes the text and CSS."""
navigator, mustache_model = self.getNavigator()
@@ -2493,6 +2504,8 @@
self.assertEqual('importanceUNDECIDED', model['importance_class'])
self.assertEqual('New', model['status'])
self.assertEqual('statusNEW', model['status_class'])
+ self.assertEqual(
+ item.bug.information_type.title, model['information_type'])
self.assertEqual(item.bug.title, model['title'])
self.assertEqual(item.bug.id, model['id'])
self.assertEqual(canonical_url(item.bugtask), model['bug_url'])
=== modified file 'lib/lp/bugs/javascript/buglisting_utils.js'
--- lib/lp/bugs/javascript/buglisting_utils.js 2012-01-19 02:00:52 +0000
+++ lib/lp/bugs/javascript/buglisting_utils.js 2012-07-16 01:33:21 +0000
@@ -52,6 +52,7 @@
show_id: 'Number',
show_importance: 'Importance',
show_status: 'Status',
+ show_information_type: 'Information Type',
show_heat: 'Heat',
show_targetname: 'Package/Project/Series name',
show_datecreated: 'Age',
=== modified file 'lib/lp/bugs/javascript/tests/test_buglisting_utils.js'
--- lib/lp/bugs/javascript/tests/test_buglisting_utils.js 2012-06-27 18:50:07 +0000
+++ lib/lp/bugs/javascript/tests/test_buglisting_utils.js 2012-07-16 01:33:21 +0000
@@ -33,6 +33,7 @@
show_id: false,
show_importance: false,
show_status: true,
+ show_information_type: false,
show_heat: true,
show_targetname: true,
show_datecreated: false,
@@ -48,6 +49,7 @@
show_id: true,
show_importance: true,
show_status: true,
+ show_information_type: true,
show_heat: true,
show_targetname: true,
show_datecreated: false,
@@ -140,6 +142,7 @@
'show_id',
'show_importance',
'show_status',
+ 'show_information_type',
'show_heat',
'show_targetname',
'show_datecreated',
@@ -154,6 +157,7 @@
false,
false,
true,
+ false,
true,
true,
false,
@@ -186,6 +190,7 @@
'show_id',
'show_importance',
'show_status',
+ 'show_information_type',
'show_heat',
'show_targetname',
'show_datecreated',
@@ -200,6 +205,7 @@
true,
true,
false,
+ true,
false,
true,
false,
@@ -245,6 +251,7 @@
show_id: false,
show_importance: false,
show_status: true,
+ show_information_type: false,
show_heat: false,
show_targetname: false,
show_datecreated: false,
@@ -292,6 +299,7 @@
show_id: false,
show_importance: false,
show_status: true,
+ show_information_type: false,
show_heat: true,
show_targetname: false,
show_datecreated: false,
@@ -366,6 +374,7 @@
'show_id',
'show_importance',
'show_status',
+ 'show_information_type',
'show_heat',
'show_targetname',
'show_datecreated',
@@ -382,6 +391,7 @@
true,
true,
true,
+ true,
false,
false,
false,
@@ -427,6 +437,7 @@
show_id: false,
show_importance: true,
show_status: true,
+ show_information_type: true,
show_heat: true,
show_targetname: true,
show_datecreated: false,
@@ -443,6 +454,7 @@
['title', 'Title'],
['importance', 'Importance'],
['status', 'Status'],
+ ['information_type', 'Information Type'],
['heat', 'Heat'],
['reporter', 'Reporter'],
['assignee', 'Assignee'],
=== modified file 'lib/lp/bugs/model/bugtasksearch.py'
--- lib/lp/bugs/model/bugtasksearch.py 2012-07-10 09:51:13 +0000
+++ lib/lp/bugs/model/bugtasksearch.py 2012-07-16 01:33:21 +0000
@@ -118,6 +118,7 @@
]),
"targetname": (BugTask.targetnamecache, [bugtask_join]),
"status": (BugTaskFlat.status, []),
+ "information_type": (BugTaskFlat.information_type, []),
"title": (Bug.title, [bug_join]),
"milestone": (BugTaskFlat.milestone_id, []),
"dateassigned": (BugTask.date_assigned, [bugtask_join]),
@@ -803,15 +804,15 @@
# strings.
extra_joins = []
ambiguous = True
- # Sorting by milestone only is a very "coarse" sort order.
- # If no additional sort order is specified, add the bug task
+ # Sorting by milestone or information type only is a very "coarse"
+ # sort order. If no additional sort order is specified, add the bug task
# importance as a secondary sort order.
if len(orderby) == 1:
- if orderby[0] == 'milestone_name':
+ if orderby[0] in ('milestone_name', 'information_type'):
# We want the most important bugtasks first; these have
# larger integer values.
orderby.append('-importance')
- elif orderby[0] == '-milestone_name':
+ elif orderby[0] in ('-milestone_name', '-information_type'):
orderby.append('importance')
else:
# Other sort orders don't need tweaking.
=== modified file 'lib/lp/bugs/templates/buglisting.mustache'
--- lib/lp/bugs/templates/buglisting.mustache 2012-07-02 14:55:38 +0000
+++ lib/lp/bugs/templates/buglisting.mustache 2012-07-16 01:33:21 +0000
@@ -13,6 +13,13 @@
{{status}}
</div>
{{/show_status}}
+ <div class="buginfo-extra">
+ {{#show_information_type}}
+ <div class="information_type">
+ {{information_type}}
+ </div>
+ {{/show_information_type}}
+ </div>
</div>
<div class="buglisting-col2">
=== modified file 'lib/lp/bugs/tests/test_bugtask_search.py'
--- lib/lp/bugs/tests/test_bugtask_search.py 2012-07-10 09:51:13 +0000
+++ lib/lp/bugs/tests/test_bugtask_search.py 2012-07-16 01:33:21 +0000
@@ -519,6 +519,26 @@
user=None, orderby='-specification')
self.assertSearchFinds(params, expected)
+ def test_sort_by_information_type(self):
+ with person_logged_in(self.owner):
+ self.bugtasks[0].bug.transitionToInformationType(
+ InformationType.USERDATA, self.owner)
+ self.bugtasks[1].bug.transitionToInformationType(
+ InformationType.PUBLIC, self.owner)
+ self.bugtasks[2].bug.transitionToInformationType(
+ InformationType.USERDATA, self.owner)
+ # Importance is secondary sort key.
+ self.bugtasks[2].importance = BugTaskImportance.MEDIUM
+
+ expected = [self.bugtasks[1], self.bugtasks[0], self.bugtasks[2]]
+ params = self.getBugTaskSearchParams(
+ user=self.owner, orderby='information_type')
+ self.assertSearchFinds(params, expected)
+ expected.reverse()
+ params = self.getBugTaskSearchParams(
+ user=self.owner, orderby='-information_type')
+ self.assertSearchFinds(params, expected)
+
class TargetTests:
"""Tests which are useful for every target."""
Follow ups