Merge lp:~rvb/launchpad/init-multiple-parents-packagesetpicker 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: | 13198 |
Proposed branch: | lp:~rvb/launchpad/init-multiple-parents-packagesetpicker |
Merge into: | lp:launchpad |
Diff against target: |
164 lines (+87/-5) 2 files modified
lib/lp/registry/javascript/distroseries.js (+28/-5) lib/lp/registry/javascript/tests/test_distroseries.js (+59/-0) |
To merge this branch: | bzr merge lp:~rvb/launchpad/init-multiple-parents-packagesetpicker |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jeroen T. Vermeulen (community) | Approve | ||
Review via email: mp+63775@code.launchpad.net |
Commit message
[r=jtv][bug=793603] Fix the packagesets widget on initseries page.
Description of the change
This branch fixes the packagesets widget on the +initseries page. The packagesets from a parent where not removed properly when the parent was removed from the parent picker widget.
= Q/A =
On DF:
- Create a new series
- Go to the initialisation page series/+initseries
- Add a parent with packagesets
- Make sure the parent's packagesets are added to the packagesets widget
- Remove the parent
- Make sure the packagesets from this parent are properly removed from the packagesets widget
= Tests =
lib/lp/
(testRemoveDist
To post a comment you must log in.
Hi Raphaël,
I really need some help with this. Without comments, I don't know what anything does and where it's tested! That makes it very hard for me to say anything more useful about the code than that it needs comments. I *think* there's a couple of bugs, but I'm not sure.
Let's have a look at the diff:
=== modified file 'lib/lp/ registry/ javascript/ distroseries. js' registry/ javascript/ distroseries. js 2011-06-01 10:31:05 +0000 registry/ javascript/ distroseries. js 2011-06-07 21:48:32 +0000
2 --- lib/lp/
3 +++ lib/lp/
15 @@ -1073,6 +1073,7 @@ packagesets, distroseries) { ts[distroseries .value] = packagesets. entries;
16 * @method add_packagesets
17 */
18 add_packagesets: function(
19 + this._packagese
What is distroseries exactly, and more to the point, what is distroseries.value? It would be helpful to have some documentation of the parameters. Is distroseries.value a distroseries id?
23 @@ -1095,9 +1096,12 @@ distroseries: function( distroseries_ id) { anim.green_ flash({ node: this.fieldNode} ).run() ; ts[distroseries _id].forEach( packageset) { get("id" ) + '"]').remove(); anim.green_ flash({ node: this.fieldNode} ).run() ;
24 * @method remove_distroseries
25 */
26 remove_
27 - this.fieldNode.all(
28 - 'option[value$="-' + distroseries_id + '"]').remove();
29 - Y.lazr.
30 + this._packagese
31 + function(
32 + this.fieldNode.all(
33 + 'option[value$="' + packageset.
34 + }, this);
35 + Y.lazr.
The new code looks like it may be slower. Could that be an issue?
I had a hard time understanding the this.fieldNode. all(). The old code looked for:
'option[ value$= "-' + distroseries_id + '"]'
As far as I can tell, that's a CSS3 selector for "value ends with a dash followed by distroseries_id." Is it safe for us to use CSS3 selectors? AFAICT CSS2 does not have $=.
The new code looks for:
'option[ value$= "' + packageset. get("id" ) + '"]'
That means "value ends with the packageset id." I may be misunderstanding it, but it looks wrong to me in two ways:
1. So what does that value end in — distroseries id or packageset id!?
2. What about spurious substring matches, e.g. won't this also remove "321" when you really want to remove only "21"?
39 @@ -1109,6 +1113,7 @@ handler. clearProgressUI = Y.bind( this.hideSpinne r, this); handler. showError = Y.bind( this.showError, this); display( );
40 this.error_
41 this.error_
42 this.clean_
43 + this._packagesets = {};
It would be helpful to say here what structure _packagesets will have, e.g. that it maps distroseries ids to arrays of packageset ids. We minify our JS, so comments won't slow the code down but they can save oodles of time in maintenance.
48 === modified file 'lib/lp/ registry/ javascript/ tests/test_ distroseries. js' registry/ javascript/ tests/test_ distroseries. js 2011-06-01 09:17:43 +0000 registry/ javascript/ tests/test_ distroseries. js 2011-06-07 21:48:32 +0000 "value" )(this. widget. get("choices" ))); oSer...
49 --- lib/lp/
50 +++ lib/lp/
51 @@ -854,6 +854,48 @@
52 attrselect(
53 },
54
55 + testRemoveDistr