Merge lp:~rharding/juju-gui/bundle-sandbox-noop into lp:juju-gui/experimental

Proposed by Richard Harding
Status: Merged
Merged at revision: 1206
Proposed branch: lp:~rharding/juju-gui/bundle-sandbox-noop
Merge into: lp:juju-gui/experimental
Diff against target: 284 lines (+137/-15)
8 files modified
app/assets/javascripts/bundle-import-helpers.js (+2/-2)
app/store/env/fakebackend.js (+38/-0)
app/store/env/go.js (+8/-8)
app/store/env/sandbox.js (+27/-0)
test/test_bundle_import_helpers.js (+3/-3)
test/test_env_go.js (+1/-1)
test/test_fakebackend.js (+22/-0)
test/test_sandbox_go.js (+36/-1)
To merge this branch: bzr merge lp:~rharding/juju-gui/bundle-sandbox-noop
Reviewer Review Type Date Requested Status
Juju GUI Hackers Pending
Review via email: mp+196000@code.launchpad.net

Description of the change

fakebackend/sandbox no op deployer watches

- The fakebackend and the sandbox need to just ignore calls to watch deployer
status. It's too fast and we don't want to flood the users with a bunch of
notices all at once.
- Had to rename the WatchUpdate to deployerNext since the fakebackend auto
builds the names of the handle methods based off the actual call. So it needed
to be deployerNext though I hate it's no longer worded to tie to 'watch'.

QA:

Simply deploy a bundle in sandbox mode.

- Drag/drop a yaml file into the canvas
- Deploy from the deploy button from bundle details

Note: Dragging/dropping a bundle token is not working. This is also true on
coming soon. This is due to the recent bundle.id tracking code and will be
done in a follow up.

https://codereview.appspot.com/29860044/

To post a comment you must log in.
Revision history for this message
Richard Harding (rharding) wrote :

Reviewers: mp+196000_code.launchpad.net,

Message:
Please take a look.

Description:
fakebackend/sandbox no op deployer watches

- The fakebackend and the sandbox need to just ignore calls to watch
deployer
status. It's too fast and we don't want to flood the users with a bunch
of
notices all at once.
- Had to rename the WatchUpdate to deployerNext since the fakebackend
auto
builds the names of the handle methods based off the actual call. So it
needed
to be deployerNext though I hate it's no longer worded to tie to
'watch'.
- Drive by fix for deploying a bundle via drag-n-drop.

QA:

Simply deploy a bundle in sandbox mode.

- Drag/drop a yaml file into the canvas
- Deploy from the deploy button from bundle details
-

Note: Dragging/dropping a bundle token is not working. This is also true
on
coming soon. This is due to the recent bundle.id tracking code and will
be
done in a follow up.

https://code.launchpad.net/~rharding/juju-gui/bundle-sandbox-noop/+merge/196000

(do not edit description out of merge proposal)

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

Affected files (+139, -15 lines):
   A [revision details]
   M app/assets/javascripts/bundle-import-helpers.js
   M app/store/env/fakebackend.js
   M app/store/env/go.js
   M app/store/env/sandbox.js
   M test/test_bundle_import_helpers.js
   M test/test_env_go.js
   M test/test_fakebackend.js
   M test/test_sandbox_go.js

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

LGTM with some crazy nit-picking mess.

https://codereview.appspot.com/29860044/diff/20001/app/store/env/fakebackend.js
File app/store/env/fakebackend.js (right):

https://codereview.appspot.com/29860044/diff/20001/app/store/env/fakebackend.js#newcode1592
app/store/env/fakebackend.js:1592: This method is a noop in the
fakebackend. We've already sent the user a
noon looks too much like noob.

Pick one of 'no op' or 'no-op' throughout.

https://codereview.appspot.com/29860044/diff/20001/test/test_fakebackend.js
File test/test_fakebackend.js (right):

https://codereview.appspot.com/29860044/diff/20001/test/test_fakebackend.js#newcode740
test/test_fakebackend.js:740: // This is no op'd in the fakebackend
since it doens't make sense to
typo: doesn't

https://codereview.appspot.com/29860044/diff/20001/test/test_fakebackend.js#newcode741
test/test_fakebackend.js:741: // provide a watch status as things happen
near instantly.
grammar-o: nearly

