Merge lp:~rvb/launchpad/dds-req-packagediff-fix-flashing into lp:launchpad

Proposed by Raphaël Badin
Status: Merged
Approved by: Raphaël Badin
Approved revision: no longer in the source branch.
Merged at revision: 12719
Proposed branch: lp:~rvb/launchpad/dds-req-packagediff-fix-flashing
Merge into: lp:launchpad
Diff against target: 134 lines (+45/-18)
4 files modified
lib/lp/registry/javascript/distroseriesdifferences_details.js (+5/-10)
lib/lp/registry/javascript/tests/test_distroseriesdifferences_details.html (+5/-3)
lib/lp/registry/javascript/tests/test_distroseriesdifferences_details.js (+31/-4)
lib/lp/registry/templates/distroseriesdifference-listing-extra.pt (+4/-1)
To merge this branch: bzr merge lp:~rvb/launchpad/dds-req-packagediff-fix-flashing
Reviewer Review Type Date Requested Status
j.c.sackett (community) Approve
Review via email: mp+55775@code.launchpad.net

Commit message

[r=jcsackett][bug=746277] Fix the retry link to request package diffs on localpackagediffs page.

Description of the change

This branch fixes the retry link to request package diffs so that removing the link removes all the js listeners.

== Summary ==
On the +localpackagediffs page, when a package diff fails, a retry link is displayed. The listener was not properly cleared so it seemed that the clickable zone of this retry link was far too wide. This branch refactors the way the initial link is added so that removing it clears all the js listeners.

== Tests ==
lib/lp/registry/javascript/tests/test_distroseriesdifferences_details.html

