Merge lp:~frankban/juju-gui/bug-1075679-charm-config-panel into lp:juju-gui/experimental

Proposed by Francesco Banconi
Status: Merged
Merged at revision: 234
Proposed branch: lp:~frankban/juju-gui/bug-1075679-charm-config-panel
Merge into: lp:juju-gui/experimental
Diff against target: 409 lines (+119/-68)
4 files modified
app/templates/charm-pre-configuration.handlebars (+9/-9)
app/views/charm-panel.js (+44/-3)
lib/views/stylesheet.less (+66/-52)
undocumented (+0/-4)
To merge this branch: bzr merge lp:~frankban/juju-gui/bug-1075679-charm-config-panel
Reviewer Review Type Date Requested Status
Juju GUI Hackers Pending
Review via email: mp+133657@code.launchpad.net

Description of the change

Charm config panel visual design fixes.

The charm configuration panel now should match UX wireframe.
This branch also contains fixes to the configuration
section hiding when a config file is uploaded.
Also introduced LESS mixins for border radii and box shadows.
Added "docstrings" to relevant charm panel methods.

https://codereview.appspot.com/6827066/

To post a comment you must log in.
Revision history for this message
Francesco Banconi (frankban) wrote :

Reviewers: mp+133657_code.launchpad.net,

Message:
Please take a look.

Description:
Charm config panel visual design fixes.

The charm configuration panel now should match UX wireframe.
This branch also contains fixes to the configuration
section hiding when a config file is uploaded.
Also introduced LESS mixins for border radii and box shadows.
Added "docstrings" to relevant charm panel methods.

https://code.launchpad.net/~frankban/juju-gui/bug-1075679-charm-config-panel/+merge/133657

(do not edit description out of merge proposal)

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

Affected files:
   A [revision details]
   M app/templates/charm-pre-configuration.handlebars
   M app/views/charm-panel.js
   M lib/views/stylesheet.less
   M undocumented

Revision history for this message
Brad Crittenden (bac) wrote :

Nice changes Francesco.

I think the config file button still needs some attention. I find it
odd that it isn't part of the collapsible div and remains visible when
Service Settings is collapsed. Did you discuss that UX with Matt or
Jovan? Of course I defer to them but think it currently looks funny.

Also, when a file is chosen, Service Settings collapses but the chevron
still points down. Further you can click on it and the chevron changes
but nothing else happens. I guess it'd be nice to collapse, set the
chevron to up, and lock it in place.

https://codereview.appspot.com/6827066/diff/1/app/views/charm-panel.js
File app/views/charm-panel.js (right):

https://codereview.appspot.com/6827066/diff/1/app/views/charm-panel.js#newcode601
app/views/charm-panel.js:601: */
Nice, thanks.

https://codereview.appspot.com/6827066/diff/1/lib/views/stylesheet.less
File lib/views/stylesheet.less (right):

https://codereview.appspot.com/6827066/diff/1/lib/views/stylesheet.less#newcode43
lib/views/stylesheet.less:43:
Thanks! Maybe 'set-' instead of 'create-' for both?

https://codereview.appspot.com/6827066/diff/1/lib/views/stylesheet.less#newcode987
lib/views/stylesheet.less:987: padding-left: 5px;
The vis design shows this lined up with the other elements and the charm
icon up top. I think the padding-left should be 11px.

Good to see you and Matt discussing it.

And as I mentioned in IRC we should decide on one value and apply it to
all charm panels, abstracting it into a LESS variable.

https://codereview.appspot.com/6827066/diff/1/undocumented
File undocumented (left):

https://codereview.appspot.com/6827066/diff/1/undocumented#oldcode82
undocumented:82: app/views/charm-panel.js render
yay

https://codereview.appspot.com/6827066/

237. By Francesco Banconi

Fixes per review.

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

Great changes, Francesco! No suggestions or requests. Thanks!

Gary

https://codereview.appspot.com/6827066/diff/2002/app/views/charm-panel.js
File app/views/charm-panel.js (right):

https://codereview.appspot.com/6827066/diff/2002/app/views/charm-panel.js#newcode600
app/views/charm-panel.js:600: * @return {undefined} Dispatches only.
Awesome. Thank you for this and the other docs

