couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robertkowal...@apache.org
Subject [2/2] fauxton commit: updated refs/heads/master to e53deb5
Date Tue, 29 Nov 2016 14:27:59 GMT
encodeding url path for database name with special characters

PR: #813
PR-URL: https://github.com/apache/couchdb-fauxton/pull/813
Reviewed-By: Robert Kowalski <rok@kowalski.gd>


Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/1aa4ca6f
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/1aa4ca6f
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/1aa4ca6f

Branch: refs/heads/master
Commit: 1aa4ca6f34a718c294a06a1301f39fe05f157a1c
Parents: dd5eb49
Author: Tim Pinington <timpinington@gmail.com>
Authored: Thu Nov 24 00:16:46 2016 +0000
Committer: Robert Kowalski <robertkowalski@apache.org>
Committed: Tue Nov 29 15:27:33 2016 +0100

----------------------------------------------------------------------
 app/addons/auth/base.js                                  |  8 ++++----
 app/addons/components/components/apibar.js               |  6 +++---
 app/addons/components/header-breadcrumbs.jsx             |  2 +-
 app/addons/config/base.js                                |  2 +-
 .../databases/tests/nightwatch/specialCharListLinks.js   | 11 +++++------
 app/addons/documentation/base.js                         |  2 +-
 .../documentation/tests/nightwatch/checksDocsPage.js     |  2 +-
 app/addons/documents/components/header-docs-left.jsx     |  2 +-
 app/addons/documents/doc-editor/actions.js               |  4 ++--
 app/addons/documents/doc-editor/components.react.jsx     |  4 ++--
 app/addons/documents/helpers.js                          |  4 ++--
 app/addons/documents/mango/mango.components.react.jsx    |  2 +-
 app/addons/documents/routes-doc-editor.js                |  4 ++--
 app/addons/documents/sidebar/sidebar.react.jsx           | 10 +++++-----
 .../documents/tests/nightwatch/navigateFromNewDoc.js     |  8 ++++----
 .../fauxton/tests/nightwatch/notificationCenter.js       |  4 ++--
 .../replication/tests/nightwatch/replicationactivity.js  |  4 ++--
 app/addons/setup/base.js                                 |  2 +-
 app/addons/verifyinstall/base.js                         |  2 +-
 app/core/api.js                                          | 11 +++++++++++
 app/core/utils.js                                        |  6 ++----
 test/nightwatch_tests/custom-commands/auth/loginToGUI.js |  6 +++---
 22 files changed, 57 insertions(+), 49 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/1aa4ca6f/app/addons/auth/base.js
