Merge lp://staging/~bcsaller/juju-gui/serviceUpdateOrdering into lp://staging/juju-gui/experimental

Proposed by Benjamin Saller
Status: Merged
Merged at revision: 1099
Proposed branch: lp://staging/~bcsaller/juju-gui/serviceUpdateOrdering
Merge into: lp://staging/juju-gui/experimental
Diff against target: 181 lines (+16/-70)
5 files modified
app/store/env/fakebackend.js (+7/-8)
app/store/env/go.js (+6/-1)
app/store/env/sandbox.js (+3/-3)
app/views/inspector.js (+0/-12)
test/test_inspector_settings.js (+0/-46)
To merge this branch: bzr merge lp://staging/~bcsaller/juju-gui/serviceUpdateOrdering
Reviewer Review Type Date Requested Status
Juju GUI Hackers Pending
Review via email: mp+188183@code.staging.launchpad.net

Description of the change

Fix Service Destroy issue

Business logic in the view layer was messing up the
process of service destruction. This adds a notification
when a service is destroyed but waits for the delta to
update the canvas.

https://codereview.appspot.com/14034045/

To post a comment you must log in.
Revision history for this message
Benjamin Saller (bcsaller) wrote :
Download full text (7.5 KiB)

Reviewers: mp+188183_code.launchpad.net,

Message:
Please take a look.

Description:
Fix Service Destroy issue

Business logic in the view layer was messing up the
process of service destruction.

https://code.launchpad.net/~bcsaller/juju-gui/serviceUpdateOrdering/+merge/188183

(do not edit description out of merge proposal)

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

Affected files (+18, -70 lines):
   A [revision details]
   M app/store/env/fakebackend.js
   M app/store/env/go.js
   M app/store/env/sandbox.js
   M app/views/inspector.js
   M test/test_inspector_settings.js

Index: [revision details]
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: <email address hidden>
+New revision: <email address hidden>

Index: test/test_inspector_settings.js
=== modified file 'test/test_inspector_settings.js'
--- test/test_inspector_settings.js 2013-09-27 18:20:06 +0000
+++ test/test_inspector_settings.js 2013-09-27 23:41:44 +0000
@@ -227,52 +227,6 @@
      assert.equal(typeof events['.cancel-destroy'].click, 'function');
    });

- it('responds to service removal by cleaning out the DB', function() {
- // If destroying a service succeeds, the service is removed from the
- // database.
- var removeServiceCalled = false,
- removeRelationsCalled = false,
- destroyServiceCalled = false;
-
- inspector = setUpInspector();
-
- var service = {
- get: function(name) {
- assert.equal(name, 'id');
- return 'SERVICE-ID';
- },
- destroy: function() {
- destroyServiceCalled = true;
- }
- };
- var RELATIONS = 'all of the relations of the service being removed';
-
- var db = {
- services: {
- remove: function(serviceToBeRemoved) {
- assert.deepEqual(serviceToBeRemoved, service);
- removeServiceCalled = true;
- }
- },
- relations: {
- filter: function(predicate) {
- return RELATIONS;
- },
- remove: function(relationsToBeRemoved) {
- assert.deepEqual(relationsToBeRemoved, RELATIONS);
- removeRelationsCalled = true;
- }
- }
- };
-
- var evt = {err: false};
-
- inspector._destroyServiceCallback(service, db, evt);
- assert.isTrue(removeServiceCalled);
- assert.isTrue(removeRelationsCalled);
- assert.isTrue(removeServiceCalled);
- });
-
    it('responds to service removal failure by alerting the user',
function() {
      var notificationAdded;

Index: app/views/inspector.js
=== modified file 'app/views/inspector.js'
--- app/views/inspector.js 2013-09-27 18:20:06 +0000
+++ app/views/inspector.js 2013-09-27 23:41:44 +0000
@@ -458,18 +458,6 @@
                modelId: service
              })
          );