https://codereview.appspot.com/6827066/diff/2002/lib/views/stylesheet.less
File lib/views/stylesheet.less (right):

https://codereview.appspot.com/6827066/diff/2002/lib/views/stylesheet.less#newcode1
lib/views/stylesheet.less:1: /* Processed with LESS from
lib/views/stylesheet.less */
Great changes here, Francesco.

https://codereview.appspot.com/6827066/diff/2002/undocumented
File undocumented (left):

https://codereview.appspot.com/6827066/diff/2002/undocumented#oldcode81
undocumented:81: app/views/charm-panel.js onFileRemove
Thank you!

https://codereview.appspot.com/6827066/

Revision history for this message
Francesco Banconi (frankban) wrote :

*** Submitted:

Charm config panel visual design fixes.

The charm configuration panel now should match UX wireframe.
This branch also contains fixes to the configuration
section hiding when a config file is uploaded.
Also introduced LESS mixins for border radii and box shadows.
Added "docstrings" to relevant charm panel methods.

R=bac, gary.poster
CC=
https://codereview.appspot.com/6827066

https://codereview.appspot.com/6827066/

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'app/templates/charm-pre-configuration.handlebars'
2--- app/templates/charm-pre-configuration.handlebars 2012-11-07 14:40:38 +0000
3+++ app/templates/charm-pre-configuration.handlebars 2012-11-09 14:33:29 +0000
4@@ -44,16 +44,16 @@
5 <!-- Service configuration form -->
6 <div class="charm-section">
7 <h4>Service Settings<i class="icon-chevron-down"></i></h4>
8- <div class="config-file-upload control-group">
9- <input class="config-file-upload-widget" type="file">
10- <div>
11- <span class="config-file-upload-overlay">Use configuration file</span>
12- <span class="config-file-name"></span>
13+ <div class="collapsible">
14+ <div class="config-file-upload control-group">
15+ <input class="config-file-upload-widget" type="file">
16+ <div>
17+ <span class="config-file-upload-overlay">Use configuration file</span>
18+ <span class="config-file-name"></span>
19+ </div>
20 </div>
21- </div>
22- <div class="charm-settings">
23- <form>
24- <div id="service-config" class="collapsible">
25+ <form class="charm-settings">
26+ <div id="service-config">
27 {{> service-config}}
28 </div>
29 </form>
30
31=== modified file 'app/views/charm-panel.js'
32--- app/views/charm-panel.js 2012-11-07 13:12:18 +0000
33+++ app/views/charm-panel.js 2012-11-09 14:33:29 +0000
34@@ -591,7 +591,14 @@
35 this.tooltip.hide();
36 delete this.tooltip.field;
37 },
38- /** Pass clicks on the overlay on to the correct recipient. */
39+ /**
40+ * Pass clicks on the overlay on to the correct recipient.
41+ * The recipient can be the upload widget or the file remove one.
42+ *
43+ * @method onOverlayClick
44+ * @param {Object} evt An event object.
45+ * @return {undefined} Dispatches only.
46+ */
47 onOverlayClick: function(evt) {
48 var container = this.get('container');
49 if (this.configFileContent) {
50@@ -600,6 +607,14 @@
51 container.one('.config-file-upload-widget').getDOMNode().click();
52 }
53 },
54+ /**
55+ * Handle the file upload click event.
56+ * Call onFileLoaded or onFileError if an error occurs during upload.
57+ *
58+ * @method onFileChange
59+ * @param {Object} evt An event object.
60+ * @return {undefined} Mutates only.
61+ */
62 onFileChange: function(evt) {
63 var container = this.get('container');
64 console.log('onFileChange:', evt);
65@@ -613,6 +628,13 @@
66 container.one('.config-file-upload-overlay')
67 .setContent('Remove file');
68 },
69+ /**
70+ * Handle the file remove click event.
71+ * Restore the file upload widget on click.
72+ *
73+ * @method onFileRemove
74+ * @return {undefined} Mutates only.
75+ */
76 onFileRemove: function() {
77 var container = this.get('container');
78 this.configFileContent = null;
79@@ -624,9 +646,20 @@
80 this.fileInput.replace(Y.Node.create('<input type="file"/>')
81 .addClass('config-file-upload-widget'));
82 this.fileInput = container.one('.config-file-upload-widget');
83- container.one('.config-file-upload-overlay')
84- .setContent('Use configuration file');
85+ var overlay = container.one('.config-file-upload-overlay');
86+ overlay.setContent('Use configuration file');
87+ // Ensure the charm section height is correctly restored.
88+ overlay.ancestor('.collapsible')
89+ .show('sizeIn', {duration: 0.25, width: null});
90 },
91+ /**
92+ * Callback called when a file is correctly uploaded.
93+ * Hide the charm configuration section.
94+ *
95+ * @method onFileLoaded
96+ * @param {Object} evt An event object.
97+ * @return {undefined} Mutates only.
98+ */
99 onFileLoaded: function(evt) {
100 this.configFileContent = evt.target.result;
101
102@@ -645,6 +678,14 @@
103 }
104 this.get('container').one('.charm-settings').hide();
105 },
106+ /**
107+ * Callback called when an error occurs during file upload.
108+ * Hide the charm configuration section.
109+ *
110+ * @method onFileError
111+ * @param {Object} evt An event object (with a "target.error" attr).
112+ * @return {undefined} Mutates only.
113+ */
114 onFileError: function(evt) {
115 console.log('onFileError:', evt);
116 var msg;
117
118=== modified file 'lib/views/stylesheet.less'
119--- lib/views/stylesheet.less 2012-11-08 15:50:13 +0000
120+++ lib/views/stylesheet.less 2012-11-09 14:33:29 +0000
121@@ -17,6 +17,7 @@
122 @charm-panel-background-color: #eeeeee;
123 @charm-panel-border-color: #BEBEBE;
124 @charm-paneel-border-top-color: #E0DEDE;
125+@charm-panel-padding-left: 10px;
126 @navbar-color: #2D2D2D!important;
127
128 body {
129@@ -29,6 +30,18 @@
130 font-family: @font-family;
131 }
132
133+.create-border-radius(@radius) {
134+ -moz-border-radius: @radius;
135+ -webkit-border-radius: @radius;
136+ border-radius: @radius;
137+}
138+
139+.create-box-shadow(@arguments) {
140+ -moz-box-shadow: @arguments;
141+ -webkit-box-shadow: @arguments;
142+ box-shadow: @arguments;
143+}
144+
145 .create-button(@gradient-start, @gradient-end, @shadow-color, @v-pos) {
146 @blur: 2px;
147 background-image: -ms-linear-gradient(top, @gradient-start, @gradient-end);
148@@ -38,21 +51,15 @@
149 background-image: -moz-linear-gradient(top, @gradient-start, @gradient-end);
150 background-image: linear-gradient(top, @gradient-start, @gradient-end);
151 background-repeat: repeat-x;
152- -moz-box-shadow: 0 (@v-pos + 3) @blur -@blur @shadow-color inset,
153- 2px 0 3px -2px @shadow-color inset, -2px 0 3px -2px @shadow-color inset;
154- -webkit-box-shadow: 0 (@v-pos + 3) @blur -@blur @shadow-color inset,
155- 2px 0 3px -2px @shadow-color inset, -2px 0 3px -2px @shadow-color inset;
156- box-shadow: 0 (@v-pos + 3) @blur -@blur @shadow-color inset,
157- 2px 0 3px -2px @shadow-color inset, -2px 0 3px -2px @shadow-color inset;
158- @border-radii: ~"6px / 7px";
159- -moz-border-radius: @border-radii;
160- -webkit-border-radius: @border-radii;
161- border-radius: @border-radii;
162+ // Using a variable here because LESS strips commas in mixin args.
163+ @box-shadow: 0 (@v-pos + 3) @blur -@blur @shadow-color inset,
164+ 2px 0 3px -2px @shadow-color inset,
165+ -2px 0 3px -2px @shadow-color inset;
166+ .create-box-shadow(@box-shadow);
167+ .create-border-radius(~"6px / 7px");
168 border: none;
169 }
170
171-
172-
173 i.sprite {
174 display: inline-block;
175 vertical-align: middle;
176@@ -219,15 +226,8 @@
177 display: none;
178 background-color: @background_color;
179 color: #fdf6e3;
180-
181- border-radius: @border_radius;
182- -moz-border-radius: @border_radius;
183- -webkit-border-radius: @border_radius;
184-
185- box-shadow: -2px 4px 4px 0 rgba(0, 0, 0, 0.5);
186- -moz-box-shadow: -2px 4px 4px 0 rgba(0, 0, 0, 0.5);
187- -webkit-box-shadow: -2px 4px 4px 0 rgba(0, 0, 0, 0.5);
188-
189+ .create-border-radius(@border_radius);
190+ .create-box-shadow(-2px 4px 4px 0 rgba(0, 0, 0, 0.5));
191 top: 0;
192 left: 0;
193 position: absolute;
194@@ -271,9 +271,7 @@
195 cursor: pointer;
196 line-height: 32px;
197 padding: 5px 5px 5px 5px;
198- border-radius: @border_radius;
199- -moz-border-radius: @border_radius;
200- -webkit-border-radius: @border_radius;
201+ .create-border-radius(@border_radius);
202
203 &.view-service {
204 background-image: url(/juju-ui/assets/images/icons/icon_noshadow_view.png);
205@@ -379,9 +377,7 @@
206
207 .unit (@min_height: 20px, @border_radius:3px) {
208 padding: 5px;
209- -webkit-border-radius: @border_radius;
210- -moz-border-radius: @border_radius;
211- border-radius: @border_radius;
212+ .create-border-radius(@border_radius);
213 margin-bottom: 0px;
214 min-height: @min_height;
215 cursor: pointer;
216@@ -731,12 +727,8 @@
217 background: white;
218 padding: 1.6em;
219 border: solid black 2px;
220- -webkit-border-radius: 6px;
221- -moz-border-radius: 6px;
222- border-radius: 6px;
223- -webkit-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3);
224- -moz-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3);
225- box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3);
226+ .create-border-radius(6px);
227+ .create-box-shadow(0 3px 7px rgba(0, 0, 0, 0.3));
228 -webkit-background-clip: padding-box;
229 -moz-background-clip: padding-box;
230 background-clip: padding-box;
231@@ -844,9 +836,10 @@
232 background-color: #FFFFFF;
233 border-bottom: 1px solid @charm-panel-border-color;
234 height: 52px;
235- padding-left: 8px;
236+ padding-left: @charm-panel-padding-left;
237 .btn {
238 margin-top: 12px;
239+ width: 67px;
240 }
241 }
242 .search-charm-inner {
243@@ -879,7 +872,7 @@
244 border-bottom: 1px solid @charm-panel-border-color;
245 font-family: @font-family-medium;
246 font-weight: normal;
247- padding: 8px 12px;
248+ padding: 8px @charm-panel-padding-left;
249 i {
250 float: right;
251 }
252@@ -896,13 +889,13 @@
253 #charm-panel-head {
254 border-top: 1px solid #FFFFFF;
255 border-bottom: 1px solid @charm-panel-border-color;
256- padding: 1ex 12px 10px 12px;
257+ padding: 1ex 10px 10px @charm-panel-padding-left;
258 }
259 .collapsible {
260 background-color: #E7E7E7;
261 line-height: 16px;
262 overflow: hidden;
263- padding: 0px 12px;
264+ padding: 0px @charm-panel-padding-left;
265 :last-child {
266 margin-bottom: 11px;
267 }
268@@ -910,6 +903,9 @@
269 &.charm-description {
270 color: #58595B;
271 font-size: 12px;
272+ .btn.deploy {
273+ margin-left: 0;
274+ }
275 .charm-section {
276 .commitmessage {
277 padding: 0.8ex 0 1ex 1em;
278@@ -926,11 +922,16 @@
279 &.config-variant {
280 font-size: 14px;
281 border-top: 1px solid @charm-paneel-border-top-color;
282+ .charm-entry {
283+ padding: 5px @charm-panel-padding-left;
284+ &:nth-of-type(2) {
285+ margin-bottom: 15px;
286+ }
287+ }
288 .control-group {
289 width: auto;
290 margin-bottom: 0;
291 margin-top: 1ex;
292- padding: 0px 12px;
293 clear: both;
294 }
295 .control-description {
296@@ -946,6 +947,23 @@
297 .controls {
298 margin-left: auto;
299 margin-right: 0;
300+ input[type=text] {
301+ color: @text-entry-color;
302+ font-style: italic;
303+ font-size: 12px;
304+ height: 15px;
305+ width: 250px;
306+ margin: 0;
307+ .create-border-radius(6px);
308+ // Using a variable here because LESS strips commas in
309+ // mixin args.
310+ @box-shadow: 0 1px 3px #959595 inset, 0 1px 0 white;
311+ .create-box-shadow(@box-shadow);
312+ }
313+ input[type=checkbox] {
314+ margin-left: 1ex;
315+ margin-top: 0.7ex;
316+ }
317 }
318 .config-field {
319 font-size: 16px;
320@@ -955,6 +973,8 @@
321 position: relative;
322 width: 252px;
323 height: 25px;
324+ margin-bottom: 20px;
325+ margin-top: 20px;
326 }
327 .config-file-upload-widget {
328 position: absolute;
329@@ -965,6 +985,8 @@
330 }
331 .config-file-upload-overlay {
332 background: url(/juju-ui/assets/images/getfile_button.png) no-repeat;
333+ color: #4c4c4c;
334+ font-family: @font-family-medium;
335 position: absolute;
336 top: 0;
337 left: 0;
338@@ -985,12 +1007,6 @@
339 width: auto;
340 z-index: 2;
341 }
342- .controls.boolean {
343- input {
344- margin-left: 1ex;
345- margin-top: 0.7ex;
346- }
347- }
348 .btn {
349 margin-top: 5px;
350 }
351@@ -1005,7 +1021,7 @@
352 font-weight: normal;
353 font-size: 16px;
354 text-transform: capitalize;
355- padding-left: 11px;
356+ padding-left: @charm-panel-padding-left;
357 background-color: #CBCBCB;
358 border-top: 1px solid #989898;
359 }
360@@ -1013,7 +1029,7 @@
361 margin-bottom: 0;
362 }
363 .charm-entry {
364- padding: 11px;
365+ padding: 11px @charm-panel-padding-left;
366 border-top: 1px solid #FFFFFF;
367 border-bottom: 1px solid #BDBDBD;
368 &:first-child {
369@@ -1271,9 +1287,7 @@
370 background-color: white;
371 border: solid 1px black;
372 padding: 0.2em 0.5em 0.3em;
373- -webkit-border-radius: 3px;
374- -moz-border-radius: 3px;
375- border-radius: 3px;
376+ .create-border-radius(3px);
377 min-width: 20px;
378 max-width: 400px;
379 }
380@@ -1281,11 +1295,11 @@
381 .charm-panel-configure {
382 background-image: url(/juju-ui/assets/images/configure-cog.png);
383 background-repeat: no-repeat;
384- background-position: 230px 42px;
385+ background-position: 230px 38px;
386 border-top: 2px solid #dd4814;
387 background-color: #2F2A27;
388- height: 93px;
389- padding-left: 8px;
390+ height: 90px;
391+ padding-left: @charm-panel-padding-left;
392 .title {
393 font-weight: lighter;
394 font-size: 22px;
395
396=== modified file 'undocumented'
397--- undocumented 2012-11-08 20:11:46 +0000
398+++ undocumented 2012-11-09 14:33:29 +0000
399@@ -75,10 +75,6 @@
400 app/views/charm-panel.js mouseenter
401 app/views/charm-panel.js mouseleave
402 app/views/charm-panel.js onCharmDeployClicked
403-app/views/charm-panel.js onFileChange
404-app/views/charm-panel.js onFileError
405-app/views/charm-panel.js onFileLoaded
406-app/views/charm-panel.js onFileRemove
407 app/views/charm-panel.js render
408 app/views/charm-panel.js setDefaultSeries
409 app/views/charm-panel.js setPanel

Subscribers

People subscribed via source and target branches