Merge lp:~huwshimi/juju-gui/bundle-charm-list into lp:juju-gui/experimental

Proposed by Huw Wilkins
Status: Merged
Merged at revision: 1139
Proposed branch: lp:~huwshimi/juju-gui/bundle-charm-list
Merge into: lp:juju-gui/experimental
Diff against target: 213 lines (+103/-43)
3 files modified
app/subapps/browser/views/bundle.js (+21/-0)
app/templates/bundle.handlebars (+27/-1)
lib/views/browser/charm-full.less (+55/-42)
To merge this branch: bzr merge lp:~huwshimi/juju-gui/bundle-charm-list
Reviewer Review Type Date Requested Status
Juju GUI Hackers Pending
Review via email: mp+191562@code.launchpad.net

Description of the change

Added charm details to bundle

Browse to a charm and view the "Charms" tab. There is no direction for what this page is supposed to contain yet so I've added tokens for each charm and also display the config options and number of units.

https://codereview.appspot.com/14673044/

To post a comment you must log in.
Revision history for this message
Huw Wilkins (huwshimi) wrote :

Reviewers: mp+191562_code.launchpad.net,

Message:
Please take a look.

Description:
Added charm details to bundle

Browse to a charm and view the "Charms" tab. There is no direction for
what this page is supposed to contain yet so I've added tokens for each
charm and also display the config options and number of units.

https://code.launchpad.net/~huwshimi/juju-gui/bundle-charm-list/+merge/191562

(do not edit description out of merge proposal)

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

Affected files (+105, -43 lines):
   A [revision details]
   M app/subapps/browser/views/bundle.js
   M app/templates/bundle.handlebars
   M lib/views/browser/charm-full.less

Revision history for this message
Richard Harding (rharding) wrote :

Code looks good with the cleanup added. Will QA next.

https://codereview.appspot.com/14673044/diff/1/app/subapps/browser/views/bundle.js
File app/subapps/browser/views/bundle.js (right):

https://codereview.appspot.com/14673044/diff/1/app/subapps/browser/views/bundle.js#newcode137
app/subapps/browser/views/bundle.js:137: token.render(node);
the tokens need to get tracked and cleaned up on destroy()

https://codereview.appspot.com/14673044/

Revision history for this message
Richard Harding (rharding) wrote :

LGTM, qa ok and qa'd on IE10 as well.

Longer term we should add some intro text like the other tabs, etc. I'll
pull this branch down and add the cleanup so we can land it.