----------------------------------------------------------------------
diff --git a/app/addons/auth/base.js b/app/addons/auth/base.js
index 5956401..237a450 100644
--- a/app/addons/auth/base.js
+++ b/app/addons/auth/base.js
@@ -24,7 +24,7 @@ Auth.initialize = function () {
   FauxtonAPI.addHeaderLink({
     id: 'auth',
     title: 'Login',
-    href: '#login',
+    href: '#/login',
     icon: 'fonticon-user',
     bottomNav: true
   });
@@ -37,7 +37,7 @@ Auth.initialize = function () {
       link = {
         id: 'auth',
         title: 'Admin Party!',
-        href: '#createAdmin',
+        href: '#/createAdmin',
         icon: 'fonticon-user',
         bottomNav: true
       };
@@ -45,7 +45,7 @@ Auth.initialize = function () {
       link = {
         id: 'auth',
         title: session.user().name,
-        href: '#changePassword',
+        href: '#/changePassword',
         icon: 'fonticon-user',
         bottomNav: true
       };
@@ -64,7 +64,7 @@ Auth.initialize = function () {
       link = {
         id: 'auth',
         title: 'Login',
-        href: '#login',
+        href: '#/login',
         icon: 'fonticon-user',
         bottomNav: true
       };

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/1aa4ca6f/app/addons/components/components/apibar.js
----------------------------------------------------------------------
diff --git a/app/addons/components/components/apibar.js b/app/addons/components/components/apibar.js
index c853cc8..6967852 100644
--- a/app/addons/components/components/apibar.js
+++ b/app/addons/components/components/apibar.js
@@ -56,7 +56,7 @@ export const APIBar = React.createClass({
     if (!this.props.contentVisible) {
       return null;
     }
-
+    let endpoint = FauxtonAPI.url.decode(this.props.endpoint);
     return (
       <TrayContents className="tray show-tray api-bar-tray">
         <div className="input-prepend input-append">
@@ -68,14 +68,14 @@ export const APIBar = React.createClass({
           <FauxtonComponents.ClipboardWithTextField
             onClipBoardClick={this.showCopiedMessage}
             text="Copy URL"
-            textToCopy={this.props.endpoint}
+            textToCopy={endpoint}
             showCopyIcon={false}
             uniqueKey="clipboard-apiurl" />
 
           <div className="add-on">
             <a
               data-bypass="true"
-              href={this.props.endpoint}
+              href={endpoint}
               target="_blank"
               className="btn"
             >

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/1aa4ca6f/app/addons/components/header-breadcrumbs.jsx
----------------------------------------------------------------------
diff --git a/app/addons/components/header-breadcrumbs.jsx b/app/addons/components/header-breadcrumbs.jsx
index 8c3cdef..40ffaaf 100644
--- a/app/addons/components/header-breadcrumbs.jsx
+++ b/app/addons/components/header-breadcrumbs.jsx
@@ -48,7 +48,7 @@ function getChildren (crumbs) {
     if (c.link) {
       res = [
         <CrumbElement key={i}>
-          <a className="faux-header__breadcrumbs-link" href={c.link}>{c.name}</a>
+          <a className="faux-header__breadcrumbs-link" href={'#/' + c.link}>{c.name}</a>
         </CrumbElement>
       ];
     }

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/1aa4ca6f/app/addons/config/base.js
----------------------------------------------------------------------
diff --git a/app/addons/config/base.js b/app/addons/config/base.js
index a10cab0..8913ecf 100644
--- a/app/addons/config/base.js
+++ b/app/addons/config/base.js
@@ -17,7 +17,7 @@ import "./assets/less/config.less";
 Config.initialize = function () {
   FauxtonAPI.addHeaderLink({
     title: 'Configuration',
-    href: '#_config',
+    href: '#/_config',
     icon: 'fonticon-cog',
     className: 'config'
   });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/1aa4ca6f/app/addons/databases/tests/nightwatch/specialCharListLinks.js
----------------------------------------------------------------------
diff --git a/app/addons/databases/tests/nightwatch/specialCharListLinks.js b/app/addons/databases/tests/nightwatch/specialCharListLinks.js
index 493a4d2..d284df3 100644
--- a/app/addons/databases/tests/nightwatch/specialCharListLinks.js
+++ b/app/addons/databases/tests/nightwatch/specialCharListLinks.js
@@ -18,16 +18,15 @@ const testDatabases = [
   't/t-//t_f'
 ];
 
-const tests = {};
-
-testDatabases.forEach((db) => {
-  return tests[`Db List works with special chars ${db}`] = createTest(db);
-});
+const tests = testDatabases.reduce((tests, db) => {
+  tests[`Db List works with special chars ${db}`] = createTest(db);
+  return tests;
+}, {});
 
 module.exports = tests;
 
 function createTest (db) {
-  return function (client) {
+  return (client) => {
 
     const waitTime = client.globals.maxWaitTime;
     const baseUrl = client.globals.test_settings.launch_url;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/1aa4ca6f/app/addons/documentation/base.js
----------------------------------------------------------------------
diff --git a/app/addons/documentation/base.js b/app/addons/documentation/base.js
index 76a998b..d69f8fe 100644
--- a/app/addons/documentation/base.js
+++ b/app/addons/documentation/base.js
@@ -20,7 +20,7 @@ Documentation.initialize = function () {
     id: 'Documentation',
     title: 'Documentation',
     icon: 'fonticon-bookmark',
-    href: '/documentation',
+    href: '#/documentation',
     bottomNav: true,
     top: true
   });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/1aa4ca6f/app/addons/documentation/tests/nightwatch/checksDocsPage.js
----------------------------------------------------------------------
diff --git a/app/addons/documentation/tests/nightwatch/checksDocsPage.js b/app/addons/documentation/tests/nightwatch/checksDocsPage.js
index 9aaeaec..7af6f83 100644
--- a/app/addons/documentation/tests/nightwatch/checksDocsPage.js
+++ b/app/addons/documentation/tests/nightwatch/checksDocsPage.js
@@ -19,7 +19,7 @@ module.exports = {
 
     client
       .loginToGUI()
-      .clickWhenVisible('a[href="/documentation"]')
+      .clickWhenVisible('a[href="#/documentation"]')
       .waitForElementVisible('a[href="http://docs.couchdb.org/en/latest/"]', waitTime, false)
       .waitForElementVisible('a[href="/_utils/docs/contents.html"]', waitTime, false)
       .waitForElementVisible('a[href="http://blog.couchdb.org/"]', waitTime, false)

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/1aa4ca6f/app/addons/documents/components/header-docs-left.jsx
----------------------------------------------------------------------
diff --git a/app/addons/documents/components/header-docs-left.jsx b/app/addons/documents/components/header-docs-left.jsx
index d715a1e..85b893c 100644
--- a/app/addons/documents/components/header-docs-left.jsx
+++ b/app/addons/documents/components/header-docs-left.jsx
@@ -71,7 +71,7 @@ const HeaderDocsLeft = ({dbName}) => {
 
   return (
     <div className="faux-header__doc-header-left">
-      <button type="button" className="faux-header__doc-header-backlink" onClick={() =>
{ FauxtonAPI.navigate('#_all_dbs'); }}>
+      <button type="button" className="faux-header__doc-header-backlink" onClick={() =>
{ FauxtonAPI.navigate('#/_all_dbs'); }}>
         <i className="faux-header__doc-header-backlink__icon fonticon fonticon-left-open"
/>
       </button>
       <div className="faux-header__doc-header-title flex-fill" title={dbName}>

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/1aa4ca6f/app/addons/documents/doc-editor/actions.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/doc-editor/actions.js b/app/addons/documents/doc-editor/actions.js
index 9331ddd..ddc9656 100644
--- a/app/addons/documents/doc-editor/actions.js
+++ b/app/addons/documents/doc-editor/actions.js
@@ -13,7 +13,7 @@
 /* global FormData */
 
 import app from "../../../app";
-import FauxtonAPI from "../../../core/api";
+import FauxtonAPI, { url } from "../../../core/api";
 import ActionTypes from "./actiontypes";
 
 var xhr;
@@ -53,7 +53,7 @@ function saveDoc (doc, isValidDoc, onSave) {
 
     doc.save().then(function () {
       onSave(doc.prettyJSON());
-      FauxtonAPI.navigate('#' + FauxtonAPI.urls('allDocs', 'app', doc.database.id), {trigger:
true});
+      FauxtonAPI.navigate('#/' + FauxtonAPI.urls('allDocs', 'app', url.encode(doc.database.id)),
{trigger: true});
     }).fail(function (xhr) {
       FauxtonAPI.addNotification({
         msg: 'Save failed: ' + JSON.parse(xhr.responseText).reason,

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/1aa4ca6f/app/addons/documents/doc-editor/components.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/documents/doc-editor/components.react.jsx b/app/addons/documents/doc-editor/components.react.jsx
index b1956f5..7069f1b 100644
--- a/app/addons/documents/doc-editor/components.react.jsx
+++ b/app/addons/documents/doc-editor/components.react.jsx
@@ -163,7 +163,7 @@ var DocEditorController = React.createClass({
 
   render: function () {
     var saveButtonLabel = (this.props.isNewDoc) ? 'Create Document' : 'Save Changes';
-
+    let endpoint = FauxtonAPI.urls('allDocs', 'app', FauxtonAPI.url.encode(this.props.database.id));
     return (
       <div>
         <div id="doc-editor-actions-panel">
@@ -172,7 +172,7 @@ var DocEditorController = React.createClass({
               <i className="icon fonticon-ok-circled"></i> {saveButtonLabel}
             </button>
             <div>
-              <a href={FauxtonAPI.urls('allDocs', 'app', this.props.database.id)} className="js-back
cancel-button">Cancel</a>
+              <a href={`#/${endpoint}`} className="js-back cancel-button">Cancel</a>
             </div>
           </div>
           <div className="alignRight">

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/1aa4ca6f/app/addons/documents/helpers.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/helpers.js b/app/addons/documents/helpers.js
index 08f7192..1293843 100644
--- a/app/addons/documents/helpers.js
+++ b/app/addons/documents/helpers.js
@@ -23,7 +23,7 @@ function getSeqNum (val) {
 
 function getNewButtonLinks (databaseName) {
   var addLinks = FauxtonAPI.getExtensions('sidebar:links');
-  var newUrlPrefix = '#' + FauxtonAPI.urls('databaseBaseURL', 'app', databaseName);
+  var newUrlPrefix = '#' + FauxtonAPI.urls('databaseBaseURL', 'app', FauxtonAPI.url.encode(databaseName));
 
   var addNewLinks = _.reduce(addLinks, function (menuLinks, link) {
     menuLinks.push({
@@ -50,7 +50,7 @@ function getNewButtonLinks (databaseName) {
 }
 
 function getMangoLink (databaseName) {
-  var newUrlPrefix = '#' + FauxtonAPI.urls('databaseBaseURL', 'app', databaseName);
+  var newUrlPrefix = '#' + FauxtonAPI.urls('databaseBaseURL', 'app', FauxtonAPI.url.encode(databaseName));
 
   return {
     title: app.i18n.en_US['new-mango-index'],

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/1aa4ca6f/app/addons/documents/mango/mango.components.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/documents/mango/mango.components.react.jsx b/app/addons/documents/mango/mango.components.react.jsx
index 113a7f9..abc5ddc 100644
--- a/app/addons/documents/mango/mango.components.react.jsx
+++ b/app/addons/documents/mango/mango.components.react.jsx
@@ -121,7 +121,7 @@ var MangoEditor = React.createClass({
   },
 
   render: function () {
-    var url = '#/' + FauxtonAPI.urls('allDocs', 'app', this.props.dbName, '');
+    var url = '#/' + FauxtonAPI.urls('allDocs', 'app', FauxtonAPI.url.encode(this.props.dbName),
'');
 
     return (
       <div className="mango-editor-wrapper">

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/1aa4ca6f/app/addons/documents/routes-doc-editor.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/routes-doc-editor.js b/app/addons/documents/routes-doc-editor.js
index 196c642..b13fc32 100644
--- a/app/addons/documents/routes-doc-editor.js
+++ b/app/addons/documents/routes-doc-editor.js
@@ -45,7 +45,7 @@ const DocEditorRouteObject = FauxtonAPI.RouteObject.extend({
   crumbs: function () {},
 
   revisionBrowser: function (databaseName, docId) {
-    const backLink = FauxtonAPI.urls('allDocs', 'app', this.database.safeID());
+    const backLink = FauxtonAPI.urls('allDocs', 'app', FauxtonAPI.url.encode(this.database.safeID()));
     const docUrl = FauxtonAPI.urls('document', 'app', this.database.safeID(), this.docId);
 
     this.crumbs = [
@@ -59,7 +59,7 @@ const DocEditorRouteObject = FauxtonAPI.RouteObject.extend({
   },
 
   codeEditor: function (databaseName, docId) {
-    const backLink = FauxtonAPI.urls('allDocs', 'app', databaseName);
+    const backLink = FauxtonAPI.urls('allDocs', 'app', FauxtonAPI.url.encode(databaseName));
 
     this.crumbs =  [
       { name: databaseName, link: backLink },

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/1aa4ca6f/app/addons/documents/sidebar/sidebar.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/documents/sidebar/sidebar.react.jsx b/app/addons/documents/sidebar/sidebar.react.jsx
index 700f035..b791fa2 100644
--- a/app/addons/documents/sidebar/sidebar.react.jsx
+++ b/app/addons/documents/sidebar/sidebar.react.jsx
@@ -61,10 +61,11 @@ var MainSidebar = React.createClass({
 
   render: function () {
     var docLinks = this.buildDocLinks();
-    var changesUrl     = '#' + FauxtonAPI.urls('changes', 'app', this.props.databaseName,
'');
-    var permissionsUrl = '#' + FauxtonAPI.urls('permissions', 'app', this.props.databaseName);
-    var databaseUrl    = FauxtonAPI.urls('allDocs', 'app', this.props.databaseName, '');
-    var mangoQueryUrl  = FauxtonAPI.urls('mango', 'query-app', this.props.databaseName);
+    var dbEncoded = FauxtonAPI.url.encode(this.props.databaseName);
+    var changesUrl     = '#' + FauxtonAPI.urls('changes', 'app', dbEncoded, '');
+    var permissionsUrl = '#' + FauxtonAPI.urls('permissions', 'app', dbEncoded);
+    var databaseUrl    = FauxtonAPI.urls('allDocs', 'app', dbEncoded, '');
+    var mangoQueryUrl  = FauxtonAPI.urls('mango', 'query-app', dbEncoded);
     var runQueryWithMangoText = app.i18n.en_US['run-query-with-mango'];
     var buttonLinks = this.getNewButtonLinks();
 
@@ -442,7 +443,6 @@ var SidebarController = React.createClass({
       availableDesignDocIds: store.getAvailableDesignDocs(),
       toggledSections: store.getToggledSections(),
       isLoading: store.isLoading(),
-      database: store.getDatabase(),
       deleteDbModalProperties: deleteDbModalStore.getShowDeleteDatabaseModal(),
 
       deleteIndexModalVisible: store.isDeleteIndexModalVisible(),

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/1aa4ca6f/app/addons/documents/tests/nightwatch/navigateFromNewDoc.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/tests/nightwatch/navigateFromNewDoc.js b/app/addons/documents/tests/nightwatch/navigateFromNewDoc.js
index 0f51deb..786f5fa 100644
--- a/app/addons/documents/tests/nightwatch/navigateFromNewDoc.js
+++ b/app/addons/documents/tests/nightwatch/navigateFromNewDoc.js
@@ -21,18 +21,18 @@ module.exports = {
       newDatabaseName = client.globals.testDatabaseName,
       baseUrl = client.globals.test_settings.launch_url;
 
-    var newLink = '#/database/' + newDatabaseName + '/new';
+    var newLink = '/#/database/' + newDatabaseName + '/new';
 
     client
       .loginToGUI()
       .url(baseUrl + '/#/database/' + newDatabaseName + '/_all_docs')
       .clickWhenVisible('#new-all-docs-button a')
-      .clickWhenVisible('#new-all-docs-button a[href="' + newLink + '"]')
+      .clickWhenVisible('#new-all-docs-button a[href="' + newLink.replace("/", "") + '"]')
       .waitForElementPresent('.code-region', waitTime, false)
-      .verify.urlEquals(baseUrl + '/' + newLink)
+      .verify.urlEquals(baseUrl + newLink)
 
       // now redirect back to the all docs page and check it's loaded properly
       .clickWhenVisible('.faux-header__breadcrumbs-link')
-      .verify.urlEquals(baseUrl + '/#database/' + newDatabaseName + '/_all_docs');
+      .verify.urlEquals(baseUrl + '/#/database/' + newDatabaseName + '/_all_docs');
   }
 };

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/1aa4ca6f/app/addons/fauxton/tests/nightwatch/notificationCenter.js
----------------------------------------------------------------------
diff --git a/app/addons/fauxton/tests/nightwatch/notificationCenter.js b/app/addons/fauxton/tests/nightwatch/notificationCenter.js
index b1bac4c..b81d860 100644
--- a/app/addons/fauxton/tests/nightwatch/notificationCenter.js
+++ b/app/addons/fauxton/tests/nightwatch/notificationCenter.js
@@ -18,10 +18,10 @@ module.exports = {
         baseUrl = client.globals.test_settings.launch_url;
 
     client
-      .url(baseUrl + '/#login')
+      .url(baseUrl + '/#/login')
 
       // confirm the btn doesn't appear on the login screen
-      .waitForElementPresent('a[href="#login"]', waitTime, false)
+      .waitForElementPresent('a[href="#/login"]', waitTime, false)
       .waitForElementNotPresent('#notification-center-btn div.fonticon-bell', waitTime, false)
 
       .loginToGUI()

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/1aa4ca6f/app/addons/replication/tests/nightwatch/replicationactivity.js
----------------------------------------------------------------------
diff --git a/app/addons/replication/tests/nightwatch/replicationactivity.js b/app/addons/replication/tests/nightwatch/replicationactivity.js
index 292eb0a..b8dc7c3 100644
--- a/app/addons/replication/tests/nightwatch/replicationactivity.js
+++ b/app/addons/replication/tests/nightwatch/replicationactivity.js
@@ -29,7 +29,7 @@ module.exports = {
       .createDocument(replicatorDoc._id, '_replicator', replicatorDoc)
       .loginToGUI()
       .waitForElementNotPresent('.global-notification .fonticon-cancel', waitTime, false)
-      .url(baseUrl + '/#replication')
+      .url(baseUrl + '/#/replication')
       .waitForElementNotPresent('.load-lines', waitTime, true)
       .waitForElementPresent('.replication__filter', waitTime, true)
       .click('a[title="Delete document existing-doc-id-2"]')
@@ -40,7 +40,7 @@ module.exports = {
       .waitForElementNotPresent('.global-notification .fonticon-cancel', waitTime, false)
       .url(baseUrl)
       .waitForElementPresent('.databases.table', waitTime, false)
-      .url(baseUrl + '/#replication')
+      .url(baseUrl + '/#/replication')
       .waitForElementNotPresent('.load-lines', waitTime, true)
       .waitForElementNotPresent('a[title="Delete document existing-doc-id-2"]', waitTime,
true)
       .assert.elementNotPresent('a[title="Delete document existing-doc-id-2"]')

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/1aa4ca6f/app/addons/setup/base.js
----------------------------------------------------------------------
diff --git a/app/addons/setup/base.js b/app/addons/setup/base.js
index 1750885..918532a 100644
--- a/app/addons/setup/base.js
+++ b/app/addons/setup/base.js
@@ -17,7 +17,7 @@ import "./assets/less/setup.less";
 Setup.initialize = function () {
   FauxtonAPI.addHeaderLink({
     title: 'Setup',
-    href: "#setup",
+    href: "#/setup",
     icon: 'fonticon-wrench'
   });
 };

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/1aa4ca6f/app/addons/verifyinstall/base.js
----------------------------------------------------------------------
diff --git a/app/addons/verifyinstall/base.js b/app/addons/verifyinstall/base.js
index 23a6ce7..b9d9aac 100644
--- a/app/addons/verifyinstall/base.js
+++ b/app/addons/verifyinstall/base.js
@@ -17,7 +17,7 @@ import "./assets/less/verifyinstall.less";
 VerifyInstall.initialize = function () {
   FauxtonAPI.addHeaderLink({
     title: 'Verify',
-    href: '#verifyinstall',
+    href: '#/verifyinstall',
     icon: 'fonticon-ok-circled',
     bottomNav: true
   });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/1aa4ca6f/app/core/api.js
----------------------------------------------------------------------
diff --git a/app/core/api.js b/app/core/api.js
index 6240337..81a2725 100644
--- a/app/core/api.js
+++ b/app/core/api.js
@@ -67,6 +67,17 @@ FauxtonAPI.registerUrls = function (namespace, urls) {
   urlPaths[namespace] = urls;
 };
 
+FauxtonAPI.url = {
+  encode(name = "") {
+    // These special caracters are allowed by couch: _, $, (, ), +, -, and /
+    // From them only $ + and / are to be escaped in a URI component.
+    return (/[$+/]/g.test(name)) ? encodeURIComponent(name) : name;
+  },
+  decode(name = "") {
+    return (/[$+/]/g.test(name)) ? decodeURIComponent(name) : name;
+  }
+};
+
 //This is a little rough and needs some improvement. But the basic concept is there
 FauxtonAPI.urls = function (name, context) {
   var interceptors = FauxtonAPI.getExtensions('urls:interceptors');

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/1aa4ca6f/app/core/utils.js
----------------------------------------------------------------------
diff --git a/app/core/utils.js b/app/core/utils.js
index c159eb1..014e233 100644
--- a/app/core/utils.js
+++ b/app/core/utils.js
@@ -66,12 +66,10 @@ var utils = {
     return name.replace(/[^\w\s]/gi, "");
   },
 
-  safeURLName: function (name) {
-    var testName = name || "";
+  safeURLName: function (name = "") {
     // These special caracters are allowed by couch: _, $, (, ), +, -, and /
     // From them only $ + and / are to be escaped in a URI component.
-    var checkforBad = testName.match(/[$+/]/g);
-    return (checkforBad !== null) ? encodeURIComponent(name) : name;
+    return (/[$+/]/g.test(name)) ? encodeURIComponent(name) : name;
   },
 
   getDocTypeFromId: function (id) {

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/1aa4ca6f/test/nightwatch_tests/custom-commands/auth/loginToGUI.js
----------------------------------------------------------------------
diff --git a/test/nightwatch_tests/custom-commands/auth/loginToGUI.js b/test/nightwatch_tests/custom-commands/auth/loginToGUI.js
index 4f8eda2..2eb1594 100644
--- a/test/nightwatch_tests/custom-commands/auth/loginToGUI.js
+++ b/test/nightwatch_tests/custom-commands/auth/loginToGUI.js
@@ -22,9 +22,9 @@ function LoginToGui (user, pw) {
   const password = pw || client.globals.test_settings.password;
 
   client
-    .url(baseUrl + '/#login')
-    .waitForElementPresent('a[href="#login"]', waitTime, false)
-    .click('a[href="#login"]')
+    .url(baseUrl + '/#/login')
+    .waitForElementPresent('a[href="#/login"]', waitTime, false)
+    .click('a[href="#/login"]')
     .waitForElementVisible('.couch-login-wrapper', waitTime, false)
     .waitForElementVisible('#username', waitTime, false)
     .setValue('.couch-login-wrapper #username', [username])


Mime
View raw message