- } else {
- // If the removal succeeded on the server side, we need to remove
the
- // service from the database. (Why wouldn't we get an update from
the
- // server side that would do this for us?).
- db.services.remove(service);
...

Read more...

Revision history for this message
Jeff Pihach (hatch) wrote :

Thanks for this fix - the error is gone but I am concerned about one of
the modifications.

https://codereview.appspot.com/14034045/diff/1/app/views/inspector.js
File app/views/inspector.js (left):

https://codereview.appspot.com/14034045/diff/1/app/views/inspector.js#oldcode461
app/views/inspector.js:461: } else {
With this gone the service icon hangs around in the canvas until the
next delta comes in - I would imagine it would be a longer delay with no
indication that something is happening on core.

https://codereview.appspot.com/14034045/diff/1/test/test_inspector_settings.js
File test/test_inspector_settings.js (left):

https://codereview.appspot.com/14034045/diff/1/test/test_inspector_settings.js#oldcode230
test/test_inspector_settings.js:230: it('responds to service removal by
cleaning out the DB', function() {
See comment on previous file about this.

https://codereview.appspot.com/14034045/

Revision history for this message
Benjamin Saller (bcsaller) wrote :

Thanks, feedback here for other reviewers even though we talked on IRC

https://codereview.appspot.com/14034045/diff/1/app/views/inspector.js
File app/views/inspector.js (left):

https://codereview.appspot.com/14034045/diff/1/app/views/inspector.js#oldcode461
app/views/inspector.js:461: } else {
On 2013/09/28 00:13:47, jeff.pihach wrote:
> With this gone the service icon hangs around in the canvas until the
next delta
> comes in - I would imagine it would be a longer delay with no
indication that
> something is happening on core.

Its not even the next delta, its the delta where the service was removed
from juju-core that we are waiting on.

I think notifications make sense here as a UX around the pending action.
We could toggle some state on the model locally to indicate we expect it
be Dying or pending or somesuch, but to destroy it w/o confirmation
from the server is an issue (see failing stop hooks talk from before).

https://codereview.appspot.com/14034045/

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

LGTM with trivial. Thank you!

https://codereview.appspot.com/14034045/diff/1/app/store/env/fakebackend.js
File app/store/env/fakebackend.js (left):

https://codereview.appspot.com/14034045/diff/1/app/store/env/fakebackend.js#oldcode1550
app/store/env/fakebackend.js:1550: self.sendDelta();
I'm glad we don't have to do this. I assume the reason is that the
usual gradual delta messages handle this fine. Please let me know if
that assumption is incorrect.

https://codereview.appspot.com/14034045/diff/1/app/store/env/go.js
File app/store/env/go.js (right):

https://codereview.appspot.com/14034045/diff/1/app/store/env/go.js#newcode261
app/store/env/go.js:261: // Reverse the sort order for removes.
Please add a comment as to why.

https://codereview.appspot.com/14034045/diff/1/app/store/env/sandbox.js
File app/store/env/sandbox.js (right):

https://codereview.appspot.com/14034045/diff/1/app/store/env/sandbox.js#newcode273
app/store/env/sandbox.js:273: deltas.push(delta);
I don't really care, but why did you make this change? Do you think it
is clearer that the one-liner?

https://codereview.appspot.com/14034045/diff/1/app/views/inspector.js
File app/views/inspector.js (left):

https://codereview.appspot.com/14034045/diff/1/app/views/inspector.js#oldcode461
app/views/inspector.js:461: } else {
On 2013/09/28 00:44:54, benjamin.saller wrote:
> On 2013/09/28 00:13:47, jeff.pihach wrote:
> > With this gone the service icon hangs around in the canvas until the
next
> delta
> > comes in - I would imagine it would be a longer delay with no
indication that
> > something is happening on core.

> Its not even the next delta, its the delta where the service was
removed from
> juju-core that we are waiting on.

> I think notifications make sense here as a UX around the pending
action. We
> could toggle some state on the model locally to indicate we expect it
be Dying
> or pending or somesuch, but to destroy it w/o confirmation from the
server is
> an issue (see failing stop hooks talk from before).

Right. I agree that this is what we agreed on.

https://codereview.appspot.com/14034045/

Revision history for this message
Jeff Pihach (hatch) wrote :

LGTM with the new notification as per our chat.

Thanks for the fix!

https://codereview.appspot.com/14034045/

Revision history for this message
Benjamin Saller (bcsaller) wrote :

*** Submitted:

Fix Service Destroy issue

Business logic in the view layer was messing up the
process of service destruction. This adds a notification
when a service is destroyed but waits for the delta to
update the canvas.

R=jeff.pihach, benjamin.saller, gary.poster
CC=
https://codereview.appspot.com/14034045

https://codereview.appspot.com/14034045/

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches