Merge lp://staging/~gary/juju-gui/bug1167967 into lp://staging/juju-gui/experimental

Proposed by Gary Poster
Status: Merged
Merged at revision: 540
Proposed branch: lp://staging/~gary/juju-gui/bug1167967
Merge into: lp://staging/juju-gui/experimental
Diff against target: 217 lines (+55/-25)
11 files modified
app/app.js (+1/-1)
app/assets/javascripts/ns-routing-app-extension.js (+3/-1)
app/views/charm.js (+1/-1)
app/views/landscape.js (+2/-1)
app/views/service.js (+2/-1)
app/views/utils.js (+16/-14)
test/test_app_hotkeys.js (+1/-1)
test/test_charm_view.js (+1/-1)
test/test_landscape.js (+15/-0)
test/test_routing.js (+6/-0)
test/test_service_view.js (+7/-4)
To merge this branch: bzr merge lp://staging/~gary/juju-gui/bug1167967
Reviewer Review Type Date Requested Status
Juju GUI Hackers Pending
Review via email: mp+158468@code.staging.launchpad.net

Description of the change

Fix bug 1167967 (hopefully)

This branch attempts to fix the referenced bug. I was unable to duplicate the symptoms locally exactly, but duplicated them closely enough that I am optimistic that these changes address the issue. Regardless, they seem like reasonable changes.

I also fixed a couple of landscape issues I saw with newly created services without annotations.

The aspect of this branch I wonder most if reviewers (particularly Ben) will like is the change to the route url algorithm. If it's not clear why I chose it, I'm happy to discuss my rationale and other options.

Thank you.

https://codereview.appspot.com/8680043/

To post a comment you must log in.
Revision history for this message
Gary Poster (gary) wrote :
Download full text (9.6 KiB)

Reviewers: mp+158468_code.launchpad.net,

Message:
Please take a look.

Description:
Fix bug 1167967 (hopefully)

This branch attempts to fix the referenced bug. I was unable to
duplicate the symptoms locally exactly, but duplicated them closely
enough that I am optimistic that these changes address the issue.
Regardless, they seem like reasonable changes.

I also fixed a couple of landscape issues I saw with newly created
services without annotations.

The aspect of this branch I wonder most if reviewers (particularly Ben)
will like is the change to the route url algorithm. If it's not clear
why I chose it, I'm happy to discuss my rationale and other options.

Thank you.

https://code.launchpad.net/~gary/juju-gui/bug1167967/+merge/158468

(do not edit description out of merge proposal)

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

Affected files:
   A [revision details]
   M app/app.js
   M app/assets/javascripts/ns-routing-app-extension.js
   M app/views/charm.js
   M app/views/landscape.js
   M app/views/service.js
   M app/views/utils.js
   M test/test_app_hotkeys.js
   M test/test_charm_view.js
   M test/test_landscape.js
   M test/test_routing.js
   M test/test_service_view.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: app/app.js
=== modified file 'app/app.js'
--- app/app.js 2013-04-09 20:50:46 +0000
+++ app/app.js 2013-04-11 19:46:11 +0000
@@ -184,7 +184,7 @@

        Y.detachAll('window-alt-E-pressed');
        Y.on('window-alt-E-pressed', function(data) {
- this.fire('navigateTo', { url: '/' });
+ this.fire('navigateTo', { url: '/:gui:/' });
          data.preventDefault = true;
        }, this);

