Merge lp:~hatch/juju-gui/agent-data-support into lp:juju-gui/experimental

Proposed by Jeff Pihach
Status: Merged
Merged at revision: 1205
Proposed branch: lp:~hatch/juju-gui/agent-data-support
Merge into: lp:juju-gui/experimental
Diff against target: 325 lines (+31/-170)
9 files modified
app/models/handlers.js (+3/-1)
app/models/models.js (+3/-1)
app/store/env/sandbox.js (+2/-1)
app/templates/unit.handlebars (+0/-116)
app/templates/unitOverview.handlebars (+1/-0)
app/views/utils.js (+0/-12)
app/views/viewlets/unit-details.js (+13/-0)
lib/views/juju-inspector.less (+9/-6)
test/test_utils.js (+0/-33)
To merge this branch: bzr merge lp:~hatch/juju-gui/agent-data-support
Reviewer Review Type Date Requested Status
Juju GUI Hackers Pending
Review via email: mp+195896@code.launchpad.net

Description of the change

Adds agent_state_data(SourceData) support

The simulator and juju-core return SourceData along with any
error messages. These are now displayed in the unit details
left breakout panel in the new inspector.

I also removed an unused template from the old inspectors and
modified some css to make the left panel react properly to
varying unit detail header heights.

https://codereview.appspot.com/29400043/

To post a comment you must log in.
Revision history for this message
Jeff Pihach (hatch) wrote :

Reviewers: mp+195896_code.launchpad.net,

Message:
Please take a look.

Description:
Adds agent_state_data(SourceData) support

The simulator and juju-core return SourceData along with any
error messages. These are now displayed in the unit details
left breakout panel in the new inspector.

I also removed an unused template from the old inspectors and
modified some css to make the left panel react properly to
varying unit detail header heights.

I have tested it's functionality on LXC and the sandbox

To QA:
On sandbox
Deploy any two relatable services with a number of units
Relate the two services and wait until there are unit errors
Clicking on a unit in the inspector should show the ServiceData
below the ServiceInfo which is always there.
For best results look for a unit with a relation error.

On real env
Deploy two services (with different names) of failtester with
one with the 'relation-changed' configuration option set to 'true'.
Once both services turn green, relate them.
After a few seconds the one should turn red.
Clicking on it's errored unit should show the ServiceData relation
error information in the left details panel.

https://code.launchpad.net/~hatch/juju-gui/agent-data-support/+merge/195896

(do not edit description out of merge proposal)

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

Affected files (+33, -170 lines):
   A [revision details]
   M app/models/handlers.js
   M app/models/models.js
   M app/store/env/sandbox.js
   D app/templates/unit.handlebars
   M app/templates/unitOverview.handlebars
   M app/views/utils.js
   M app/views/viewlets/unit-details.js
   M lib/views/juju-inspector.less
   M test/test_utils.js

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

Code's good, will see about QA later unless someone else snags it.

https://codereview.appspot.com/29400043/

Revision history for this message
Gary Poster (gary) wrote :

On 2013/11/20 01:32:00, matthew.scott wrote:
> Code's good, will see about QA later unless someone else snags it.

QA OK

https://codereview.appspot.com/29400043/

Revision history for this message
Gary Poster (gary) wrote :

On 2013/11/20 14:56:52, gary.poster wrote:
> On 2013/11/20 01:32:00, matthew.scott wrote:
> > Code's good, will see about QA later unless someone else snags it.

> QA OK

sandbox that is

https://codereview.appspot.com/29400043/

Revision history for this message
Jeff Pihach (hatch) wrote :

*** Submitted:

Adds agent_state_data(SourceData) support

The simulator and juju-core return SourceData along with any
error messages. These are now displayed in the unit details
left breakout panel in the new inspector.

I also removed an unused template from the old inspectors and
modified some css to make the left panel react properly to
varying unit detail header heights.

R=matthew.scott, gary.poster
CC=
https://codereview.appspot.com/29400043

