Merge lp:~makyo/juju-gui/consistent-health-graph into lp:juju-gui/experimental

Proposed by Madison Scott-Clary
Status: Merged
Merged at revision: 190
Proposed branch: lp:~makyo/juju-gui/consistent-health-graph
Merge into: lp:juju-gui/experimental
Diff against target: 18 lines (+7/-1)
1 file modified
app/views/environment.js (+7/-1)
To merge this branch: bzr merge lp:~makyo/juju-gui/consistent-health-graph
Reviewer Review Type Date Requested Status
Juju GUI Hackers Pending
Review via email: mp+130005@code.launchpad.net

Description of the change

Service health graphs consistently rendered

d3 was sorting by the largest value, now sorts in the proper order: error - pending - running

https://codereview.appspot.com/6718048/

To post a comment you must log in.
Revision history for this message
Madison Scott-Clary (makyo) wrote :

Reviewers: mp+130005_code.launchpad.net,

Message:
Please take a look.

Description:
Service health graphs consistently rendered

d3 was sorting by the largest value, now sorts in the proper order:
error - pending - running

https://code.launchpad.net/~makyo/juju-gui/consistent-health-graph/+merge/130005

(do not edit description out of merge proposal)

Please review this at https://codereview.appspot.com/6718048/

Affected files:
   A [revision details]
   M app/views/environment.js

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
=== modified file 'app/views/environment.js'
--- app/views/environment.js 2012-10-15 19:22:40 +0000
+++ app/views/environment.js 2012-10-16 23:01:10 +0000
@@ -775,7 +775,13 @@
                });

            var status_chart_layout = d3.layout.pie()
- .value(function(d) { return (d.value ? d.value : 1); });
+ .value(function(d) { return (d.value ? d.value : 1); })
+ .sort(function(a, b) {
+ // Ensure that the service health graphs will be renders in
+ // the correct order: error - pending - running.
+ var states = {error: 0, pending: 1, running: 2};
+ return states[a.name] - states[b.name];
+ });

            // Append to status charts to non-subordinate services
            var status_chart = node.append('g')

Revision history for this message
Benjamin Saller (bcsaller) wrote :

LGTM

https://codereview.appspot.com/6718048/diff/1/app/views/environment.js
File app/views/environment.js (right):

https://codereview.appspot.com/6718048/diff/1/app/views/environment.js#newcode784
app/views/environment.js:784: });
This looks fine to me, can we however be sure those are the only three
states bubbling to this layer? I know that is supposed to be the case,
but should these ever come out of sync having a fallback value here
might make sense.

Probably fine for now though

https://codereview.appspot.com/6718048/

Revision history for this message
Madison Scott-Clary (makyo) wrote :

*** Submitted:

Service health graphs consistently rendered

d3 was sorting by the largest value, now sorts in the proper order:
error - pending - running

R=benjamin.saller
CC=
https://codereview.appspot.com/6718048

https://codereview.appspot.com/6718048/

Revision history for this message
Madison Scott-Clary (makyo) wrote :

*** Submitted:

Service health graphs consistently rendered

d3 was sorting by the largest value, now sorts in the proper order:
error - pending - running

R=
CC=
https://codereview.appspot.com/6718048

https://codereview.appspot.com/6718048/

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'app/views/environment.js'
2--- app/views/environment.js 2012-10-15 19:22:40 +0000
3+++ app/views/environment.js 2012-10-16 23:03:21 +0000
4@@ -775,7 +775,13 @@
5 });
6
7 var status_chart_layout = d3.layout.pie()
8- .value(function(d) { return (d.value ? d.value : 1); });
9+ .value(function(d) { return (d.value ? d.value : 1); })
10+ .sort(function(a, b) {
11+ // Ensure that the service health graphs will be renders in
12+ // the correct order: error - pending - running.
13+ var states = {error: 0, pending: 1, running: 2};
14+ return states[a.name] - states[b.name];
15+ });
16
17 // Append to status charts to non-subordinate services
18 var status_chart = node.append('g')

Subscribers

People subscribed via source and target branches