Index: test/test_app_hotkeys.js
=== modified file 'test/test_app_hotkeys.js'
--- test/test_app_hotkeys.js 2013-04-08 18:23:28 +0000
+++ test/test_app_hotkeys.js 2013-04-11 19:46:11 +0000
@@ -50,7 +50,7 @@
    it('should listen for alt-E events', function() {
      var altEtriggered = false;
      app.on('navigateTo', function(ev) {
- if (ev && ev.url === '/') {
+ if (ev && ev.url === '/:gui:/') {
          altEtriggered = true;
        }
        // Avoid URL change performed by additional listeners.

Index: test/test_charm_view.js
=== modified file 'test/test_charm_view.js'
--- test/test_charm_view.js 2013-02-15 11:58:05 +0000
+++ test/test_charm_view.js 2013-04-11 19:46:11 +0000
@@ -88,7 +88,7 @@
          env: env});
        var redirected = false;
        charmView.on('navigateTo', function(e) {
- assert.equal('/', e.url);
+ assert.equal('/:gui:/', e.url);
          redirected = true;
        });
        var deployInput = charmView.get('container').one('#charm-deploy');

Index: app/views/charm.js
=== modified file 'app/views/charm.js'
--- app/views/charm.js 2013-03-19 21:58:04 +0000
+++ app/views/charm.js 2013-04-11 19:46:11 +0000
@@ -97,7 +97,7 @@
        // The deploy call generates an event ...

Read more...

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

LGTM.

Some suggestions around the url handling but take it or leave it.

https://codereview.appspot.com/8680043/diff/1/app/assets/javascripts/ns-routing-app-extension.js
File app/assets/javascripts/ns-routing-app-extension.js (right):

https://codereview.appspot.com/8680043/diff/1/app/assets/javascripts/ns-routing-app-extension.js#newcode171
app/assets/javascripts/ns-routing-app-extension.js:171: url += ':' + ns
+ ':' + base[ns];
Maybe a flag to the method to control this behavior so we can use this
method to generate all such links?

https://codereview.appspot.com/8680043/diff/1/app/views/charm.js
File app/views/charm.js (right):

https://codereview.appspot.com/8680043/diff/1/app/views/charm.js#newcode100
app/views/charm.js:100: this.fire('navigateTo', {url: '/:gui:/'});
In cases like this I previously recommended that we use nsRouter.url to
create the URL. That no longer works in this case as '/' becomes
implicit in the namespace.

I like the abstraction of something that can build and assemble proper
URLs for the developer. Maybe a flag to nsRouter.url that forces
inclusion. I'll make a note in the router code as well but its up to you
if you agree or not.

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

https://codereview.appspot.com/8680043/diff/1/app/views/landscape.js#oldcode132
app/views/landscape.js:132: if (!modelAnnotation) {
oops. While improv doesn't add these annotations to new nodes it was my
understanding that landscape will? Still, I'm sure there is going to be
some latency in that process and these checks are valid.

https://codereview.appspot.com/8680043/diff/1/test/test_routing.js
File test/test_routing.js (right):

https://codereview.appspot.com/8680043/diff/1/test/test_routing.js#newcode53
test/test_routing.js:53: assert.strictEqual(u, '/:foo:/shazam/');
The reason I originally went the other way was I though presence in the
URL could indicate state, such that :inspector:/ might indicate an open
panel. I think you're right though that there are other ways to model it
and making '/' implicit is fine.

https://codereview.appspot.com/8680043/

Revision history for this message
Madison Scott-Clary (makyo) wrote :

LGTM with Ben's comments at least replied to. Thanks!

https://codereview.appspot.com/8680043/diff/1/test/test_service_view.js
File test/test_service_view.js (right):

https://codereview.appspot.com/8680043/diff/1/test/test_service_view.js#newcode359
test/test_service_view.js:359: dbUpdated = true;
+1 :)

https://codereview.appspot.com/8680043/

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

On 2013/04/11 20:10:37, bcsaller wrote:
> LGTM.

> Some suggestions around the url handling but take it or leave it.

Thank you for the thoughtful review.

https://codereview.appspot.com/8680043/diff/1/app/assets/javascripts/ns-routing-app-extension.js
> File app/assets/javascripts/ns-routing-app-extension.js (right):

https://codereview.appspot.com/8680043/diff/1/app/assets/javascripts/ns-routing-app-extension.js#newcode171
> app/assets/javascripts/ns-routing-app-extension.js:171: url += ':' +
ns + ':' +
> base[ns];
> Maybe a flag to the method to control this behavior so we can use this
method to
> generate all such links?

I agonized about this comment a bit. First I made the new behavior
optional, and wrote tests. Then I decided that I thought the new
behavior ought to be the easy, new one, because I think it is what we
usually want, and undid all the option work. Then I decided to make an
option to have the old behavior...but I still kept the non-calculated
root strings ('/:gui:/') because I thought they were clear enough and
short enough. I don't know. I'm still a bit conflicted, but I feel
like removing root paths is the right thing to do, and the right thing
to make easy.

> https://codereview.appspot.com/8680043/diff/1/app/views/charm.js
> File app/views/charm.js (right):

https://codereview.appspot.com/8680043/diff/1/app/views/charm.js#newcode100
> app/views/charm.js:100: this.fire('navigateTo', {url: '/:gui:/'});
> In cases like this I previously recommended that we use nsRouter.url
to create
> the URL. That no longer works in this case as '/' becomes implicit in
the
> namespace.

For this case, right. I could use the flag I added, but I currently
think that the string is fine for a root path.

> I like the abstraction of something that can build and assemble proper
URLs for
> the developer. Maybe a flag to nsRouter.url that forces inclusion.
I'll make a
> note in the router code as well but its up to you if you agree or not.

Yeah, I agree but it conflicts with other desires I have for this.

> https://codereview.appspot.com/8680043/diff/1/app/views/landscape.js
> File app/views/landscape.js (left):

https://codereview.appspot.com/8680043/diff/1/app/views/landscape.js#oldcode132
> app/views/landscape.js:132: if (!modelAnnotation) {
> oops. While improv doesn't add these annotations to new nodes it was
my
> understanding that landscape will? Still, I'm sure there is going to
be some
> latency in that process and these checks are valid.

Yeah, that's what I thought.

> https://codereview.appspot.com/8680043/diff/1/test/test_routing.js
> File test/test_routing.js (right):

https://codereview.appspot.com/8680043/diff/1/test/test_routing.js#newcode53
> test/test_routing.js:53: assert.strictEqual(u, '/:foo:/shazam/');
> The reason I originally went the other way was I though presence in
the URL
> could indicate state, such that :inspector:/ might indicate an open
panel. I
> think you're right though that there are other ways to model it and
making '/'
> implicit is fine.

Cool, yeah.

https://codereview.appspot.com/8680043/

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

On 2013/04/11 22:45:15, matthew.scott wrote:
> LGTM with Ben's comments at least replied to. Thanks!

Cool, thank you for the review.

https://codereview.appspot.com/8680043/

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

*** Submitted:

Fix bug 1167967 (hopefully)

This branch attempts to fix the referenced bug. I was unable to
duplicate the symptoms locally exactly, but duplicated them closely
enough that I am optimistic that these changes address the issue.
Regardless, they seem like reasonable changes.

I also fixed a couple of landscape issues I saw with newly created
services without annotations.

The aspect of this branch I wonder most if reviewers (particularly Ben)
will like is the change to the route url algorithm. If it's not clear
why I chose it, I'm happy to discuss my rationale and other options.

Thank you.

R=bcsaller, matthew.scott
CC=
https://codereview.appspot.com/8680043

https://codereview.appspot.com/8680043/

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

On 04/11/2013 07:16 PM, <email address hidden> wrote:
>
> https://codereview.appspot.com/8680043/diff/1/app/views/charm.js#newcode100
>> app/views/charm.js:100: this.fire('navigateTo', {url: '/:gui:/'});
>> In cases like this I previously recommended that we use nsRouter.url
> to create
>> the URL. That no longer works in this case as '/' becomes implicit in
> the
>> namespace.
>
> For this case, right. I could use the flag I added, but I currently
> think that the string is fine for a root path.

Eh. I'm submitting this and I still don't know. Maybe what I did
first, post-review--"combine" excluded root paths by default and "url"
included them by default--was right. But that feels wrong too. Ugh.

If we determine that "url"'s utility has really been reduced by my
changes, then I would like to look at this again.

Thank you.

Gary

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