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
=== modified file 'app/subapps/browser/views/charm.js'
--- app/subapps/browser/views/charm.js 2013-06-27 21:19:35 +0000
+++ app/subapps/browser/views/charm.js 2013-07-02 20:29:30 +0000
@@ -79,9 +79,6 @@
79 ev.halt();79 ev.halt();
80 var browserCharm = this.get('charm');80 var browserCharm = this.get('charm');
81 var charm = new models.Charm(browserCharm.getAttrs());81 var charm = new models.Charm(browserCharm.getAttrs());
82 charm.set('config', {
83 options: browserCharm.get('options')
84 });
85 if (this.get('isFullscreen')) {82 if (this.get('isFullscreen')) {
86 this.fire('viewNavigate',83 this.fire('viewNavigate',
87 {change: {viewmode: 'sidebar', charmID: null}});84 {change: {viewmode: 'sidebar', charmID: null}});
8885
=== modified file 'app/views/charm-panel.js'
--- app/views/charm-panel.js 2013-06-27 13:01:27 +0000
+++ app/views/charm-panel.js 2013-07-02 20:29:30 +0000
@@ -852,14 +852,18 @@
852 * @param {String} charmUrl The URL of the charm to configure/deploy.852 * @param {String} charmUrl The URL of the charm to configure/deploy.
853 * @return {undefined} Nothing.853 * @return {undefined} Nothing.
854 */854 */
855 function deploy(charm, ghostXY) {855 function deploy(charm, ghostXY, _setPanel) {
856 _setPanel = _setPanel || setPanel; // Injection point for tests.
856 // Any passed-in charm is fully loaded but the caller doesn't know about857 // Any passed-in charm is fully loaded but the caller doesn't know about
857 // the charm panel's internal detail of marking loaded charms, so we will858 // the charm panel's internal detail of marking loaded charms, so we will
858 // do the marking here.859 // do the marking here.
859 charm.loaded = true;860 charm.loaded = true;
861 // The config panel expects the config options here instead of the
862 // "options" attribute. <shrug>
863 charm.set('config', {options: charm.get('options')});
860 charms.add(charm);864 charms.add(charm);
861 // Show the configuration panel.865 // Show the configuration panel.
862 setPanel({866 _setPanel({
863 name: 'configuration',867 name: 'configuration',
864 charmId: charm.get('id'),868 charmId: charm.get('id'),
865 ghostXY: ghostXY869 ghostXY: ghostXY
866870
=== modified file 'test/test_browser_charm_details.js'
--- test/test_browser_charm_details.js 2013-07-01 17:28:53 +0000
+++ test/test_browser_charm_details.js 2013-07-02 20:29:30 +0000
@@ -238,11 +238,6 @@
238 assert.notDeepEqual(charm, browserCharm);238 assert.notDeepEqual(charm, browserCharm);
239 var madeCharm = new models.Charm(browserCharm.getAttrs());239 var madeCharm = new models.Charm(browserCharm.getAttrs());
240 assert.equal(charm.get('id'), madeCharm.get('id'));240 assert.equal(charm.get('id'), madeCharm.get('id'));
241 // Verify that the charm config from the BrowserCharm is now part of
242 // config.options in the new Charm instance.
243 assert.equal(
244 browserCharm.get('options').configName,
245 charm.get('config').options.configName);
246 done();241 done();
247 });242 });
248 view._addCharmEnvironment({halt: function() {}});243 view._addCharmEnvironment({halt: function() {}});
249244
=== modified file 'test/test_charm_panel.js'
--- test/test_charm_panel.js 2013-06-13 16:15:01 +0000
+++ test/test_charm_panel.js 2013-07-02 20:29:30 +0000
@@ -85,6 +85,39 @@
85 node.getStyle('display').should.equal('none');85 node.getStyle('display').should.equal('none');
86 });86 });
8787
88 it('has a deploy function that munges the charm options', function() {
89 var panel = Y.namespace('juju.views').CharmPanel
90 .getInstance({
91 testing: true,
92 container: container,
93 app: { views: { environment: {}}}
94 }),
95 node = panel.node;
96 panel.setActivePanelName('configuration');
97 // For whatever reason, the charm configuration panel now expects the charm
98 // options as an attribute of the charm config. The deploy function
99 // therefore arranges for that to be true.
100 var OPTIONS = 'we are the options, my friend';
101 var setCalled = false;
102 var charm = {
103 id: 'cs:precise/juju-gui-7',
104 get: function(name) {
105 if (name === 'id') {
106 return 'cs:precise/juju-gui-7';
107 }
108 assert.equal(name, 'options');
109 return OPTIONS;
110 },
111 set: function(name, value) {
112 assert.equal(name, 'config');
113 assert.deepEqual(value, {options: OPTIONS});
114 setCalled = true;
115 }
116 };
117 panel.deploy(charm, undefined, function() {});
118 assert.isTrue(setCalled);
119 });
120
88 describe('service ghost', function() {121 describe('service ghost', function() {
89 var app, db, env, panel, serviceName, store;122 var app, db, env, panel, serviceName, store;
90123

Subscribers

People subscribed via source and target branches