https://codereview.appspot.com/14673044/

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'app/subapps/browser/views/bundle.js'
2--- app/subapps/browser/views/bundle.js 2013-10-11 22:48:51 +0000
3+++ app/subapps/browser/views/bundle.js 2013-10-17 07:10:14 +0000
4@@ -137,6 +137,25 @@
5 },
6
7 /**
8+ Render the list of charms in the bundle.
9+
10+ @method _renderCharmListing
11+
12+ */
13+ _renderCharmListing: function() {
14+ var attrs = this.get('entity').getAttrs();
15+ Y.Object.each(attrs.charm_metadata, function(charm, key) {
16+ var charmModel = new Y.juju.models.Charm(charm);
17+ charm = charmModel.getAttrs();
18+ charm.size = 'tiny';
19+ charm.isDraggable = false;
20+ var token = new widgets.browser.Token(charm);
21+ var node = Y.one('[data-config="' + key + '"]');
22+ token.render(node);
23+ }, this);
24+ },
25+
26+ /**
27 Renders the bundle view template into the DOM.
28
29 @method _renderBundleView
30@@ -184,6 +203,7 @@
31 this.tabview.selectChild(2);
32 }
33 this._dispatchTabEvents(this.tabview);
34+ this._renderCharmListing();
35
36 this.set('rendered', true);
37 },
38@@ -244,6 +264,7 @@
39 }, '', {
40 requires: [
41 'browser-overlay-indicator',
42+ 'juju-charm-models',
43 'juju-view-utils',
44 'view',
45 'juju-env-fakebackend',
46
47=== modified file 'app/templates/bundle.handlebars'
48--- app/templates/bundle.handlebars 2013-10-10 04:44:18 +0000
49+++ app/templates/bundle.handlebars 2013-10-17 07:10:14 +0000
50@@ -119,7 +119,33 @@
51 </div>
52 </div>
53 <div id="bws-readme"></div>
54- <div id="bws-charms"></div>
55+ <div id="bws-charms">
56+ <div class="yui3-g">
57+ <div class="interfaces-heading yui3-u-1-2">
58+ <h3>Charm</h3>
59+ </div>
60+ <div class="interfaces-heading yui3-u-1-2">
61+ <h3>Config</h3>
62+ </div>
63+ </div>
64+ <ul class="interface-list">
65+ {{#arrayObject services}}
66+ <li class="interface-row yui3-g">
67+ <div class="yui3-u-1-2" data-config="{{ key }}"></div>
68+ <div class="yui3-u-1-2 charm-config">
69+ <ul>
70+ <li>Number of units: {{ value.num_units }}</li>
71+ {{#if value.config}}
72+ {{#arrayObject value.options}}
73+ <li>{{ key }}: {{ value }}</li>
74+ {{/arrayObject}}
75+ {{/if}}
76+ </ul>
77+ </div>
78+ </li>
79+ {{/arrayObject}}
80+ </ul>
81+ </div>
82 <div id="bws-code">
83 <p class="intro">
84 The source code of the bundle includes scripts, metadata,
85
86=== modified file 'lib/views/browser/charm-full.less'
87--- lib/views/browser/charm-full.less 2013-10-09 04:05:57 +0000
88+++ lib/views/browser/charm-full.less 2013-10-17 07:10:14 +0000
89@@ -124,6 +124,59 @@
90 margin-top: 9px;
91 margin-bottom: 26px;
92 }
93+ .interfaces-heading,
94+ .interface,
95+ .related {
96+ .border-box;
97+ padding: 0 20px;
98+ }
99+ .interfaces-heading {
100+ padding-top: 0;
101+ padding-bottom: 0;
102+ border-bottom: 1px solid @bws-border;
103+
104+ h3 {
105+ margin: 0;
106+ padding: 0;
107+ border: none;
108+ }
109+ }
110+ .interface-list {
111+ h4 {
112+ margin: 0;
113+ padding: 0;
114+ border: none;
115+ }
116+ .interface-row {
117+ border-bottom: 1px solid @bws-border;
118+
119+ .interface {
120+ padding-top: 10px;
121+ padding-bottom: 10px;
122+ font-size: 10.5pt;
123+ }
124+ .charm-config {
125+ .border-box;
126+ min-height: 87px;
127+ padding: 20px;
128+ border-left: 1px solid @bws-border;
129+
130+ li {
131+ margin-bottom: 5px;
132+ }
133+ }
134+ .yui3-token {
135+ width: 100%;
136+
137+ .title {
138+ max-width: 150px;
139+ }
140+ }
141+ &:last-child {
142+ border: none;
143+ }
144+ }
145+ }
146 #bws-features,
147 #bws-summary,
148 #bws-readme {
149@@ -135,46 +188,6 @@
150 padding-left: 2em;
151 }
152 }
153- #bws-related-charms {
154- .interfaces-heading,
155- .interface,
156- .related {
157- .border-box;
158- padding: 0 20px;
159- }
160- h4,
161- h3 {
162- margin: 0;
163- padding: 0;
164- border: none;
165- }
166- .interfaces-heading {
167- padding-top: 0;
168- padding-bottom: 15px;
169- border-bottom: 1px solid @bws-border;
170- }
171- .interface-list {
172- .interface-row {
173- border-bottom: 1px solid @bws-border;
174-
175- .interface {
176- padding-top: 10px;
177- padding-bottom: 10px;
178- font-size: 10.5pt;
179- }
180- .yui3-token {
181- width: 100%;
182-
183- .title {
184- max-width: 150px;
185- }
186- }
187- &:last-child {
188- border: none;
189- }
190- }
191- }
192- }
193 #bws-configuration {
194 dt {
195 margin: 20px 0 15px 0;
196@@ -246,7 +259,7 @@
197 padding: 17px 70px 16px 16px;
198
199 a {
200- padding-right: 5px;
201+ padding-right: 5px;
202 }
203 }
204 }
205@@ -326,7 +339,7 @@
206 }
207 span {
208 color: @bws-text;
209- text-decoration: underline;
210+ text-decoration: underline;
211 }
212 }
213 }

Subscribers

People subscribed via source and target branches