Merge lp:~makyo/juju-gui/adding-subordinates into lp:juju-gui/experimental
Status: | Merged | ||||
---|---|---|---|---|---|
Merged at revision: | 255 | ||||
Proposed branch: | lp:~makyo/juju-gui/adding-subordinates | ||||
Merge into: | lp:juju-gui/experimental | ||||
Diff against target: |
72 lines (+50/-1) 2 files modified
app/views/environment.js (+3/-1) test/test_environment_view.js (+47/-0) |
||||
To merge this branch: | bzr merge lp:~makyo/juju-gui/adding-subordinates | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Juju GUI Hackers | Pending | ||
Review via email: mp+135022@code.launchpad.net |
Description of the change
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.
Reviewers: mp+135022_ code.launchpad. net,
Message:
Please take a look.
Description:
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:/ /code.launchpad .net/~makyo/ juju-gui/ adding- subordinates/ +merge/ 135022
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/6856067/
Affected files: environment. js
A [revision details]
M app/views/
Index: [revision details]
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: <email address hidden>
+New revision: <email address hidden>
Index: app/views/ environment. js environment. js' environment. js 2012-11-19 19:52:43 +0000 environment. js 2012-11-20 00:06:25 +0000
this. vis = vis;
this. tree = d3.layout.pack()
.size( [width, height])
.padding( 300);
=== modified file 'app/views/
--- app/views/
+++ app/views/
@@ -318,7 +318,9 @@
- .value(function(d) {return d.unit_count;})
+ .value(function(d) {
+ return d.unit_count === 0 ? 1 : d.unit_count;
+ })