Matthew Scott has proposed merging lp:~makyo/juju-gui/adding-subordinates into
lp:juju-gui.
Requested reviews:
Juju GUI Hackers (juju-gui)
Related bugs:
Bug #1080896 in juju-gui: "New subordinate services not created properly"
https://bugs.launchpad.net/juju-gui/+bug/1080896
For more details, see:
https://code.launchpad.net/~makyo/juju-gui/adding-subordinates/+merge/135022
Fix initial creation of subordinates.
When creating a subordinate service initially, it was not being laid out
properly by the pack layout, nor was it seeming to have drag events attached.
Pack layout was expecting a value accessor function to return some number
greater than zero when constructing its radius, which informs the x/y
coordinates. Returning zero results in NaN for all three values, thus
positioning the service at (0,0) and causing drag events to fail when updating
the service's coordinates with dx/dy + NaN. This branch fixes this by ensuring
that zero is never returned as the node's value. This fix is quick and
intended to make the UI function with the current layout algorithm. Future
layout algorithms, if they're designed by hand, will need to keep this in mind
as well.
https://codereview.appspot.com/6856067/
--
https://code.launchpad.net/~makyo/juju-gui/adding-subordinates/+merge/135022
Your team Juju GUI Hackers is requested to review the proposed merge of
lp:~makyo/juju-gui/adding-subordinates into lp:juju-gui.
=== modified file 'app/views/environment.js'
--- app/views/environment.js 2012-11-19 19:52:43 +0000
+++ app/views/environment.js 2012-11-20 00:13:22 +0000
@@ -318,7 +318,9 @@
this.vis = vis;
this.tree = d3.layout.pack()
.size([width, height])
- .value(function(d) {return d.unit_count;})
+ .value(function(d) {
+ return d.unit_count === 0 ? 1 : d.unit_count;
+ })
.padding(300);
this.updateCanvas();
--
Mailing list: https://launchpad.net/~yellow
Post to : [email protected]
Unsubscribe : https://launchpad.net/~yellow
More help : https://help.launchpad.net/ListHelp