== QA ==
On a failing package diff request (https://dogfood.launchpad.net/deribuntu/dangerous/+localpackagediffs), make sure than the Retry click listener is limited to the word "Retry".

To post a comment you must log in.
Revision history for this message
j.c.sackett (jcsackett) wrote :

As I said in IRC, it could be worth getting a UI person to validate your decision not to have the red flash animation anymore. I think you're notion of already getting instant feedback is correct--it's your call if you think you should get UI checks on it too.

Otherwise, this looks good. Thanks.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/lp/registry/javascript/distroseriesdifferences_details.js'
--- lib/lp/registry/javascript/distroseriesdifferences_details.js 2011-03-28 16:33:48 +0000
+++ lib/lp/registry/javascript/distroseriesdifferences_details.js 2011-03-31 15:43:56 +0000
@@ -457,7 +457,7 @@
457*/457*/
458namespace.setup_request_derived_diff = function(container, dsd_link) {458namespace.setup_request_derived_diff = function(container, dsd_link) {
459 // Setup handler for diff requests.459 // Setup handler for diff requests.
460 container.one('.package-diff-placeholder').on('click', function(e) {460 container.one('.package-diff-compute-request').on('click', function(e) {
461 e.preventDefault();461 e.preventDefault();
462 compute_package_diff(container, dsd_link);462 compute_package_diff(container, dsd_link);
463 });463 });
@@ -511,7 +511,7 @@
511 };511 };
512 var failure_cb = function(transaction_id, response, args) {512 var failure_cb = function(transaction_id, response, args) {
513 container.one('p.update-in-progress-message').remove();513 container.one('p.update-in-progress-message').remove();
514 var retry_handler = function(e) {514 var recompute = function(e) {
515 e.preventDefault();515 e.preventDefault();
516 compute_package_diff(container, dsd_link);516 compute_package_diff(container, dsd_link);
517 };517 };
@@ -519,20 +519,15 @@
519 var msg = response.responseText;519 var msg = response.responseText;
520520
521 // If the error is not of the type raised by an error properly521 // If the error is not of the type raised by an error properly
522 // raisedby python then set a standard error message.522 // raised by python then set a standard error message.
523 if (response.status !== 400) {523 if (response.status !== 400) {
524 msg = 'Failed to compute package diff.';524 msg = 'Failed to compute package diff.';
525 }525 }
526 var failure_msg = Y.lp.soyuz.base.makeFailureNode(526 var failure_msg = Y.lp.soyuz.base.makeFailureNode(
527 Y.Escape.html(msg), retry_handler);527 Y.Escape.html(msg), recompute);
528 var placeholder = container.one('.package-diff-placeholder')528 var placeholder = container.one('.package-diff-placeholder');
529 placeholder.set('innerHTML','');529 placeholder.set('innerHTML','');
530 placeholder.appendChild(failure_msg);530 placeholder.appendChild(failure_msg);
531
532 var anim = Y.lazr.anim.red_flash({
533 node: placeholder
534 });
535 anim.run();
536 };531 };
537 var config = {532 var config = {
538 on: {533 on: {
539534
=== modified file 'lib/lp/registry/javascript/tests/test_distroseriesdifferences_details.html'
--- lib/lp/registry/javascript/tests/test_distroseriesdifferences_details.html 2011-03-28 20:45:09 +0000
+++ lib/lp/registry/javascript/tests/test_distroseriesdifferences_details.html 2011-03-31 15:43:56 +0000
@@ -42,9 +42,11 @@
42 evolution</a>42 evolution</a>
43 <span class="package-diff-button"></span>43 <span class="package-diff-button"></span>
44 <dt class="package-diff-placeholder">44 <dt class="package-diff-placeholder">
45 <a class="js-action sprite add" href="#">45 <span class="package-diff-compute-request">
46 Compute differences from last common version:46 <a class="js-action sprite add" href="">
47 </a></dt>47 Compute differences from last common version:
48 </a>
49 </span></dt>
48 <dd>50 <dd>
49 <ul class="package-diff-status">51 <ul class="package-diff-status">
50 <li>52 <li>
5153
=== modified file 'lib/lp/registry/javascript/tests/test_distroseriesdifferences_details.js'
--- lib/lp/registry/javascript/tests/test_distroseriesdifferences_details.js 2011-03-28 21:32:35 +0000
+++ lib/lp/registry/javascript/tests/test_distroseriesdifferences_details.js 2011-03-31 15:43:56 +0000
@@ -75,10 +75,37 @@
75 config.on.success(completed_voc);75 config.on.success(completed_voc);
76 }76 }
77 };77 };
78
79 dsd_details.poll_interval = 2000;78 dsd_details.poll_interval = 2000;
8079 },
81 },80
81 test_request_wrong_click: function() {
82 // Click on the placeholder has no effect.
83 // The listeners are on the the link with class
84 // '.package-diff-compute-request'.
85 // bug=746277.
86 var placeholder = Y.one('#placeholder');
87 placeholder.set('innerHTML', placeholder_content);
88 placeholder
89 .one('#derived')
90 .removeClass('PENDING')
91 .addClass('FAILED');
92 dsd_details.setup_packages_diff_states(
93 placeholder.one('.diff-extra-container'), dsd_uri);
94 var func_req = undefined;
95 var lp_prot = Y.lp.client.Launchpad.prototype;
96 lp_prot.named_post = function(url, func, config) {
97 func_req = func;
98 config.on.success();
99 };
100
101 var wrong_button = placeholder.one('.package-diff-placeholder');
102
103 wrong_button.simulate('click');
104 var package_diff = Y.one('#parent');
105
106 // The request has not been triggered.
107 Assert.isTrue(package_diff.hasClass('request-derived-diff'));
108 },
82109
83 test_request_package_diff_computation: function() {110 test_request_package_diff_computation: function() {
84 // A click on the button changes the package diff status and requests111 // A click on the button changes the package diff status and requests
@@ -98,7 +125,7 @@
98 config.on.success();125 config.on.success();
99 };126 };
100127
101 var button = Y.one('.package-diff-placeholder');128 var button = placeholder.one('.package-diff-compute-request');
102129
103 button.simulate('click');130 button.simulate('click');
104 var package_diff = Y.one('#parent');131 var package_diff = Y.one('#parent');
105132
=== modified file 'lib/lp/registry/templates/distroseriesdifference-listing-extra.pt'
--- lib/lp/registry/templates/distroseriesdifference-listing-extra.pt 2011-03-31 05:54:22 +0000
+++ lib/lp/registry/templates/distroseriesdifference-listing-extra.pt 2011-03-31 15:43:56 +0000
@@ -42,7 +42,10 @@
42 <dt42 <dt
43 tal:condition="python: not(context.package_diff) or not(context.parent_package_diff)"43 tal:condition="python: not(context.package_diff) or not(context.parent_package_diff)"
44 class="package-diff-placeholder">44 class="package-diff-placeholder">
45 <a class="js-action sprite add" href="#">Compute differences from last common version</a>:45 <span class="package-diff-compute-request">
46 <a class="js-action sprite add" href="">
47 Compute differences from last common version</a>:
48 </span>
46 </dt>49 </dt>
47 <dt50 <dt
48 tal:condition="python: context.package_diff and context.parent_package_diff">51 tal:condition="python: context.package_diff and context.parent_package_diff">