Merge lp:~gmb/launchpad/scars-of-ajax-dupefinding into lp:launchpad

Proposed by Graham Binns
Status: Merged
Merged at revision: not available
Proposed branch: lp:~gmb/launchpad/scars-of-ajax-dupefinding
Merge into: lp:launchpad
Prerequisite: lp:~gmb/launchpad/taste-the-blood-of-ajax-dupefinding
Diff against target: 70 lines (+12/-19)
3 files modified
lib/canonical/launchpad/javascript/bugs/filebug-dupefinder.js (+5/-3)
lib/lp/bugs/browser/bugtarget.py (+0/-7)
lib/lp/bugs/templates/bugtarget-filebug-search.pt (+7/-9)
To merge this branch: bzr merge lp:~gmb/launchpad/scars-of-ajax-dupefinding
Reviewer Review Type Date Requested Status
Abel Deuring (community) code Approve
Canonical Launchpad Engineering code js Pending
Review via email: mp+16009@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Graham Binns (gmb) wrote :

This branch enables the async dupesearch for packages and distros.

I've done this by:

 - Removing the use_async_dupefinder property from FileBugViewBase and
   the bugtarget-filebug-search template, since it's no longer needed.
 - Updating the JS in filebug-dupefinder.js to make sure that the onChange
   handler that calls reload_filebug_form() only gets called when the project
   field gets changed (without this change it gets called when the package
   field is changed, too, which makes no sense).

Revision history for this message
Abel Deuring (adeuring) :
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/javascript/bugs/filebug-dupefinder.js'
2--- lib/canonical/launchpad/javascript/bugs/filebug-dupefinder.js 2009-12-11 11:39:14 +0000
3+++ lib/canonical/launchpad/javascript/bugs/filebug-dupefinder.js 2009-12-11 11:39:14 +0000
4@@ -349,9 +349,11 @@
5
6 // If there's a product field, hook it up to the
7 // reload_filebug_form() function.
8- Y.on('change', function(e) {
9- reload_filebug_form();
10- }, Y.DOM.byId('field.product'));
11+ var product_field = Y.one(Y.DOM.byId('field.product'));
12+ if (Y.Lang.isValue(product_field)) {
13+ Y.log(product_field);
14+ product_field.on('change', reload_filebug_form);
15+ }
16
17 // Update the label on the search button so that it no longer
18 // says "Continue".
19
20=== modified file 'lib/lp/bugs/browser/bugtarget.py'
21--- lib/lp/bugs/browser/bugtarget.py 2009-12-11 11:39:14 +0000
22+++ lib/lp/bugs/browser/bugtarget.py 2009-12-11 11:39:14 +0000
23@@ -360,13 +360,6 @@
24 if 'field.actions' in key] != [] or
25 self.user.inTeam(bug_supervisor))
26
27- @property
28- def use_asynchronous_dupefinder(self):
29- """Return True if the asynchronous dupe finder can be used."""
30- return (
31- IProduct.providedBy(self.context) or
32- IProject.providedBy(self.context))
33-
34 def getPackageNameFieldCSSClass(self):
35 """Return the CSS class for the packagename field."""
36 if self.widget_errors.get("packagename"):
37
38=== modified file 'lib/lp/bugs/templates/bugtarget-filebug-search.pt'
39--- lib/lp/bugs/templates/bugtarget-filebug-search.pt 2009-12-11 11:39:14 +0000
40+++ lib/lp/bugs/templates/bugtarget-filebug-search.pt 2009-12-11 11:39:14 +0000
41@@ -14,14 +14,12 @@
42 tal:define="lp_js string:${icingroot}/build"
43 tal:attributes="src string:${lp_js}/bugs/filebug-dupefinder.js"></script>
44
45- <tal:dupe-finder-js condition="view/use_asynchronous_dupefinder">
46- <script type="text/javascript">
47- LPS.use(
48- 'base', 'node', 'oop', 'event', 'bugs.dupe_finder', function(Y) {
49- Y.bugs.setup_dupe_finder();
50- });
51- </script>
52- </tal:dupe-finder-js>
53+ <script type="text/javascript">
54+ LPS.use(
55+ 'base', 'node', 'oop', 'event', 'bugs.dupe_finder', function(Y) {
56+ Y.bugs.setup_dupe_finder();
57+ });
58+ </script>
59 </metal:block>
60
61 <div metal:fill-slot="heading">
62@@ -116,7 +114,7 @@
63 <div id="filebug-form-container" style="display: none;">
64 </div>
65
66- <p style="display: none" tal:condition="view/use_asynchronous_dupefinder">
67+ <p style="display: none">
68 <a id="filebug-base-url"
69 tal:attributes="href view/inline_filebug_base_url"></a>
70 <a id="filebug-form-url"