← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~allenap/launchpad/bugs-with-blueprints-bug-707103-ui into lp:launchpad

 

Gavin Panella has proposed merging lp:~allenap/launchpad/bugs-with-blueprints-bug-707103-ui into lp:launchpad with lp:~allenap/launchpad/bugs-with-blueprints-bug-707103 as a prerequisite.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  #707103 Unable to search for bugs that are attached to blueprints
  https://bugs.launchpad.net/bugs/707103

For more details, see:
https://code.launchpad.net/~allenap/launchpad/bugs-with-blueprints-bug-707103-ui/+merge/48004

Adds the UI for searching for bugs with or without linked blueprints. It's been heavily copied from the UI for searching for bugs with or without linked branches.
-- 
https://code.launchpad.net/~allenap/launchpad/bugs-with-blueprints-bug-707103-ui/+merge/48004
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~allenap/launchpad/bugs-with-blueprints-bug-707103-ui into lp:launchpad.
=== modified file 'lib/lp/bugs/browser/bugtask.py'
--- lib/lp/bugs/browser/bugtask.py	2011-01-28 00:55:02 +0000
+++ lib/lp/bugs/browser/bugtask.py	2011-01-31 15:29:06 +0000
@@ -220,6 +220,7 @@
     )
 from lp.bugs.interfaces.bugtask import (
     BugBranchSearch,
+    BugBlueprintSearch,
     BugTagsSearchCombinator,
     BugTaskImportance,
     BugTaskSearchParams,
@@ -2500,6 +2501,17 @@
             else:
                 data['linked_branches'] = BugBranchSearch.ALL
 
+            has_blueprints = data.get('has_blueprints', True)
+            has_no_blueprints = data.get('has_no_blueprints', True)
+            if has_blueprints and not has_no_blueprints:
+                data['linked_blueprints'] = (
+                    BugBlueprintSearch.BUGS_WITH_BLUEPRINTS)
+            elif not has_blueprints and has_no_blueprints:
+                data['linked_blueprints'] = (
+                    BugBlueprintSearch.BUGS_WITHOUT_BLUEPRINTS)
+            else:
+                data['linked_blueprints'] = BugBlueprintSearch.ALL
+
             # Filter appropriately if the user wants to restrict the
             # search to only bugs with no package information.
             has_no_package = data.pop("has_no_package", False)

=== modified file 'lib/lp/bugs/interfaces/bugtask.py'
--- lib/lp/bugs/interfaces/bugtask.py	2011-01-31 15:29:04 +0000
+++ lib/lp/bugs/interfaces/bugtask.py	2011-01-31 15:29:06 +0000
@@ -966,6 +966,12 @@
     has_no_branches = Bool(
         title=_('Show bugs without linked branches'), required=False,
         default=True)
+    has_blueprints = Bool(
+        title=_('Show bugs with linked blueprints'), required=False,
+        default=True)
+    has_no_blueprints = Bool(
+        title=_('Show bugs without linked blueprints'), required=False,
+        default=True)
 
 
 class IBugTaskSearch(IBugTaskSearchBase):

=== added file 'lib/lp/bugs/stories/bugtask-searches/xx-filter-by-linked-blueprints.txt'
--- lib/lp/bugs/stories/bugtask-searches/xx-filter-by-linked-blueprints.txt	1970-01-01 00:00:00 +0000
+++ lib/lp/bugs/stories/bugtask-searches/xx-filter-by-linked-blueprints.txt	2011-01-31 15:29:06 +0000
@@ -0,0 +1,65 @@
+Searching for bugs with linked blueprints
+-----------------------------------------
+
+Using the "advanced search" form, we can limit a bug task search to
+bugs that are linked to blueprints or to bugs that are not linked to
+any blueprints. Normally, both options are turned on.
+
+    >>> anon_browser.open(
+    ...     'http://bugs.launchpad.dev/firefox/+bugs?advanced=1')
+    >>> anon_browser.getControl(
+    ...     'Show bugs with linked blueprints').selected
+    True
+    >>> anon_browser.getControl(
+    ...     'Show bugs without linked blueprints').selected
+    True
+
+In this case all bugs are returned.
+
+    >>> from lp.bugs.tests.bug import print_bugtasks
+    >>> anon_browser.getControl('Search', index=1).click()
+    >>> print_bugtasks(anon_browser.contents)
+    5 Firefox install instructions should be complete    Critical New
+    4 Reflow problems with complex page layouts          Medium   New
+    1 Firefox does not support SVG                       Low      New
+
+When we uncheck 'Show bugs without linked blueprints', only bugs with
+linked blueprints are returned.
+
+    >>> anon_browser.open(
+    ...     'http://bugs.launchpad.dev/firefox/+bugs?advanced=1')
+    >>> without_blueprints = anon_browser.getControl(
+    ...     'Show bugs without linked blueprints')
+    >>> without_blueprints.selected = False
+    >>> anon_browser.getControl('Search', index=1).click()
+    >>> print_bugtasks(anon_browser.contents)
+    1 Firefox does not support SVG                       Low      New
+
+Similary, we can search for blueprints that don't have linked
+blueprints, if we uncheck 'Show bugs with linked blueprints'.
+
+    >>> anon_browser.open(
+    ...     'http://bugs.launchpad.dev/firefox/+bugs?advanced=1')
+    >>> with_blueprints = anon_browser.getControl(
+    ...     'Show bugs with linked blueprints')
+    >>> with_blueprints.selected = False
+    >>> anon_browser.getControl('Search', index=1).click()
+    >>> print_bugtasks(anon_browser.contents)
+    5 Firefox install instructions should be complete    Critical New
+    4 Reflow problems with complex page layouts          Medium   New
+
+If we uncheck both fields, all bugs are returned.
+
+    >>> anon_browser.open(
+    ...     'http://bugs.launchpad.dev/firefox/+bugs?advanced=1')
+    >>> with_blueprints = anon_browser.getControl(
+    ...     'Show bugs with linked blueprints')
+    >>> with_blueprints.selected = False
+    >>> without_blueprints = anon_browser.getControl(
+    ...     'Show bugs without linked blueprints')
+    >>> without_blueprints.selected = False
+    >>> anon_browser.getControl('Search', index=1).click()
+    >>> print_bugtasks(anon_browser.contents)
+    5 Firefox install instructions should be complete    Critical New
+    4 Reflow problems with complex page layouts          Medium   New
+    1 Firefox does not support SVG                       Low      New

=== modified file 'lib/lp/bugs/templates/bugtask-macros-tableview.pt'
--- lib/lp/bugs/templates/bugtask-macros-tableview.pt	2010-06-04 17:47:34 +0000
+++ lib/lp/bugs/templates/bugtask-macros-tableview.pt	2011-01-31 15:29:06 +0000
@@ -635,6 +635,26 @@
           <td>
           </td>
         </tr>
+        <tr>
+          <td style="white-space: nowrap">
+            <span tal:content="structure view/widgets/has_blueprints" />
+            <label style="font-weight: normal" for="field.has_blueprints">
+              Show bugs with linked blueprints
+            </label>
+          </td>
+          <td>
+          </td>
+        </tr>
+        <tr>
+          <td style="white-space: nowrap">
+            <span tal:content="structure view/widgets/has_no_blueprints" />
+            <label style="font-weight: normal" for="field.has_no_blueprints">
+              Show bugs without linked blueprints
+            </label>
+          </td>
+          <td>
+          </td>
+        </tr>
       </table>
 
     </fieldset>