https://codereview.appspot.com/29860044/diff/20001/test/test_fakebackend.js#newcode744
test/test_fakebackend.js:744: assert.fail('The watcher callback shoould
never be called.');
shoooooooould

https://codereview.appspot.com/29860044/diff/20001/test/test_fakebackend.js#newcode751
test/test_fakebackend.js:751: // This is no op'd in the fakebackend
since it doens't make sense to
Dang, on a roll!

https://codereview.appspot.com/29860044/diff/20001/test/test_fakebackend.js#newcode752
test/test_fakebackend.js:752: // provide a watch status as things happen
near instantly.
ditto

https://codereview.appspot.com/29860044/diff/20001/test/test_fakebackend.js#newcode755
test/test_fakebackend.js:755: assert.fail('The watcher update callback
shoould never be called.');
and again

https://codereview.appspot.com/29860044/

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

Fix all the engrish

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

*** Submitted:

fakebackend/sandbox no op deployer watches

- The fakebackend and the sandbox need to just ignore calls to watch
deployer
status. It's too fast and we don't want to flood the users with a bunch
of
notices all at once.
- Had to rename the WatchUpdate to deployerNext since the fakebackend
auto
builds the names of the handle methods based off the actual call. So it
needed
to be deployerNext though I hate it's no longer worded to tie to
'watch'.

QA:

Simply deploy a bundle in sandbox mode.

- Drag/drop a yaml file into the canvas
- Deploy from the deploy button from bundle details

Note: Dragging/dropping a bundle token is not working. This is also true
on
coming soon. This is due to the recent bundle.id tracking code and will
be
done in a follow up.

R=bac
CC=
https://codereview.appspot.com/29860044

https://codereview.appspot.com/29860044/

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'app/assets/javascripts/bundle-import-helpers.js'
--- app/assets/javascripts/bundle-import-helpers.js 2013-11-19 16:54:54 +0000
+++ app/assets/javascripts/bundle-import-helpers.js 2013-11-20 19:38:27 +0000
@@ -234,14 +234,14 @@
234 // There's nothing else to see here.234 // There's nothing else to see here.
235 return;235 return;
236 } else {236 } else {
237 env.deployerWatchUpdate(watchId, processUpdate);237 env.deployerNext(watchId, processUpdate);
238 }238 }
239 }239 }
240 };240 };
241241
242 // Make the first call to the env and the processUpdate callback will242 // Make the first call to the env and the processUpdate callback will
243 // handle re-calling on each update.243 // handle re-calling on each update.
244 env.deployerWatchUpdate(watchId, processUpdate);244 env.deployerNext(watchId, processUpdate);
245 }245 }
246246
247 };247 };
248248
=== modified file 'app/store/env/fakebackend.js'
--- app/store/env/fakebackend.js 2013-11-08 18:57:35 +0000
+++ app/store/env/fakebackend.js 2013-11-20 19:38:27 +0000
@@ -1584,6 +1584,44 @@
1584 return callback(UNAUTHENTICATED_ERROR);1584 return callback(UNAUTHENTICATED_ERROR);
1585 }1585 }
1586 callback({LastChanges: this._importChanges});1586 callback({LastChanges: this._importChanges});
1587 },
1588
1589 /**
1590 *no op* Create a watcher for the deployment specified.
1591
1592 This method is a no op in the fakebackend. We've already sent the user a
1593 notification that things are complete in the normal deployer call.
1594 There's no time to get a watcher and send/sync the watch update down
1595 the road.
1596
1597 @method deployerWatch
1598 @param {Integer} deploymentId The id of the deployment the watch is
1599 for.
1600 @param {Function} callback The callback to send the watcherId to.
1601
1602 */
1603 deployerWatch: function(deploymentId, callback) {
1604 // No op in the fakebackend. Just return and ignore the callback.
1605 return;
1606 },
1607
1608 /**
1609 *no op* Perform a check for updates of a given deployment watcher.
1610
1611 This should never be called and is provided just to aid in grep-ability
1612 of the codebase. Typically this is called via the callback in the
1613 deployerWatch function.
1614
1615
1616 @method deployerNext
1617 @param {Integer} watcherId The id of the watcher from deployerWatch
1618 @param {Function} callback The callback to handle the update response
1619 from the deployer information.
1620
1621 */
1622 deployerNext: function(watcherId, callback) {
1623 // No op in the fakebackend. Just return and ignore the callback.
1624 return;
1587 }1625 }
15881626
1589 });1627 });
15901628
=== modified file 'app/store/env/go.js'
--- app/store/env/go.js 2013-11-18 18:25:08 +0000
+++ app/store/env/go.js 2013-11-20 19:38:27 +0000
@@ -554,15 +554,15 @@
554 The callback will receive an {Object} An object with err, and the554 The callback will receive an {Object} An object with err, and the
555 list of Changes.555 list of Changes.
556556
557 @method deployerWatchUpdate557 @method deployerNext
558 @param {Integer} watchId The ID of the watcher created in depployWatch.558 @param {Integer} watchId The ID of the watcher created in depployWatch.
559 @param {Function} callback The caller's callback function to process559 @param {Function} callback The caller's callback function to process
560 the response.560 the response.
561 */561 */
562 deployerWatchUpdate: function(watchId, callback) {562 deployerNext: function(watchId, callback) {
563 var intermediateCallback;563 var intermediateCallback;
564 if (callback) {564 if (callback) {
565 intermediateCallback = Y.bind(this.handleDeployerWatchUpdate,565 intermediateCallback = Y.bind(this.handleDeployerNext,
566 this, callback);566 this, callback);
567 }567 }
568568
@@ -576,15 +576,15 @@
576 },576 },
577577
578 /**578 /**
579 Wrapper for the deployerWatchUpdate call.579 Wrapper for the deployerNext call.
580580
581 @method handleDeployerWatchUpdate581 @method handleDeployerNext
582 @param {Function} userCallback The original callback to the582 @param {Function} userCallback The original callback to the
583 deployerWatchUpdate function.583 deployerNext function.
584 @param {Object} data The servers response to the deployerWatchUpdate584 @param {Object} data The servers response to the deployerNext
585 call.585 call.
586 */586 */
587 handleDeployerWatchUpdate: function(userCallback, data) {587 handleDeployerNext: function(userCallback, data) {
588 var transformedData = {588 var transformedData = {
589 err: data.Error,589 err: data.Error,
590 Changes: data.Response.Changes590 Changes: data.Response.Changes
591591
=== modified file 'app/store/env/sandbox.js'
--- app/store/env/sandbox.js 2013-11-19 22:30:18 +0000
+++ app/store/env/sandbox.js 2013-11-20 19:38:27 +0000
@@ -1347,7 +1347,34 @@
1347 state.statusDeployer(Y.bind(callback, this));1347 state.statusDeployer(Y.bind(callback, this));
1348 },1348 },
13491349
1350 /**
1351 * *no op* Handle the response from a deployerWatch call from the backend.
1352 *
1353 * @method handleDeployerWatch
1354 * @param {Object} data The contents of the API arguments.
1355 * @param {Object} client The active ClientConnection.
1356 * @param {Object} state An instance of FakeBackend.
1357 * @return {undefined} Side effects only.
1358 *
1359 */
1360 handleDeployerWatch: function(data, client, state) {
1361 return;
1362 },
13501363
1364 /**
1365 * *no op* Handle the response from a deployerNext call from the
1366 * backend.
1367 *
1368 * @method handleDeployerNext
1369 * @param {Object} data The contents of the API arguments.
1370 * @param {Object} client The active ClientConnection.
1371 * @param {Object} state An instance of FakeBackend.
1372 * @return {undefined} Side effects only.
1373 *
1374 */
1375 handleDeployerNext: function(data, client, state) {
1376 return;
1377 },
13511378
1352 /**1379 /**
1353 Handle SetAnnotations messages1380 Handle SetAnnotations messages
13541381
=== modified file 'test/test_bundle_import_helpers.js'
--- test/test_bundle_import_helpers.js 2013-11-19 16:54:54 +0000
+++ test/test_bundle_import_helpers.js 2013-11-20 19:38:27 +0000
@@ -139,7 +139,7 @@
139 };139 };
140140
141 var called = false;141 var called = false;
142 env.deployerWatchUpdate = function(watchId, callback) {142 env.deployerNext = function(watchId, callback) {
143 if (!called) {143 if (!called) {
144 called = true;144 called = true;
145 callback({145 callback({
@@ -192,7 +192,7 @@
192 done();192 done();
193 };193 };
194194
195 env.deployerWatchUpdate = function(watchId, callback) {195 env.deployerNext = function(watchId, callback) {
196 callback({196 callback({
197 err: undefined,197 err: undefined,
198 Changes: [198 Changes: [
@@ -239,7 +239,7 @@
239 };239 };
240240
241 var updated = false;241 var updated = false;
242 env.deployerWatchUpdate = function(watchId, callback) {242 env.deployerNext = function(watchId, callback) {
243 if (!updated) {243 if (!updated) {
244 updated = true;244 updated = true;
245 callback({245 callback({
246246
=== modified file 'test/test_env_go.js'
--- test/test_env_go.js 2013-11-13 21:56:04 +0000
+++ test/test_env_go.js 2013-11-20 19:38:27 +0000
@@ -368,7 +368,7 @@
368 });368 });
369369
370 it('builds a proper watch next request', function() {370 it('builds a proper watch next request', function() {
371 env.deployerWatchUpdate(5);371 env.deployerNext(5);
372 var last_message = conn.last_message();372 var last_message = conn.last_message();
373 var expected = {373 var expected = {
374 Type: 'Deployer',374 Type: 'Deployer',
375375
=== modified file 'test/test_fakebackend.js'
--- test/test_fakebackend.js 2013-11-08 18:57:35 +0000
+++ test/test_fakebackend.js 2013-11-20 19:38:27 +0000
@@ -735,6 +735,28 @@
735 done();735 done();
736 }).then(undefined, done);736 }).then(undefined, done);
737 });737 });
738
739 it('should ignore calls to the deployer watcher', function(done) {
740 // This is no op'd in the fakebackend since it doesn't make sense to
741 // provide a watch status as things happen nearly instantly.
742 fakebackend.deployerWatch(10, function(reply) {
743 // Should never be called.
744 assert.fail('The watcher callback should never be called.');
745 });
746
747 done();
748 });
749
750 it('should ignore calls to the watcher updater', function(done) {
751 // This is no op'd in the fakebackend since it doens't make sense to
752 // provide a watch status as things happen nearly instantly.
753 fakebackend.deployerWatch(10, function(reply) {
754 // Should never be called.
755 assert.fail('The watcher update callback should never be called.');
756 });
757 done();
758 });
759
738 });760 });
739761
740 describe('FakeBackend.uniformOperations', function() {762 describe('FakeBackend.uniformOperations', function() {
741763
=== modified file 'test/test_sandbox_go.js'
--- test/test_sandbox_go.js 2013-10-31 18:40:57 +0000
+++ test/test_sandbox_go.js 2013-11-20 19:38:27 +0000
@@ -1242,7 +1242,6 @@
1242 env.deployerImport(fixture, null, callback);1242 env.deployerImport(fixture, null, callback);
1243 });1243 });
12441244
1245
1246 it('should support deployer status without imports', function(done) {1245 it('should support deployer status without imports', function(done) {
1247 var data = {1246 var data = {
1248 Type: 'Deployer',1247 Type: 'Deployer',
@@ -1261,6 +1260,42 @@
1261 client.send(Y.JSON.stringify(data));1260 client.send(Y.JSON.stringify(data));
1262 });1261 });
12631262
1263 it('should not deal with deployer watches', function(done) {
1264 var data = {
1265 Type: 'Deployer',
1266 Request: 'Watch',
1267 Params: {
1268 DeploymentId: 10
1269 },
1270 RequestId: 42
1271 };
1272 client.onmessage = function(received) {
1273 assert.fail('Should never get a response.');
1274 };
1275 client.open();
1276 client.send(Y.JSON.stringify(data));
1277
1278 done();
1279 });
1280
1281 it('should not deal with watch updates', function(done) {
1282 var data = {
1283 Type: 'Deployer',
1284 Request: 'Next',
1285 Params: {
1286 WatcherId: 11
1287 },
1288 RequestId: 42
1289 };
1290 client.onmessage = function(received) {
1291 assert.fail('Should never get a response.');
1292 };
1293 client.open();
1294 client.send(Y.JSON.stringify(data));
1295
1296 done();
1297 });
1298
1264 });1299 });
12651300
1266})();1301})();

Subscribers

People subscribed via source and target branches