Merge lp:~jcsackett/juju-gui/handle-new-charm-charmids into lp:juju-gui/experimental
Proposed by
j.c.sackett
Status: | Merged |
---|---|
Merged at revision: | 799 |
Proposed branch: | lp:~jcsackett/juju-gui/handle-new-charm-charmids |
Merge into: | lp:juju-gui/experimental |
Diff against target: |
43 lines (+14/-2) 2 files modified
app/subapps/browser/browser.js (+2/-1) test/test_browser_app.js (+12/-1) |
To merge this branch: | bzr merge lp:~jcsackett/juju-gui/handle-new-charm-charmids |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Juju GUI Hackers | Pending | ||
Review via email: mp+172907@code.launchpad.net |
Description of the change
Fixes mishandling of new charm IDs
routeDirectCharmID assumed that a charm id would only have 2 parts, series and
charm. New charms have series and charm, but also the ~ identity. This patched
the method to check for 2 parts, or three parts starting with '~'.
To post a comment you must log in.
Reviewers: mp+172907_ code.launchpad. net,
Message:
Please take a look.
Description:
Fixes mishandling of new charm IDs
routeDirectCharmID assumed that a charm id would only have 2 parts,
series and
charm. New charms have series and charm, but also the ~ identity. This
patched
the method to check for 2 parts, or three parts starting with '~'.
https:/ /code.launchpad .net/~jcsackett /juju-gui/ handle- new-charm- charmids/ +merge/ 172907
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/10914044/
Affected files: browser/ browser. js browser_ app.js
A [revision details]
M app/subapps/
M test/test_
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_ browser_ app.js browser_ app.js' browser_ app.js 2013-07-02 17:10:25 +0000 browser_ app.js 2013-07-03 20:30:06 +0000
assert. equal(req. params, undefined);
=== modified file 'test/test_
--- test/test_
+++ test/test_
@@ -280,7 +280,7 @@
});
- it('/charm/id routes to a sidebar view correcetly', function() {
assert. equal(req. params. id, 'precise/ mysql-10' );
+ it('/charm/id routes to the default view correctly', function() {
app = new browser.Browser();
// Stub out the sidebar so we don't render anything.
app.sidebar = function() {};
@@ -294,6 +294,17 @@
});
+ it('/charm/id handles routes for new charms correctly', function() { mysql-10/ ' CharmId( req, null, next); equal(req. params. id, '~foo/precise/ mysql-10' );
+ app = new browser.Browser();
+ // Stub out the sidebar so we don't render anything.
+ app.sidebar = function() {};
+ var req = {
+ path: '~foo/precise/
+ };
+ app.routeDirect
+ assert.
+ });
+
it('does not add sidebar to urls that do not require it', function() {
app = new browser.Browser();
Index: app/subapps/ browser/ browser. js browser/ browser. js' browser/ browser. js 2013-06-27 18:47:57 +0000 browser/ browser. js 2013-07-03 20:46:33 +0000 replace( /^\//, '').replace(/\/$/, '').split('/'),
=== modified file 'app/subapps/
--- app/subapps/
+++ app/subapps/
@@ -765,7 +765,8 @@
var idBits =
req.path.
id = null;
- if (idBits.length === 2) { Mode(req. path);
+ if ((idBits.length === 3 && idBits[0][0] === '~') || // new charms
+ (idBits.length === 2)) { // reviewed
charms
id = this._stripView
}
if (!id) {