Merge lp://staging/~bcsaller/juju-gui/routing-hash-query into lp://staging/juju-gui/experimental

Proposed by Benjamin Saller
Status: Needs review
Proposed branch: lp://staging/~bcsaller/juju-gui/routing-hash-query
Merge into: lp://staging/juju-gui/experimental
Diff against target: 185 lines (+89/-16)
2 files modified
app/assets/javascripts/ns-routing-app-extension.js (+71/-16)
test/test_routing.js (+18/-0)
To merge this branch: bzr merge lp://staging/~bcsaller/juju-gui/routing-hash-query
Reviewer Review Type Date Requested Status
Juju GUI Hackers Pending
Review via email: mp+168351@code.staging.launchpad.net

Description of the change

Better Hash/QS support in router

`parse`, `url` and `combine` deal more gracefully with hash and qs url
options. In the case of combine the incoming url replaces any existing
values in the hash and qs portions of the URL as might be expected. (This
is rather than some artificial merge policy for example).

https://codereview.appspot.com/9830046/

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

Reviewers: mp+168351_code.launchpad.net,

Message:
Please take a look.

Description:
Better Hash/QS support in router

`parse`, `url` and `combine` deal more gracefully with hash and qs url
options. In the case of combine the incoming url replaces any existing
values in the hash and qs portions of the URL as might be expected.
(This
is rather than some artificial merge policy for example).

https://code.launchpad.net/~bcsaller/juju-gui/routing-hash-query/+merge/168351

(do not edit description out of merge proposal)

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

Affected files:
   A [revision details]
   M app/assets/javascripts/ns-routing-app-extension.js
   M test/test_routing.js

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

LGTM with a concern about the hash parsing to test/check on please.

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

https://codereview.appspot.com/9830046/diff/1/app/assets/javascripts/ns-routing-app-extension.js#newcode111
app/assets/javascripts/ns-routing-app-extension.js:111: var match =
url.match(/#(\w+)([?$])?/);
Can you test that this matches anchor tags with - in them? I don't
recall if \w will work for that. In our case, we've 'namespaced' our
anchors in our tabs code #bws-configuration for instance.

Since there's only one hash per url can we just directly check
location.hash and let the browser do the logic?

https://codereview.appspot.com/9830046/

Revision history for this message
j.c.sackett (jcsackett) wrote :

LGTM, with one question about using a regex over split, largely for my
own edification.

Thanks for this branch, Ben.

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

https://codereview.appspot.com/9830046/diff/1/app/assets/javascripts/ns-routing-app-extension.js#newcode111
app/assets/javascripts/ns-routing-app-extension.js:111: var match =
url.match(/#(\w+)([?$])?/);
Is this actually better than just splitting on '#' much as getQS splits
on '?' Provided Rick's concerns are addressed, I don't know that it
matters, but regexing seems overkill for this.

https://codereview.appspot.com/9830046/

714. By Benjamin Saller

change hash to split rather than regex style code

715. By Benjamin Saller

change hash to split rather than regex style code

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

Unmerged revisions

715. By Benjamin Saller

change hash to split rather than regex style code

714. By Benjamin Saller

change hash to split rather than regex style code

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