Merge lp:~benji/juju-gui/critical-config-panel-fix into lp:juju-gui/experimental

Proposed by Benji York
Status: Merged
Merged at revision: 788
Proposed branch: lp:~benji/juju-gui/critical-config-panel-fix
Merge into: lp:juju-gui/experimental
Diff against target: 97 lines (+39/-10)
4 files modified
app/subapps/browser/views/charm.js (+0/-3)
app/views/charm-panel.js (+6/-2)
test/test_browser_charm_details.js (+0/-5)
test/test_charm_panel.js (+33/-0)
To merge this branch: bzr merge lp:~benji/juju-gui/critical-config-panel-fix
Reviewer Review Type Date Requested Status
Juju GUI Hackers Pending
Review via email: mp+172663@code.launchpad.net

Description of the change

fix critical charm option attribute layout bug

https://codereview.appspot.com/10887043/

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

LGTM Thanks for qa'ing that extra bit for me!

https://codereview.appspot.com/10887043/

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'app/subapps/browser/views/charm.js'
2--- app/subapps/browser/views/charm.js 2013-06-27 21:19:35 +0000
3+++ app/subapps/browser/views/charm.js 2013-07-02 20:29:30 +0000
4@@ -79,9 +79,6 @@
5 ev.halt();
6 var browserCharm = this.get('charm');
7 var charm = new models.Charm(browserCharm.getAttrs());
8- charm.set('config', {
9- options: browserCharm.get('options')
10- });
11 if (this.get('isFullscreen')) {
12 this.fire('viewNavigate',
13 {change: {viewmode: 'sidebar', charmID: null}});
14
15=== modified file 'app/views/charm-panel.js'
16--- app/views/charm-panel.js 2013-06-27 13:01:27 +0000
17+++ app/views/charm-panel.js 2013-07-02 20:29:30 +0000
18@@ -852,14 +852,18 @@
19 * @param {String} charmUrl The URL of the charm to configure/deploy.
20 * @return {undefined} Nothing.
21 */
22- function deploy(charm, ghostXY) {
23+ function deploy(charm, ghostXY, _setPanel) {
24+ _setPanel = _setPanel || setPanel; // Injection point for tests.
25 // Any passed-in charm is fully loaded but the caller doesn't know about
26 // the charm panel's internal detail of marking loaded charms, so we will
27 // do the marking here.
28 charm.loaded = true;
29+ // The config panel expects the config options here instead of the
30+ // "options" attribute. <shrug>
31+ charm.set('config', {options: charm.get('options')});
32 charms.add(charm);
33 // Show the configuration panel.
34- setPanel({
35+ _setPanel({
36 name: 'configuration',
37 charmId: charm.get('id'),
38 ghostXY: ghostXY
39
40=== modified file 'test/test_browser_charm_details.js'
41--- test/test_browser_charm_details.js 2013-07-01 17:28:53 +0000
42+++ test/test_browser_charm_details.js 2013-07-02 20:29:30 +0000
43@@ -238,11 +238,6 @@
44 assert.notDeepEqual(charm, browserCharm);
45 var madeCharm = new models.Charm(browserCharm.getAttrs());
46 assert.equal(charm.get('id'), madeCharm.get('id'));
47- // Verify that the charm config from the BrowserCharm is now part of
48- // config.options in the new Charm instance.
49- assert.equal(
50- browserCharm.get('options').configName,
51- charm.get('config').options.configName);
52 done();
53 });
54 view._addCharmEnvironment({halt: function() {}});
55
56=== modified file 'test/test_charm_panel.js'
57--- test/test_charm_panel.js 2013-06-13 16:15:01 +0000
58+++ test/test_charm_panel.js 2013-07-02 20:29:30 +0000
59@@ -85,6 +85,39 @@
60 node.getStyle('display').should.equal('none');
61 });
62
63+ it('has a deploy function that munges the charm options', function() {
64+ var panel = Y.namespace('juju.views').CharmPanel
65+ .getInstance({
66+ testing: true,
67+ container: container,
68+ app: { views: { environment: {}}}
69+ }),
70+ node = panel.node;
71+ panel.setActivePanelName('configuration');
72+ // For whatever reason, the charm configuration panel now expects the charm
73+ // options as an attribute of the charm config. The deploy function
74+ // therefore arranges for that to be true.
75+ var OPTIONS = 'we are the options, my friend';
76+ var setCalled = false;
77+ var charm = {
78+ id: 'cs:precise/juju-gui-7',
79+ get: function(name) {
80+ if (name === 'id') {
81+ return 'cs:precise/juju-gui-7';
82+ }
83+ assert.equal(name, 'options');
84+ return OPTIONS;
85+ },
86+ set: function(name, value) {
87+ assert.equal(name, 'config');
88+ assert.deepEqual(value, {options: OPTIONS});
89+ setCalled = true;
90+ }
91+ };
92+ panel.deploy(charm, undefined, function() {});
93+ assert.isTrue(setCalled);
94+ });
95+
96 describe('service ghost', function() {
97 var app, db, env, panel, serviceName, store;
98

Subscribers

People subscribed via source and target branches