https://codereview.appspot.com/29400043/

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'app/models/handlers.js'
2--- app/models/handlers.js 2013-10-10 04:47:56 +0000
3+++ app/models/handlers.js 2013-11-20 01:27:03 +0000
4@@ -162,6 +162,7 @@
5 machine: change.MachineId,
6 agent_state: change.Status,
7 agent_state_info: change.StatusInfo,
8+ agent_state_data: change.StatusData,
9 public_address: change.PublicAddress,
10 private_address: change.PrivateAddress,
11 open_ports: utils.convertOpenPorts(change.Ports)
12@@ -246,7 +247,8 @@
13 id: change.Id,
14 instance_id: change.InstanceId,
15 agent_state: change.Status,
16- agent_state_info: change.StatusInfo
17+ agent_state_info: change.StatusInfo,
18+ agent_state_data: change.StatusData
19 };
20 db.machines.process_delta(action, data);
21 },
22
23=== modified file 'app/models/models.js'
24--- app/models/models.js 2013-10-31 17:19:16 +0000
25+++ app/models/models.js 2013-11-20 01:27:03 +0000
26@@ -489,6 +489,7 @@
27 machine: {},
28 agent_state: {},
29 agent_state_info: {},
30+ agent_state_data: {},
31 // This is empty if there are no relation errors, and otherwise
32 // shows only the relations with errors. The data structure in that
33 // case is a hash mapping a local relation name to a list of services
34@@ -651,7 +652,8 @@
35 public_address: {},
36 instance_id: {},
37 agent_state: {},
38- agent_state_info: {}
39+ agent_state_info: {},
40+ agent_state_data: {}
41 }
42 });
43 models.Machine = Machine;
44
45=== modified file 'app/store/env/sandbox.js'
46--- app/store/env/sandbox.js 2013-10-31 16:35:27 +0000
47+++ app/store/env/sandbox.js 2013-11-20 01:27:03 +0000
48@@ -885,7 +885,8 @@
49 MachineId: 'machine',
50 Ports: 'open_ports',
51 Status: 'agent_state',
52- StatusInfo: 'agent_state_info'
53+ StatusInfo: 'agent_state_info',
54+ StatusData: 'agent_state_data'
55 },
56 relation: {
57 Key: 'relation_id',
58
59=== removed file 'app/templates/unit.handlebars'
60--- app/templates/unit.handlebars 2013-04-15 15:45:18 +0000
61+++ app/templates/unit.handlebars 1970-01-01 00:00:00 +0000
62@@ -1,116 +0,0 @@
63-<div class="yui3-g">
64- <div class="well yui3-u-1">
65- <div class="unit-button-palette">
66- <form>
67- {{#if hasErrors}}
68- <button type="button" class="btn" id="resolved-unit-button">Resolved</button>
69- <button type="button" class="btn" id="retry-unit-button">Retry</button>
70- {{/if}}
71- <button type="button" {{#if disabled_remove}}disabled="true"{{/if}}
72- class="btn" id="remove-unit-button">Remove</button>
73- </form>
74- </div>
75- <h1 id="unit-id">{{unit.displayName}} {{landscapeBadge landscape unit 'reboot' 'round'}}{{landscapeBadge landscape unit 'security' 'round'}}</h1>
76- <b id="charm-uri">
77- <a href="{{charmUri}}">{{charm.id}}</a>
78- </span>
79- {{#if unit.is_subordinate}} (subordinate){{/if}}
80- <div id="unit-status">
81- {{unit_ip_description}}
82- {{#unit_ip_description}}|{{/unit_ip_description}}
83- {{#if isRunning}}
84- <span class="running">&#x25B6;</span>
85- {{/if}}
86- {{#if isPending}}
87- <span class="pending">&#x2b24;</span>
88- {{/if}}
89- {{#if hasErrors}}
90- <span class="error">&#x2b1b;</span>
91- {{/if}}
92- {{showStatus unit}}
93- </div>
94- </div>
95-<div>
96-
97-<div class="yui3-g">
98- <div class="yui3-u-1">
99- <h2 id="machine-name">&#x2637; Machine {{unit.machine}}</h2>
100- <table class="table table-striped table-bordered">
101- <tbody>
102- <tr>
103- <th>agent-state</th>
104- <td id="machine-agent-state">{{showStatus machine}}</td>
105- </tr>
106- <tr>
107- <th>instance-id</th>
108- <td id="machine-instance-id">{{machine.instance_id}}</td>
109- </tr>
110- <tr>
111- <th>public-address</th>
112- <td id="machine-public-address">{{machine.public_address}}</td>
113- </tr>
114- </tbody>
115- </table>
116- </div>
117-</div>
118-
119-{{#unless relations}}
120-<div class="yui3-u">This unit has no relations.</div>
121-{{else}}
122-<div id="relations" class="yui3-g">
123- <div class="yui3-u-1">
124- <h2>&#x26B9; Relations</h2>
125- <table class="table table-striped table-bordered">
126- <thead>
127- <tr>
128- <th>id</th>
129- <th>endpoint</th>
130- <th>name</th>
131- <th>role</th>
132- <th>scope</th>
133- <th>status</th>
134- </tr>
135- </thead>
136- <tbody>
137- {{#relations}}
138- <tr {{#if highlight}}class="highlighted" {{/if}}id="{{elementId}}">
139- <td class="relation-ident">{{ident}}</td>
140- <td class="relation-endpoint">
141- {{#if far}}
142- <a href="{{../../serviceRootUri}}{{far.service}}/relations">{{far.service}}</a>
143- {{else}}
144- (self)
145- {{/if}}
146- </td>
147- <td class="relation-name">{{near.name}}</td>
148- <td class="relation-role">{{near.role}}</td>
149- <td class="relation-scope">{{scope}}</td>
150- <td class="relation-status">
151- {{#if has_error}}
152- <span class="error">&#x2b1b;</span> error
153- <div class="unit-button-palette">
154- <form id="{{near.name}}">
155- <button type="button" class="btn resolved-relation-button"
156- value="{{relation_id}}">Resolved</button>
157- <button type="button" class="btn retry-relation-button"
158- value="{{relation_id}}">Retry</button>
159- </form>
160- </div>
161- {{/if}}
162- </td>
163- </tr>
164- {{/relations}}
165- </tbody>
166- </table>
167- </div>
168-</div>
169-{{/unless}}
170-<div class="yui3-g">
171- <div class="bottom-navbar">
172- {{> landscape-controls }}
173- </div>
174-</div>
175-
176-<div id="resolved-modal-panel"></div>
177-<div id="remove-modal-panel"></div>
178-<div id="resolved-relation-modal-panel"></div>
179
180=== modified file 'app/templates/unitOverview.handlebars'
181--- app/templates/unitOverview.handlebars 2013-09-24 21:10:50 +0000
182+++ app/templates/unitOverview.handlebars 2013-11-20 01:27:03 +0000
183@@ -5,6 +5,7 @@
184 <li>IP Address: <span data-bind="private_address"></span></li>
185 <li>Status: <span data-bind="agent_state"></span></li>
186 <li data-bind="agent_state_info">Status Info: <span></span></li>
187+ <li data-bind="agent_state_data">Status Data: <ul></ul></li>
188 <li>Public Address: <span data-bind="public_address"></span></li>
189 <li data-bind="annotations.landscape-computer">
190 <a class="landscape" target="_blank">Open Landscape</a>
191
192=== modified file 'app/views/utils.js'
193--- app/views/utils.js 2013-11-19 16:45:52 +0000
194+++ app/views/utils.js 2013-11-20 01:27:03 +0000
195@@ -1489,18 +1489,6 @@
196 return agent_state;
197 });
198
199- /*
200- * Show the status and, if present, the status info of the given db instance.
201- */
202- Y.Handlebars.registerHelper('showStatus', function(instance) {
203- // The "instance" argument is typically a unit or a machine model instance.
204- var result = instance.agent_state;
205- if (instance.agent_state_info) {
206- result += ': ' + instance.agent_state_info;
207- }
208- return result;
209- });
210-
211 Y.Handlebars.registerHelper('any', function() {
212 var conditions = Y.Array(arguments, 0, true),
213 options = conditions.pop();
214
215=== modified file 'app/views/viewlets/unit-details.js'
216--- app/views/viewlets/unit-details.js 2013-10-10 14:05:58 +0000
217+++ app/views/viewlets/unit-details.js 2013-11-20 01:27:03 +0000
218@@ -96,6 +96,19 @@
219 }
220 }
221 },
222+ agent_state_data: {
223+ 'update': function(node, value) {
224+ if (value) {
225+ var data = '';
226+ Object.keys(value).forEach(function(key) {
227+ data += '<li>' + key + ': ' + value[key] + '</li>';
228+ });
229+ node.one('ul').setHTML(data);
230+ } else {
231+ node.hide();
232+ }
233+ }
234+ },
235 'annotations.landscape-computer': {
236 'update': function(node, value) {
237 if (value) {
238
239=== modified file 'lib/views/juju-inspector.less'
240--- lib/views/juju-inspector.less 2013-11-12 23:17:39 +0000
241+++ lib/views/juju-inspector.less 2013-11-20 01:27:03 +0000
242@@ -35,14 +35,16 @@
243 @keyframes pulse-green {.pulse-green-frames-mixin;}
244
245 .yui3-juju-inspector {
246+ top: 20px;
247+ right: 70px;
248+ position: absolute;
249+
250 .customize-scrollbar;
251
252 .left-breakout {
253 .type9;
254- top: 20px;
255- bottom: 70px;
256 left: auto;
257- right: @inspector-width + 71px;
258+ right: @inspector-width;
259
260 .charm .yui3-tabview {
261 margin-top: 30px;
262@@ -72,15 +74,16 @@
263 }
264 }
265 }
266+ li ul {
267+ margin-left: 20px;
268+ }
269 }
270 }
271
272 .juju-inspector {
273 .create-border-radius(@border-radius);
274- position: absolute;
275+ position: relative;
276 z-index: 500;
277- top: 20px;
278- right: 70px;
279 width: @inspector-width;
280 min-height: 100px;
281 border: 0;
282
283=== modified file 'test/test_utils.js'
284--- test/test_utils.js 2013-11-13 20:00:38 +0000
285+++ test/test_utils.js 2013-11-20 01:27:03 +0000
286@@ -1169,39 +1169,6 @@
287 assert.equal('is empty', html);
288 });
289
290- describe('showStatus', function() {
291- var html, obj, template;
292-
293- before(function() {
294- template = Y.Handlebars.compile('{{showStatus instance}}');
295- });
296-
297- beforeEach(function() {
298- obj = {agent_state: 'started'};
299- });
300-
301- it('shows the instance status correctly', function() {
302- html = template({instance: obj});
303- assert.strictEqual(obj.agent_state, html);
304- });
305-
306- it('avoids including status info if not present', function() {
307- [undefined, null, ''].forEach(function(info) {
308- obj.agent_state_info = info;
309- html = template({instance: obj});
310- assert.strictEqual(obj.agent_state, html, 'info: ' + info);
311- });
312- });
313-
314- it('includes status info if present', function() {
315- obj.agent_state_info = 'some information';
316- html = template({instance: obj});
317- var expected = obj.agent_state + ': ' + obj.agent_state_info;
318- assert.strictEqual(expected, html);
319- });
320-
321- });
322-
323 describe('if_eq tests', function() {
324
325 it('outputs success when equal', function() {

Subscribers

People subscribed via source and target branches