You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ga...@apache.org on 2018/01/04 09:21:24 UTC
[couchdb-fauxton] branch master updated: Upgrade to eslint v4 and
enable recommended lint rules (#1043)
This is an automated email from the ASF dual-hosted git repository.
garren pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/couchdb-fauxton.git
The following commit(s) were added to refs/heads/master by this push:
new 900c8ea Upgrade to eslint v4 and enable recommended lint rules (#1043)
900c8ea is described below
commit 900c8ea3e0e61be5cef8a2ec47a4c9465a3c2691
Author: Antonio Maranhao <30...@users.noreply.github.com>
AuthorDate: Thu Jan 4 04:21:22 2018 -0500
Upgrade to eslint v4 and enable recommended lint rules (#1043)
* Upgrade eslint to v4 with recommended config
* Fix lint issues
* Enable eslint-react recommended rules
* Address Garren's comments
* Enforce 2-space indent rule and fix all issues
* Enforce no-else-return rule and fix issues
* More lint fixes after rebasing
* Reverting because syntax is not valid in Node
* Ignore initialize.js for linting
---
.eslintrc | 48 +--
Gruntfile.js | 2 +-
app/addons/activetasks/components.js | 12 +-
app/addons/activetasks/layout.js | 4 +-
app/addons/activetasks/stores.js | 16 +-
app/addons/auth/actions.js | 70 ++--
app/addons/auth/components/changepasswordform.js | 4 +-
app/addons/auth/components/createadminform.js | 4 +-
app/addons/auth/components/loginform.js | 25 +-
app/addons/auth/layout.js | 4 +-
app/addons/cluster/cluster.stores.js | 4 +-
app/addons/cluster/resources.js | 3 +-
app/addons/components/__tests__/polling.test.js | 4 +-
.../components/__tests__/tabwindowwrapper.test.js | 2 +-
app/addons/components/components/bulkaction.js | 4 +-
app/addons/components/components/codeeditor.js | 10 +-
.../components/components/codeeditorpanel.js | 15 +-
.../components/components/deletedatabasemodal.js | 2 +-
app/addons/components/components/menudropdown.js | 1 -
.../components/components/paddedborderbox.js | 2 +-
.../components/components/stringeditmodal.js | 6 +-
.../components/components/toggleheaderbutton.js | 2 +-
app/addons/components/components/tray.js | 15 +-
app/addons/components/components/zenmodeoverlay.js | 22 +-
app/addons/components/layouts.js | 22 +-
app/addons/components/stores.js | 4 +-
app/addons/config/__tests__/actions.test.js | 72 ++--
app/addons/config/components.js | 81 ++--
app/addons/config/layout.js | 2 +-
app/addons/cors/actions.js | 14 +-
app/addons/cors/reducers.js | 21 +-
app/addons/databases/actions.js | 30 +-
app/addons/databases/components.js | 8 +-
app/addons/databases/layout.js | 2 +-
app/addons/databases/resources.js | 4 +-
app/addons/databases/stores.js | 12 +-
.../tests/nightwatch/checkDatabaseTooltip.js | 2 +-
.../databases/tests/nightwatch/createsDatabase.js | 48 +--
.../databases/tests/nightwatch/deletesDatabase.js | 5 +-
.../nightwatch/deletesDatabaseSpecialChars.js | 4 +-
.../tests/nightwatch/permissionsDbTable.js | 2 +-
.../tests/nightwatch/specialCharListLinks.js | 2 +-
app/addons/documentation/routes.js | 2 +-
.../tests/nightwatch/checksDocsPage.js | 2 +-
app/addons/documents/__tests__/changes.test.js | 12 +-
.../documents/__tests__/fetch-actions.test.js | 28 +-
.../documents/__tests__/pagination-footer.test.js | 224 +++++------
.../__tests__/queryoptions-actions.test.js | 12 +-
app/addons/documents/__tests__/reducers.test.js | 8 +-
app/addons/documents/__tests__/resources.test.js | 12 +-
app/addons/documents/__tests__/table-row.test.js | 1 -
app/addons/documents/changes/components.js | 21 +-
.../documents/components/header-docs-left.js | 4 +-
app/addons/documents/designdocinfo/stores.js | 8 +-
.../__tests__/doc-editor.components.test.js | 2 +-
app/addons/documents/doc-editor/components.js | 12 +-
app/addons/documents/doc-editor/stores.js | 28 +-
app/addons/documents/header/header.js | 30 +-
app/addons/documents/helpers.js | 6 +-
.../index-editor/__tests__/actions.test.js | 14 +-
.../index-editor/components/DesignDocSelector.js | 4 +-
.../index-editor/components/ReduceEditor.js | 7 +-
app/addons/documents/index-editor/stores.js | 26 +-
.../index-results/actions/queryoptions.js | 16 +-
app/addons/documents/index-results/api.js | 45 ++-
.../components/pagination/PaginationFooter.js | 2 +-
.../components/queryoptions/AdditionalParams.js | 2 +-
.../components/queryoptions/KeySearchFields.js | 28 +-
.../components/queryoptions/MainFieldsView.js | 2 +-
.../components/queryoptions/QueryOptions.js | 2 +-
.../components/results/ResultsScreen.js | 30 +-
.../index-results/components/results/TableRow.js | 4 +-
.../index-results/components/results/TableView.js | 2 +-
.../components/results/WrappedAutocomplete.js | 2 +-
.../containers/IndexResultsContainer.js | 12 +-
.../documents/index-results/helpers/table-view.js | 14 +-
app/addons/documents/index-results/reducers.js | 6 +-
.../documents/mango/components/ExecutionStats.js | 20 +-
.../documents/mango/components/ExplainPage.js | 6 +-
.../documents/mango/components/MangoIndexEditor.js | 10 +-
.../documents/mango/components/MangoQueryEditor.js | 10 +-
.../mango/components/MangoQueryEditorContainer.js | 2 +-
app/addons/documents/mango/mango.actions.js | 10 +-
app/addons/documents/mango/mango.api.js | 10 +-
app/addons/documents/mango/mango.constants.js | 12 +-
app/addons/documents/mango/mango.reducers.js | 2 +-
app/addons/documents/mangolayout.js | 26 +-
app/addons/documents/resources.js | 8 +-
app/addons/documents/rev-browser/actions.js | 58 +--
.../rev-browser/components/confirmmodal.js | 2 +-
.../rev-browser/components/splitscreenarea.js | 8 +-
app/addons/documents/rev-browser/container.js | 1 -
.../rev-browser/rev-browser.components.js | 429 +++++++++++++++++++++
.../documents/rev-browser/rev-browser.stores.js | 120 ++++++
app/addons/documents/routes-doc-editor.js | 10 +-
app/addons/documents/routes-index-editor.js | 6 +-
.../sidebar/__tests__/sidebar.components.test.js | 2 +-
app/addons/documents/sidebar/reducers.js | 2 +-
app/addons/documents/sidebar/sidebar.js | 6 +-
app/addons/documents/sidebar/stores.js | 26 +-
.../documents/tests/nightwatch/bulkDelete.js | 32 +-
.../tests/nightwatch/checkSidebarBehavior.js | 6 +-
app/addons/documents/tests/nightwatch/cloneDoc.js | 2 +-
.../documents/tests/nightwatch/createsDocument.js | 8 +-
.../tests/nightwatch/createsDocumentWithoutId.js | 2 +-
.../tests/nightwatch/deleteDatabaseModal.js | 4 +-
.../documents/tests/nightwatch/deletesDocuments.js | 12 +-
.../tests/nightwatch/doubleEmitResults.js | 24 +-
.../tests/nightwatch/editDocumentsFromView.js | 26 +-
.../documents/tests/nightwatch/encodingSupport.js | 6 +-
.../documents/tests/nightwatch/mangoIndex.js | 2 +-
.../documents/tests/nightwatch/mangoQuery.js | 2 +-
.../tests/nightwatch/navigateFromNewDoc.js | 4 +-
.../tests/nightwatch/navigateNotFoundDB.js | 2 +-
.../documents/tests/nightwatch/paginateView.js | 2 +-
.../documents/tests/nightwatch/previousButton.js | 2 +-
.../documents/tests/nightwatch/queryOptions.js | 2 +-
.../tests/nightwatch/queryOptionsCloseBug.js | 2 +-
.../tests/nightwatch/replicateDatabaseButton.js | 78 ++--
.../documents/tests/nightwatch/revBrowser.js | 2 +-
.../tests/nightwatch/selectDocViaTypeahead.js | 6 +-
.../documents/tests/nightwatch/viewCreate.js | 10 +-
.../tests/nightwatch/viewCreateBadView.js | 8 +-
app/addons/documents/tests/nightwatch/viewEdit.js | 12 +-
.../documents/tests/nightwatch/viewQueryOptions.js | 6 +-
app/addons/fauxton/appwrapper.js | 2 +-
.../fauxton/navigation/components/NavLink.js | 2 +-
app/addons/fauxton/navigation/stores.js | 30 +-
.../notifications/__tests__/components.test.js | 20 +-
app/addons/fauxton/notifications/notifications.js | 78 ++--
app/addons/fauxton/notifications/stores.js | 24 +-
.../fauxton/tests/nightwatch/highlightsidebar.js | 2 +-
.../fauxton/tests/nightwatch/notificationCenter.js | 2 +-
app/addons/permissions/actions.js | 66 ++--
.../permissions/components/PermissionsItem.js | 2 +-
.../permissions/components/PermissionsSection.js | 74 ++--
app/addons/permissions/reducers.js | 2 +-
app/addons/replication/__tests__/api.tests.js | 150 +++----
.../replication/__tests__/newreplication.test.js | 24 +-
app/addons/replication/actions.js | 238 ++++++------
app/addons/replication/api.js | 95 +++--
app/addons/replication/components/activity.js | 2 +-
app/addons/replication/components/common-table.js | 21 +-
.../replication/components/newreplication.js | 22 +-
app/addons/replication/components/options.js | 30 +-
.../replication/components/replicate-activity.js | 2 +-
app/addons/replication/components/source.js | 6 +-
app/addons/replication/components/submit.js | 36 +-
app/addons/replication/components/target.js | 8 +-
app/addons/replication/controller.js | 18 +-
app/addons/replication/route.js | 2 +-
app/addons/replication/stores.js | 75 ++--
.../replication/tests/nightwatch/replication.js | 1 -
.../tests/nightwatch/replicationactivity.js | 70 ++--
app/addons/setup/resources.js | 4 +-
app/addons/setup/setup.actions.js | 6 +-
app/addons/setup/setup.js | 6 +-
app/addons/setup/setup.stores.js | 24 +-
app/addons/verifyinstall/resources.js | 24 +-
app/addons/verifyinstall/stores.js | 10 +-
app/core/__tests__/ajax.test.js | 21 +-
app/core/__tests__/utils.test.js | 8 +-
app/core/api.js | 4 +-
app/core/routeObject.js | 4 +-
app/core/utils.js | 8 +-
app/helpers.js | 24 +-
app/initialize.js.underscore | 2 +
bin/remove-test-dbs.js | 4 +-
devserver.js | 16 +-
index.js | 29 +-
package.json | 6 +-
tasks/fauxton.js | 8 +-
webpack.config.dev.js | 126 +++---
webpack.config.release.js | 47 +--
174 files changed, 2162 insertions(+), 1617 deletions(-)
diff --git a/.eslintrc b/.eslintrc
index a83517b..64fb232 100644
--- a/.eslintrc
+++ b/.eslintrc
@@ -6,30 +6,34 @@
"react"
],
- "rules-todo": {
- "space-unary-ops": 2,
- "camelcase": 2
- },
+ "extends": [
+ "eslint:recommended",
+ "plugin:react/recommended"
+ ],
"rules": {
- "semi": [2, "always"],
- "no-undef": 2,
- "keyword-spacing": 2,
- "space-infix-ops": 2,
- "space-before-blocks": 2,
- "array-bracket-spacing": [2, "never"],
- "brace-style": [2, "1tbs", { "allowSingleLine": true }],
- "comma-spacing": [2, {"before": false, "after": true}],
- "computed-property-spacing": [2, "never"],
- "eol-last": 2,
- "no-mixed-spaces-and-tabs": [2, "smart-tabs"],
- "no-trailing-spaces": 2,
- "semi-spacing": [2, {"before": false, "after": true}],
- "no-empty": 2,
- "space-in-parens": [2, "never"],
- "no-unused-vars": [2, {"varsIgnorePattern": "ReactDOM"}],
- "react/jsx-uses-vars": 2,
- "react/jsx-uses-react": 2
+ "semi": ["error", "always"],
+ "keyword-spacing": "error",
+ "space-infix-ops": "error",
+ "space-before-blocks": "error",
+ "array-bracket-spacing": ["error", "never"],
+ "brace-style": ["error", "1tbs", { "allowSingleLine": true }],
+ "comma-spacing": ["error", {"before": false, "after": true}],
+ "computed-property-spacing": ["error", "never"],
+ "eol-last": "error",
+ "indent": ["error", 2, { "SwitchCase": 1, "VariableDeclarator": { "var": 2, "let": 2, "const": 3 } }],
+ "no-case-declarations": "off",
+ "no-console": [1, { "allow": ["warn", "error", "info"] }],
+ "no-else-return": "error",
+ "no-mixed-spaces-and-tabs": ["error", "smart-tabs"],
+ "no-trailing-spaces": "error",
+ "semi-spacing": ["error", {"before": false, "after": true}],
+ "space-in-parens": ["error", "never"],
+ "space-unary-ops": "error",
+ "no-unused-vars": ["error", {"varsIgnorePattern": "ReactDOM"}],
+ "react/display-name": "off",
+ // disabling for now since there are too many components without PropTypes
+ "react/prop-types": "off"
},
"parserOptions": {
diff --git a/Gruntfile.js b/Gruntfile.js
index 62cc59d..6ca330e 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -211,7 +211,7 @@ module.exports = function (grunt) {
*/
// dev server
grunt.registerTask('dev', function () {
- console.log('This is deprecated. Please run npm run dev instead');
+ console.warn('This is deprecated. Please run npm run dev instead');
});
// build a debug release
diff --git a/app/addons/activetasks/components.js b/app/addons/activetasks/components.js
index c63927a..7b94cc9 100644
--- a/app/addons/activetasks/components.js
+++ b/app/addons/activetasks/components.js
@@ -299,7 +299,7 @@ class ActiveTasksTableBody extends React.Component {
return (
<tr className="no-matching-database-on-search">
- <td colSpan="6">No active {type} tasks match with filter: "{this.props.searchTerm}"</td>
+ <td colSpan="6">No active {type} tasks match with filter: "{this.props.searchTerm}"</td>
</tr>
);
};
@@ -309,7 +309,7 @@ class ActiveTasksTableBody extends React.Component {
render() {
return (
<tbody className="js-tasks-go-here">
- {this.createRows()}
+ {this.createRows()}
</tbody>
);
}
@@ -402,7 +402,7 @@ export class ActiveTasksPollingWidgetController extends React.Component {
startValue={15}
valueUnits={"second"}
onPoll={this.runPollingUpdate}
- />
+ />
</div>
);
}
@@ -411,9 +411,9 @@ export class ActiveTasksPollingWidgetController extends React.Component {
var activeTasksHelpers = {
getTimeInfo (timeStamp) {
var timeMessage = [
- app.helpers.formatDate(timeStamp),
- app.helpers.getDateFromNow(timeStamp)
- ];
+ app.helpers.formatDate(timeStamp),
+ app.helpers.getDateFromNow(timeStamp)
+ ];
return timeMessage;
},
diff --git a/app/addons/activetasks/layout.js b/app/addons/activetasks/layout.js
index ed96a13..b01a84e 100644
--- a/app/addons/activetasks/layout.js
+++ b/app/addons/activetasks/layout.js
@@ -16,8 +16,8 @@ import {OnePane, OnePaneHeader, OnePaneContent} from '../components/layouts';
import {ActiveTasksController, ActiveTasksPollingWidgetController} from "./components";
const crumbs = [
- {'name': 'Active Tasks'}
- ];
+ {'name': 'Active Tasks'}
+];
export const ActiveTasksLayout = () => {
return (
diff --git a/app/addons/activetasks/stores.js b/app/addons/activetasks/stores.js
index 7453e48..f1e1d4d 100644
--- a/app/addons/activetasks/stores.js
+++ b/app/addons/activetasks/stores.js
@@ -175,42 +175,42 @@ var ActiveTasksStore = FauxtonAPI.Store.extend({
case ActionTypes.ACTIVE_TASKS_FETCH_AND_SET:
this.initAfterFetching(action.options.collectionTable, action.options.backboneCollection);
- break;
+ break;
case ActionTypes.ACTIVE_TASKS_SWITCH_TAB:
this.setSelectedRadio(action.options);
this.triggerChange();
- break;
+ break;
case ActionTypes.ACTIVE_TASKS_SET_COLLECTION:
this.setCollection(action.options);
this.triggerChange();
- break;
+ break;
case ActionTypes.ACTIVE_TASKS_SET_SEARCH_TERM:
this.setSearchTerm(action.options);
this.triggerChange();
- break;
+ break;
case ActionTypes.ACTIVE_TASKS_SORT_BY_COLUMN_HEADER:
this.toggleHeaderIsAscending();
this.setSortByHeader(action.options.columnName);
this.sortCollectionByColumnHeader(action.options.columnName);
this.triggerChange();
- break;
+ break;
case ActionTypes.ACTIVE_TASKS_SET_IS_LOADING:
this.setIsLoading(action.options, new Date());
this.triggerChange();
- break;
+ break;
case ActionTypes.ACTIVE_TASKS_POLLING_COLLECTION:
this.setCollectionFromPolling(action.options);
this.triggerChange();
- break;
+ break;
default:
- return;
+ return;
}
}
});
diff --git a/app/addons/auth/actions.js b/app/addons/auth/actions.js
index 7bec85a..9742bc9 100644
--- a/app/addons/auth/actions.js
+++ b/app/addons/auth/actions.js
@@ -51,23 +51,23 @@ export const login = (username, password, urlBack) => {
}
return Api.login({name: username, password})
- .then(resp => {
- if (resp.error) {
- errorHandler({message: resp.reason});
- return resp;
- }
-
- let msg = app.i18n.en_US['auth-logged-in'];
- if (msg) {
- FauxtonAPI.addNotification({msg});
- }
-
- if (urlBack && !urlBack.includes("login")) {
- return FauxtonAPI.navigate(urlBack);
- }
- FauxtonAPI.navigate("/");
- })
- .catch(errorHandler);
+ .then(resp => {
+ if (resp.error) {
+ errorHandler({message: resp.reason});
+ return resp;
+ }
+
+ let msg = app.i18n.en_US['auth-logged-in'];
+ if (msg) {
+ FauxtonAPI.addNotification({msg});
+ }
+
+ if (urlBack && !urlBack.includes("login")) {
+ return FauxtonAPI.navigate(urlBack);
+ }
+ FauxtonAPI.navigate("/");
+ })
+ .catch(errorHandler);
};
export const changePassword = (username, password, passwordConfirm) => () => {
@@ -98,27 +98,27 @@ export const createAdmin = (username, password, loginAfter) => () => {
}
Api.createAdmin({name: username, password, node})
- .then(resp => {
- if (resp.error) {
- return errorHandler({message: `${app.i18n.en_US['auth-admin-creation-failed-prefix']} ${resp.reason}`});
- }
+ .then(resp => {
+ if (resp.error) {
+ return errorHandler({message: `${app.i18n.en_US['auth-admin-creation-failed-prefix']} ${resp.reason}`});
+ }
- FauxtonAPI.addNotification({
- msg: app.i18n.en_US['auth-admin-created']
- });
+ FauxtonAPI.addNotification({
+ msg: app.i18n.en_US['auth-admin-created']
+ });
- if (loginAfter) {
- return FauxtonAPI.navigate("/login");
- }
- });
+ if (loginAfter) {
+ return FauxtonAPI.navigate("/login");
+ }
+ });
};
// simple authentication method - does nothing other than check creds
export const authenticate = (username, password, onSuccess) => {
- Api.login({
- name: username,
- password: password
- })
+ Api.login({
+ name: username,
+ password: password
+ })
.then(
() => {
hidePasswordModal();
@@ -146,7 +146,7 @@ export const hidePasswordModal = () => {
export const logout = () => {
FauxtonAPI.addNotification({ msg: "You have been logged out." });
Api.logout()
- .then(Api.getSession)
- .then(() => FauxtonAPI.navigate('/'))
- .catch(errorHandler);
+ .then(Api.getSession)
+ .then(() => FauxtonAPI.navigate('/'))
+ .catch(errorHandler);
};
diff --git a/app/addons/auth/components/changepasswordform.js b/app/addons/auth/components/changepasswordform.js
index da77375..7ca0b8f 100644
--- a/app/addons/auth/components/changepasswordform.js
+++ b/app/addons/auth/components/changepasswordform.js
@@ -38,7 +38,7 @@ export class ChangePasswordForm extends React.Component {
}
componentDidMount() {
- ReactDOM.findDOMNode(this.refs.password).focus();
+ this.passwordField.focus();
}
changePassword(e) {
@@ -59,7 +59,7 @@ export class ChangePasswordForm extends React.Component {
<input
id="password"
type="password"
- ref="password"
+ ref={node => this.passwordField = node}
name="password"
placeholder="Password"
size="24"
diff --git a/app/addons/auth/components/createadminform.js b/app/addons/auth/components/createadminform.js
index 7229256..f92049b 100644
--- a/app/addons/auth/components/createadminform.js
+++ b/app/addons/auth/components/createadminform.js
@@ -37,7 +37,7 @@ export class CreateAdminForm extends React.Component {
}
componentDidMount() {
- ReactDOM.findDOMNode(this.refs.username).focus();
+ this.usernameField.focus();
}
createAdmin(e) {
@@ -74,7 +74,7 @@ export class CreateAdminForm extends React.Component {
<input
id="username"
type="text"
- ref="username"
+ ref={node => this.usernameField = node}
name="name"
placeholder="Username"
size="24"
diff --git a/app/addons/auth/components/loginform.js b/app/addons/auth/components/loginform.js
index 528d173..b961c93 100644
--- a/app/addons/auth/components/loginform.js
+++ b/app/addons/auth/components/loginform.js
@@ -24,10 +24,13 @@ class LoginForm extends React.Component {
password: ""
};
}
- onInputChange(e) {
- this.state[e.target.name] = e.target.value;
- this.setState(this.state);
+ onUsernameChange(e) {
+ this.setState({username: e.target.value});
}
+ onPasswordChange(e) {
+ this.setState({password: e.target.value});
+ }
+
submit(e) {
e.preventDefault();
if (!this.checkUnrecognizedAutoFill()) {
@@ -42,10 +45,10 @@ class LoginForm extends React.Component {
}
let username = this.props.testBlankUsername
? this.props.testBlankUsername
- : ReactDOM.findDOMNode(this.refs.username).value;
+ : this.usernameField.value;
let password = this.props.testBlankPassword
? this.props.testBlankPassword
- : ReactDOM.findDOMNode(this.refs.password).value;
+ : this.passwordField.value;
this.setState({ username: username, password: password }); // doesn't set immediately, hence separate login() call
this.login(username, password);
@@ -55,7 +58,7 @@ class LoginForm extends React.Component {
login(username, password, this.props.urlBack);
}
componentDidMount() {
- ReactDOM.findDOMNode(this.refs.username).focus();
+ this.usernameField.focus();
}
render() {
return (
@@ -70,10 +73,10 @@ class LoginForm extends React.Component {
id="username"
type="text"
name="username"
- ref="username"
+ ref={node => this.usernameField = node}
placeholder="Username"
size="24"
- onChange={this.onInputChange.bind(this)}
+ onChange={this.onUsernameChange.bind(this)}
value={this.state.username}
/>
<br />
@@ -81,10 +84,10 @@ class LoginForm extends React.Component {
id="password"
type="password"
name="password"
- ref="password"
+ ref={node => this.passwordField = node}
placeholder="Password"
size="24"
- onChange={this.onInputChange.bind(this)}
+ onChange={this.onPasswordChange.bind(this)}
value={this.state.password}
/>
<br />
@@ -100,7 +103,7 @@ class LoginForm extends React.Component {
}
LoginForm.defaultProps = {
- urlBack: ""
+ urlBack: ""
};
LoginForm.propTypes = {
diff --git a/app/addons/auth/layout.js b/app/addons/auth/layout.js
index 8efc722..54b59ef 100644
--- a/app/addons/auth/layout.js
+++ b/app/addons/auth/layout.js
@@ -58,7 +58,7 @@ const Tabs = ({changePassword}) => {
onChange={() => {
FauxtonAPI.navigate('#changePassword');
}}
- />
+ />
<TabElement
key={2}
selected={!changePassword}
@@ -66,7 +66,7 @@ const Tabs = ({changePassword}) => {
onChange={() => {
FauxtonAPI.navigate('#addAdmin');
}}
- />
+ />
</TabElementWrapper>
);
};
diff --git a/app/addons/cluster/cluster.stores.js b/app/addons/cluster/cluster.stores.js
index 8463304..27d4557 100644
--- a/app/addons/cluster/cluster.stores.js
+++ b/app/addons/cluster/cluster.stores.js
@@ -36,10 +36,10 @@ var NodesStore = FauxtonAPI.Store.extend({
switch (action.type) {
case ActionTypes.CLUSTER_FETCH_NODES:
this.setNodes(action.options);
- break;
+ break;
default:
- return;
+ return;
}
this.triggerChange();
diff --git a/app/addons/cluster/resources.js b/app/addons/cluster/resources.js
index cb74aeb..675c8ac 100644
--- a/app/addons/cluster/resources.js
+++ b/app/addons/cluster/resources.js
@@ -19,9 +19,8 @@ Cluster.ClusterNodes = Backbone.Model.extend({
url: function (context) {
if (context === 'apiurl') {
return window.location.origin + '/_membership';
- } else {
- return app.host + '/_membership';
}
+ return app.host + '/_membership';
},
parse: function (res) {
diff --git a/app/addons/components/__tests__/polling.test.js b/app/addons/components/__tests__/polling.test.js
index c676b7b..de37238 100644
--- a/app/addons/components/__tests__/polling.test.js
+++ b/app/addons/components/__tests__/polling.test.js
@@ -61,7 +61,7 @@ describe("Polling", () => {
max={20}
stepSize={1}
onPoll={() => {}}
- />);
+ />);
const props = wrapper.find('Range').props();
@@ -78,7 +78,7 @@ describe("Polling", () => {
max={20}
stepSize={1}
onPoll={() => {}}
- />);
+ />);
wrapper.find('input').simulate('mouseMove', {buttons:1, which:1, target: {value: 21}});
const isOff = wrapper.find('.faux__polling-info-value--off').text();
diff --git a/app/addons/components/__tests__/tabwindowwrapper.test.js b/app/addons/components/__tests__/tabwindowwrapper.test.js
index b088b50..2745bb2 100644
--- a/app/addons/components/__tests__/tabwindowwrapper.test.js
+++ b/app/addons/components/__tests__/tabwindowwrapper.test.js
@@ -20,7 +20,7 @@ describe('TabWindowWrapper', () => {
};
const tabs = [
- {
+ {
name: 'Tab1',
component: mock,
route: 'tab1'
diff --git a/app/addons/components/components/bulkaction.js b/app/addons/components/components/bulkaction.js
index 12958be..fc63a81 100644
--- a/app/addons/components/components/bulkaction.js
+++ b/app/addons/components/components/bulkaction.js
@@ -70,14 +70,14 @@ export class BulkActionComponent extends React.Component {
};
selectAll = () => {
- this.refs.bulkActionPopover.hide();
+ this.bulkActionPopover.hide();
this.props.selectAll();
};
getOverlay = () => {
return (
<OverlayTrigger
- ref="bulkActionPopover"
+ ref={node => this.bulkActionPopover = node}
trigger="click"
placement="bottom"
rootClose={true}
diff --git a/app/addons/components/components/codeeditor.js b/app/addons/components/components/codeeditor.js
index b8862e7..b9f8bf8 100644
--- a/app/addons/components/components/codeeditor.js
+++ b/app/addons/components/components/codeeditor.js
@@ -78,7 +78,7 @@ export class CodeEditor extends React.Component {
};
setupAce = (props, shouldUpdateCode) => {
- this.editor = ace.edit(ReactDOM.findDOMNode(this.refs.ace));
+ this.editor = ace.edit(this.ace);
// suppresses an Ace editor error
this.editor.$blockScrolling = Infinity;
@@ -251,7 +251,7 @@ export class CodeEditor extends React.Component {
// one JS(ON) string can't span more than one line - we edit one string, so ensure we don't select several lines
if (selStart >= 0 && selEnd >= 0 && selStart === selEnd && this.isRowExpanded(selStart)) {
var editLine = this.getLine(selStart),
- editMatch = editLine.match(/^([ \t]*)("[a-zA-Z0-9_\-]*["|']: )?(["|'].*",?[ \t]*)$/);
+ editMatch = editLine.match(/^([ \t]*)("[a-zA-Z0-9_-]*["|']: )?(["|'].*",?[ \t]*)$/);
if (editMatch) {
return editMatch;
@@ -351,13 +351,13 @@ export class CodeEditor extends React.Component {
render() {
return (
<div>
- <div ref="ace" className="js-editor" id={this.props.id}></div>
- <button ref="stringEditIcon" className="btn string-edit" title="Edit string" disabled={!this.state.stringEditIconVisible}
+ <div ref={node => this.ace = node} className="js-editor" id={this.props.id}></div>
+ <button ref={node => this.stringEditIcon = node} className="btn string-edit" title="Edit string" disabled={!this.state.stringEditIconVisible}
style={this.state.stringEditIconStyle} onClick={this.openStringEditModal}>
<i className="icon icon-edit"></i>
</button>
<StringEditModal
- ref="stringEditModal"
+ ref={node => this.stringEditModal = node}
visible={this.state.stringEditModalVisible}
value={this.state.stringEditModalValue}
onSave={this.saveStringEditModal}
diff --git a/app/addons/components/components/codeeditorpanel.js b/app/addons/components/components/codeeditorpanel.js
index 714304d..3304523 100644
--- a/app/addons/components/components/codeeditorpanel.js
+++ b/app/addons/components/components/codeeditorpanel.js
@@ -16,11 +16,11 @@ import {Beautify} from './beautify';
import {ZenModeOverlay} from './zenmodeoverlay';
- // list of JSHINT errors to ignore: gets around problem of anonymous functions not being valid
+// list of JSHINT errors to ignore: gets around problem of anonymous functions not being valid
const ignorableErrors = [
- 'Missing name in function declaration.',
- "['{a}'] is better written in dot notation."
- ];
+ 'Missing name in function declaration.',
+ "['{a}'] is better written in dot notation."
+];
/**
* A pre-packaged JS editor panel for use on the Edit Index / Mango pages. Includes options for a title, zen mode
@@ -63,6 +63,7 @@ export class CodeEditorPanel extends React.Component {
data-bypass="true"
href={this.props.docLink}
target="_blank"
+ rel="noopener noreferrer"
>
<i className="icon-question-sign"></i>
</a>
@@ -85,7 +86,7 @@ export class CodeEditorPanel extends React.Component {
enterZenMode = () => {
this.setState({
zenModeEnabled: true,
- code: this.refs.codeEditor.getValue()
+ code: this.codeEditor.getValue()
});
};
@@ -95,7 +96,7 @@ export class CodeEditorPanel extends React.Component {
};
getEditor = () => {
- return this.refs.codeEditor;
+ return this.codeEditor;
};
getValue = () => {
@@ -127,7 +128,7 @@ export class CodeEditorPanel extends React.Component {
</label>
<CodeEditor
id={this.props.id}
- ref="codeEditor"
+ ref={node => this.codeEditor = node}
mode="javascript"
defaultCode={this.state.code}
showGutter={true}
diff --git a/app/addons/components/components/deletedatabasemodal.js b/app/addons/components/components/deletedatabasemodal.js
index e8213fe..65a2f33 100644
--- a/app/addons/components/components/deletedatabasemodal.js
+++ b/app/addons/components/components/deletedatabasemodal.js
@@ -94,7 +94,7 @@ export class DeleteDatabaseModal extends React.Component {
<p>
Warning: This action will permanently delete <code>{dbId}</code>.
To confirm the deletion of the database and all of the
- database's documents, you must enter the database's name.
+ database's documents, you must enter the database's name.
</p>
<input
type="text"
diff --git a/app/addons/components/components/menudropdown.js b/app/addons/components/components/menudropdown.js
index a2e90c4..d10f014 100644
--- a/app/addons/components/components/menudropdown.js
+++ b/app/addons/components/components/menudropdown.js
@@ -72,7 +72,6 @@ export class MenuDropDown extends React.Component {
<CustomMenu bsRole="menu" className="arrow">
{menuItems}
</CustomMenu>
- }
</Dropdown>
);
}
diff --git a/app/addons/components/components/paddedborderbox.js b/app/addons/components/components/paddedborderbox.js
index 2605061..166e129 100644
--- a/app/addons/components/components/paddedborderbox.js
+++ b/app/addons/components/components/paddedborderbox.js
@@ -21,5 +21,5 @@ export class PaddedBorderedBox extends React.Component {
</div>
</div>
);
- }
+ }
}
diff --git a/app/addons/components/components/stringeditmodal.js b/app/addons/components/components/stringeditmodal.js
index 9b8f06f..f960dd7 100644
--- a/app/addons/components/components/stringeditmodal.js
+++ b/app/addons/components/components/stringeditmodal.js
@@ -56,7 +56,7 @@ export class StringEditModal extends React.Component {
}
initEditor = (val) => {
- this.editor = ace.edit(ReactDOM.findDOMNode(this.refs.stringEditor));
+ this.editor = ace.edit(this.stringEditor);
this.editor.$blockScrolling = Infinity; // suppresses an Ace editor error
this.editor.setShowPrintMargin(false);
this.editor.setOption('highlightActiveLine', true);
@@ -80,7 +80,9 @@ export class StringEditModal extends React.Component {
</Modal.Header>
<Modal.Body>
<div id="modal-error" className="hide alert alert-error"/>
- <div id="string-editor-wrapper"><div ref="stringEditor" className="doc-code"></div></div>
+ <div id="string-editor-wrapper">
+ <div ref={node => this.stringEditor = node} className="doc-code"></div>
+ </div>
</Modal.Body>
<Modal.Footer>
<a className="cancel-link" onClick={this.closeModal}>Cancel</a>
diff --git a/app/addons/components/components/toggleheaderbutton.js b/app/addons/components/components/toggleheaderbutton.js
index b092784..6f0a51e 100644
--- a/app/addons/components/components/toggleheaderbutton.js
+++ b/app/addons/components/components/toggleheaderbutton.js
@@ -36,7 +36,7 @@ export class ToggleHeaderButton extends React.Component {
disabled={disabled}
onClick={toggleCallback}
className={`button ${containerClasses} ${selectedBtnClass}`}
- >
+ >
<i className={`${iconDefaultClass} ${fonticon} ${innerClasses}`}></i><span>{text}</span>
</button>
);
diff --git a/app/addons/components/components/tray.js b/app/addons/components/components/tray.js
index 41be571..c885c25 100644
--- a/app/addons/components/components/tray.js
+++ b/app/addons/components/components/tray.js
@@ -77,13 +77,12 @@ export class TrayContents extends React.Component {
render() {
return (
<Overlay
- show={this.props.contentVisible}
- onHide={this.props.closeTray}
- placement={"bottom"}
- container={this.props.container}
- rootClose={true}
- target={() => ReactDOM.findDOMNode(this.refs.target)}
- onEnter={this.props.onEnter}
+ show={this.props.contentVisible}
+ onHide={this.props.closeTray}
+ placement={"bottom"}
+ container={this.props.container}
+ rootClose={true}
+ onEnter={this.props.onEnter}
>
<TransitionMotion
defaultStyles={this.getDefaultStyles()}
@@ -91,7 +90,7 @@ export class TrayContents extends React.Component {
willLeave={this.willLeave}
willEnter={this.willEnter}
>
- {this.getChildren}
+ {this.getChildren}
</TransitionMotion>
</Overlay>
);
diff --git a/app/addons/components/components/zenmodeoverlay.js b/app/addons/components/components/zenmodeoverlay.js
index 7cffb62..dceb24c 100644
--- a/app/addons/components/components/zenmodeoverlay.js
+++ b/app/addons/components/components/zenmodeoverlay.js
@@ -17,10 +17,10 @@ import {Tooltip, OverlayTrigger} from 'react-bootstrap';
require('brace/theme/dawn');
- const themes = {
- dark: 'idle_fingers',
- light: 'dawn'
- };
+const themes = {
+ dark: 'idle_fingers',
+ light: 'dawn'
+};
// Zen mode editing has very few options:
// - It covers the full screen, hiding everything else
// - Two themes: light & dark (choice stored in local storage)
@@ -56,7 +56,7 @@ export class ZenModeOverlay extends React.Component {
};
getValue = () => {
- return this.refs.ace.getValue();
+ return this.ace.getValue();
};
toggleTheme = () => {
@@ -86,11 +86,11 @@ export class ZenModeOverlay extends React.Component {
const tooltipExit = <Tooltip id="tooltip">
Exit zen mode (`esc`)
- </Tooltip>;
+ </Tooltip>;
const tooltipTheme = <Tooltip id="tooltip">
Switch zen theme
- </Tooltip>;
+ </Tooltip>;
return (
<div className={classes}>
@@ -107,19 +107,19 @@ export class ZenModeOverlay extends React.Component {
</li>
<li>
<OverlayTrigger placement="left" overlay={tooltipTheme}>
- <span ref="theme"
+ <span
className="fonticon fonticon-picture js-toggle-theme"
data-container=".zen-mode-controls .tooltips"
title="Switch zen theme"
onClick={this.toggleTheme}>
- </span>
- </OverlayTrigger>
+ </span>
+ </OverlayTrigger>
</li>
</ul>
<div className="tooltips"></div>
</div>
<CodeEditor
- ref="ace"
+ ref={node => this.ace = node}
autoFocus={true}
theme={themes[this.state.theme]}
defaultCode={this.props.defaultCode}
diff --git a/app/addons/components/layouts.js b/app/addons/components/layouts.js
index fe85680..cc1c30a 100644
--- a/app/addons/components/layouts.js
+++ b/app/addons/components/layouts.js
@@ -25,10 +25,10 @@ export const ApiBarWrapper = ({docURL, endpoint}) => {
<JSONLink
endpoint={endpoint}
/>
- <DocLink
- docURL={docURL}
- />
- </div>
+ <DocLink
+ docURL={docURL}
+ />
+ </div>
);
};
@@ -43,7 +43,7 @@ export const OnePane = ({children}) => {
export const OnePaneHeader = ({showApiUrl, docURL, endpoint, crumbs, children}) => {
let rightHeaderClass = "right-header-flex";
if (Helpers.isIE1X()) {
- rightHeaderClass += " " + rightHeaderClass + "--ie1X";
+ rightHeaderClass += " " + rightHeaderClass + "--ie1X";
}
return (
<header>
@@ -124,12 +124,12 @@ export const DocEditorContent = ({children}) => {
export const DocEditorLayout = ({component, docURL, endpoint, crumbs}) => {
return (
<div id="dashboard" className="one-pane doc-editor-page">
- <OnePaneHeader
- crumbs={crumbs}
- endpoint={endpoint}
- docURL={docURL}
- >
- </OnePaneHeader>
+ <OnePaneHeader
+ crumbs={crumbs}
+ endpoint={endpoint}
+ docURL={docURL}
+ >
+ </OnePaneHeader>
<DocEditorContent>
{component}
</DocEditorContent>
diff --git a/app/addons/components/stores.js b/app/addons/components/stores.js
index 504c6bc..8adfd21 100644
--- a/app/addons/components/stores.js
+++ b/app/addons/components/stores.js
@@ -37,10 +37,10 @@ Stores.DeleteDbModalStore = FauxtonAPI.Store.extend({
switch (action.type) {
case ActionTypes.CMPNTS_DATABASES_SHOWDELETE_MODAL:
this.setDeleteModal(action.options);
- break;
+ break;
default:
- return;
+ return;
}
this.triggerChange();
diff --git a/app/addons/config/__tests__/actions.test.js b/app/addons/config/__tests__/actions.test.js
index 5e851ec..410dabc 100644
--- a/app/addons/config/__tests__/actions.test.js
+++ b/app/addons/config/__tests__/actions.test.js
@@ -44,9 +44,9 @@ describe('Config Actions', () => {
stub.returns(promise);
return Actions.addOption(node, option)
- .then(() => {
- assert.ok(spy.calledOnce);
- });
+ .then(() => {
+ assert.ok(spy.calledOnce);
+ });
});
it('shows notification when option add succeeds', () => {
@@ -57,9 +57,9 @@ describe('Config Actions', () => {
stub.returns(promise);
return Actions.addOption(node, option)
- .then(() => {
- assert.ok(spy.calledOnce);
- });
+ .then(() => {
+ assert.ok(spy.calledOnce);
+ });
});
it('calls optionAddFailure when option add fails', () => {
@@ -70,9 +70,9 @@ describe('Config Actions', () => {
stub.returns(promise);
return Actions.addOption(node, option)
- .then(() => {
- assert.ok(spy.calledOnce);
- });
+ .then(() => {
+ assert.ok(spy.calledOnce);
+ });
});
it('shows notification when option add fails', () => {
@@ -83,9 +83,9 @@ describe('Config Actions', () => {
stub.returns(promise);
return Actions.addOption(node, option)
- .then(() => {
- assert.ok(spy.calledOnce);
- });
+ .then(() => {
+ assert.ok(spy.calledOnce);
+ });
});
});
@@ -106,9 +106,9 @@ describe('Config Actions', () => {
stub.returns(promise);
return Actions.saveOption(node, option)
- .then(() => {
- assert.ok(spy.calledOnce);
- });
+ .then(() => {
+ assert.ok(spy.calledOnce);
+ });
});
it('shows notification when option save succeeds', () => {
@@ -119,9 +119,9 @@ describe('Config Actions', () => {
stub.returns(promise);
return Actions.saveOption(node, option)
- .then(() => {
- assert.ok(spy.calledOnce);
- });
+ .then(() => {
+ assert.ok(spy.calledOnce);
+ });
});
it('calls optionSaveFailure when option save fails', () => {
@@ -132,9 +132,9 @@ describe('Config Actions', () => {
stub.returns(promise);
return Actions.saveOption(node, option)
- .then(() => {
- assert.ok(spy.calledOnce);
- });
+ .then(() => {
+ assert.ok(spy.calledOnce);
+ });
});
it('shows notification when option save fails', () => {
@@ -145,9 +145,9 @@ describe('Config Actions', () => {
stub.returns(promise);
return Actions.saveOption(node, option)
- .then(() => {
- assert.ok(spy.calledOnce);
- });
+ .then(() => {
+ assert.ok(spy.calledOnce);
+ });
});
});
@@ -168,9 +168,9 @@ describe('Config Actions', () => {
stub.returns(promise);
return Actions.deleteOption(node, option)
- .then(() => {
- assert.ok(spy.calledOnce);
- });
+ .then(() => {
+ assert.ok(spy.calledOnce);
+ });
});
it('shows notification when option delete succeeds', () => {
@@ -181,9 +181,9 @@ describe('Config Actions', () => {
stub.returns(promise);
return Actions.deleteOption(node, option)
- .then(() => {
- assert.ok(spy.calledOnce);
- });
+ .then(() => {
+ assert.ok(spy.calledOnce);
+ });
});
it('calls optionDeleteFailure when option delete fails', () => {
@@ -194,9 +194,9 @@ describe('Config Actions', () => {
stub.returns(promise);
return Actions.deleteOption(node, option)
- .then(() => {
- assert.ok(spy.calledOnce);
- });
+ .then(() => {
+ assert.ok(spy.calledOnce);
+ });
});
it('shows notification when option delete fails', () => {
@@ -207,9 +207,9 @@ describe('Config Actions', () => {
stub.returns(promise);
return Actions.deleteOption(node, option)
- .then(() => {
- assert.ok(spy.calledOnce);
- });
+ .then(() => {
+ assert.ok(spy.calledOnce);
+ });
});
});
});
diff --git a/app/addons/config/components.js b/app/addons/config/components.js
index 3bd0d68..0a9b8ea 100644
--- a/app/addons/config/components.js
+++ b/app/addons/config/components.js
@@ -67,16 +67,15 @@ class ConfigTableController extends React.Component {
<Components.LoadLines />
</div>
);
- } else {
- return (
- <ConfigTable
- onDeleteOption={this.deleteOption}
- onSaveOption={this.saveOption}
- onEditOption={this.editOption}
- onCancelEdit={this.cancelEdit}
- options={this.state.options}/>
- );
}
+ return (
+ <ConfigTable
+ onDeleteOption={this.deleteOption}
+ onSaveOption={this.saveOption}
+ onEditOption={this.editOption}
+ onCancelEdit={this.cancelEdit}
+ options={this.state.options}/>
+ );
}
}
@@ -100,15 +99,15 @@ class ConfigTable extends React.Component {
return (
<table className="config table table-striped table-bordered">
<thead>
- <tr>
- <th id="config-section" width="22%">Section</th>
- <th id="config-option" width="22%">Option</th>
- <th id="config-value">Value</th>
- <th id="config-trash"></th>
- </tr>
+ <tr>
+ <th id="config-section" width="22%">Section</th>
+ <th id="config-option" width="22%">Option</th>
+ <th id="config-value">Value</th>
+ <th id="config-trash"></th>
+ </tr>
</thead>
<tbody>
- {options}
+ {options}
</tbody>
</table>
);
@@ -189,20 +188,20 @@ class ConfigOptionValue extends React.Component {
getButtons = () => {
if (this.state.saving) {
return null;
- } else {
- return (
- <span>
- <button
- className="btn btn-primary fonticon-ok-circled btn-small btn-config-save"
- onClick={this.onSave.bind(this)}
- />
- <button
- className="btn fonticon-cancel-circled btn-small btn-config-cancel"
- onClick={this.props.onCancelEdit}
- />
- </span>
- );
}
+ return (
+ <span>
+ <button
+ className="btn btn-primary fonticon-ok-circled btn-small btn-config-save"
+ onClick={this.onSave.bind(this)}
+ />
+ <button
+ className="btn fonticon-cancel-circled btn-small btn-config-cancel"
+ onClick={this.props.onCancelEdit}
+ />
+ </span>
+ );
+
};
render() {
@@ -220,13 +219,13 @@ class ConfigOptionValue extends React.Component {
</div>
</td>
);
- } else {
- return (
- <td className="config-show-value" onClick={this.props.onEdit}>
- {this.props.value}
- </td>
- );
}
+ return (
+ <td className="config-show-value" onClick={this.props.onEdit}>
+ {this.props.value}
+ </td>
+ );
+
}
}
@@ -250,7 +249,7 @@ class ConfigOptionTrash extends React.Component {
render() {
return (
<td className="text-center config-item-trash config-delete-value"
- onClick={this.showModal.bind(this)}>
+ onClick={this.showModal.bind(this)}>
<i className="icon icon-trash"></i>
<FauxtonComponents.ConfirmationModal
text={`Are you sure you want to delete ${this.props.sectionName}/${this.props.optionName}?`}
@@ -366,7 +365,7 @@ class AddOptionButton extends React.Component {
<Button
id="add-option-button"
onClick={this.togglePopover.bind(this)}
- ref="target">
+ ref={node => this.target = node}>
<i className="icon icon-plus header-icon"></i>
Add Option
</Button>
@@ -376,7 +375,7 @@ class AddOptionButton extends React.Component {
onHide={this.hidePopover.bind(this)}
placement="bottom"
rootClose={true}
- target={() => ReactDOM.findDOMNode(this.refs.target)}>
+ target={() => this.target}>
{this.getPopover()}
</Overlay>
</div>
@@ -387,9 +386,9 @@ class AddOptionButton extends React.Component {
const TabItem = ({active, link, title}) => {
return (
<li className={active ? 'active' : ''}>
- <a href={`#${link}`}>
+ <a href={`#${link}`}>
{title}
- </a>
+ </a>
</li>
);
};
@@ -408,7 +407,7 @@ const Tabs = ({sidebarItems, selectedTab}) => {
active={selectedTab === item.title}
title={item.title}
link={item.link}
- />;
+ />;
});
return (
<nav className="sidenav">
diff --git a/app/addons/config/layout.js b/app/addons/config/layout.js
index 1a75288..f3ff87b 100644
--- a/app/addons/config/layout.js
+++ b/app/addons/config/layout.js
@@ -65,7 +65,7 @@ export const ConfigLayout = ({showCors, docURL, node, endpoint, crumbs}) => {
<ConfigComponents.Tabs
sidebarItems={sidebarItems}
selectedTab={selectedTab}
- />
+ />
</aside>
<section id="dashboard-content" className="flex-layout flex-col">
<div id="dashboard-upper-content"></div>
diff --git a/app/addons/cors/actions.js b/app/addons/cors/actions.js
index 3ba2e08..eb05dab 100644
--- a/app/addons/cors/actions.js
+++ b/app/addons/cors/actions.js
@@ -87,14 +87,14 @@ export const saveCors = (url, options) => (dispatch) => {
});
dispatch(loadCORSOptions(options));
}).catch((error) => {
- FauxtonAPI.addNotification({
- msg: 'Error! Could not save your CORS settings. Please try again. ' + errorReason(error),
- type: 'error',
- clear: true
- });
- dispatch(hideDomainDeleteConfirmation());
- dispatch(hideLoadingBars());
+ FauxtonAPI.addNotification({
+ msg: 'Error! Could not save your CORS settings. Please try again. ' + errorReason(error),
+ type: 'error',
+ clear: true
});
+ dispatch(hideDomainDeleteConfirmation());
+ dispatch(hideLoadingBars());
+ });
};
const errorReason = (error) => {
diff --git a/app/addons/cors/reducers.js b/app/addons/cors/reducers.js
index 9b8d3f2..0a35d4b 100644
--- a/app/addons/cors/reducers.js
+++ b/app/addons/cors/reducers.js
@@ -13,15 +13,15 @@
import ActionTypes from "./actiontypes";
const initialState = {
- corsEnabled: false,
- origins: [],
- isAllOrigins: false,
- configChanged: false,
- shouldSaveChange: false,
- node: '',
- isLoading: true,
- deleteDomainModalVisible: false,
- domainToDelete: ''
+ corsEnabled: false,
+ origins: [],
+ isAllOrigins: false,
+ configChanged: false,
+ shouldSaveChange: false,
+ node: '',
+ isLoading: true,
+ deleteDomainModalVisible: false,
+ domainToDelete: ''
};
export default function cors (state = initialState, action) {
@@ -63,5 +63,4 @@ export default function cors (state = initialState, action) {
default:
return state;
}
-};
-
+}
diff --git a/app/addons/databases/actions.js b/app/addons/databases/actions.js
index 51827e6..1e7794c 100644
--- a/app/addons/databases/actions.js
+++ b/app/addons/databases/actions.js
@@ -150,22 +150,22 @@ export default {
var db = Stores.databasesStore.obtainNewDatabaseModel(databaseName);
FauxtonAPI.addNotification({ msg: 'Creating database.' });
db.save().done(function () {
- FauxtonAPI.addNotification({
- msg: 'Database created successfully',
- type: 'success',
- clear: true
- });
- var route = FauxtonAPI.urls('allDocs', 'app', app.utils.safeURLName(databaseName), '?limit=' + Resources.DocLimit);
- app.router.navigate(route, { trigger: true });
- }
+ FauxtonAPI.addNotification({
+ msg: 'Database created successfully',
+ type: 'success',
+ clear: true
+ });
+ var route = FauxtonAPI.urls('allDocs', 'app', app.utils.safeURLName(databaseName), '?limit=' + Resources.DocLimit);
+ app.router.navigate(route, { trigger: true });
+ }
).fail(function (xhr) {
- var responseText = JSON.parse(xhr.responseText).reason;
- FauxtonAPI.addNotification({
- msg: 'Create database failed: ' + responseText,
- type: 'error',
- clear: true
- });
- }
+ var responseText = JSON.parse(xhr.responseText).reason;
+ FauxtonAPI.addNotification({
+ msg: 'Create database failed: ' + responseText,
+ type: 'error',
+ clear: true
+ });
+ }
);
},
diff --git a/app/addons/databases/components.js b/app/addons/databases/components.js
index 0bb9c31..2124230 100644
--- a/app/addons/databases/components.js
+++ b/app/addons/databases/components.js
@@ -123,7 +123,7 @@ class DatabaseTable extends React.Component {
</tr>
</thead>
<tbody>
- {rows}
+ {rows}
</tbody>
</table>
</div>
@@ -227,7 +227,7 @@ class AddDatabaseWidget extends React.Component {
};
focusInput = () => {
- ReactDOM.findDOMNode(this.refs.newDbName).focus();
+ this.newDbName.focus();
};
onKeyUpInInput = (e) => {
@@ -258,13 +258,13 @@ class AddDatabaseWidget extends React.Component {
<span className="add-on">Create Database</span>
<input
id="js-new-database-name"
- ref="newDbName"
+ ref={node => this.newDbName = node}
type="text"
value={this.state.databaseName}
onChange={this.onChange} onKeyUp={this.onKeyUpInInput}
className="input-xxlarge"
placeholder="Name of database"
- />
+ />
<a className="btn" id="js-create-database" onClick={this.onAddDatabase}>Create</a>
</TrayContents>
</div>
diff --git a/app/addons/databases/layout.js b/app/addons/databases/layout.js
index f2d3079..499248e 100644
--- a/app/addons/databases/layout.js
+++ b/app/addons/databases/layout.js
@@ -24,7 +24,7 @@ export const Layout = () => {
endpoint={FauxtonAPI.urls('allDBs', 'apiurl')}
docURL={FauxtonAPI.constants.DOC_URLS.ALL_DBS}
>
- <RightDatabasesHeader />
+ <RightDatabasesHeader />
</OnePaneHeader>
<OnePaneContent>
<DatabasesController />
diff --git a/app/addons/databases/resources.js b/app/addons/databases/resources.js
index 639bc0d..dfb9c46 100644
--- a/app/addons/databases/resources.js
+++ b/app/addons/databases/resources.js
@@ -54,9 +54,9 @@ Databases.Model = FauxtonAPI.Model.extend({
return FauxtonAPI.urls('changes', 'apiurl', this.safeID(), '?descending=true&limit=100&include_docs=true');
} else if (context === "app") {
return "/database/" + this.safeID();
- } else {
- return app.host + "/" + this.safeID();
}
+ return app.host + "/" + this.safeID();
+
},
safeID: function () {
diff --git a/app/addons/databases/stores.js b/app/addons/databases/stores.js
index b517a61..6884669 100644
--- a/app/addons/databases/stores.js
+++ b/app/addons/databases/stores.js
@@ -103,19 +103,19 @@ const DatabasesStoreConstructor = FauxtonAPI.Store.extend({
switch (action.type) {
case ActionTypes.DATABASES_SETPAGE:
this._page = action.options.page;
- break;
+ break;
case ActionTypes.DATABASES_SET_PROMPT_VISIBLE:
this.setPromptVisible(action.options.visible);
- break;
+ break;
case ActionTypes.DATABASES_STARTLOADING:
this.setLoading(true);
- break;
+ break;
case ActionTypes.DATABASES_LOADCOMPLETE:
this.setLoading(false);
- break;
+ break;
case ActionTypes.DATABASES_UPDATE:
this._fullDbList = action.options.fullDbList;
@@ -123,10 +123,10 @@ const DatabasesStoreConstructor = FauxtonAPI.Store.extend({
this._databaseDetails = action.options.databaseDetails;
this._failedDbs = action.options.failedDbs;
this.setLoading(false);
- break;
+ break;
default:
- return;
+ return;
}
this.triggerChange();
diff --git a/app/addons/databases/tests/nightwatch/checkDatabaseTooltip.js b/app/addons/databases/tests/nightwatch/checkDatabaseTooltip.js
index e5b0353..ded2916 100644
--- a/app/addons/databases/tests/nightwatch/checkDatabaseTooltip.js
+++ b/app/addons/databases/tests/nightwatch/checkDatabaseTooltip.js
@@ -45,6 +45,6 @@ module.exports = {
// confirm the tooltip element has been inserted
.waitForElementPresent('.tooltip.fade.top.in', waitTime, false)
- .end();
+ .end();
}
};
diff --git a/app/addons/databases/tests/nightwatch/createsDatabase.js b/app/addons/databases/tests/nightwatch/createsDatabase.js
index a4185f1..ad5803b 100644
--- a/app/addons/databases/tests/nightwatch/createsDatabase.js
+++ b/app/addons/databases/tests/nightwatch/createsDatabase.js
@@ -56,34 +56,34 @@ module.exports = {
this.verify.ok(createdDatabaseIsPresent > 0,
'Checking if new database shows up in _all_dbs.');
})
- .end();
+ .end();
},
'Creates a Database with invalid name' : function (client) {
- var waitTime = client.globals.maxWaitTime,
- baseUrl = client.globals.test_settings.launch_url;
+ var waitTime = client.globals.maxWaitTime,
+ baseUrl = client.globals.test_settings.launch_url;
- client
- .loginToGUI()
- .checkForDatabaseDeleted(invalidDatabaseName, waitTime)
- .url(baseUrl)
+ client
+ .loginToGUI()
+ .checkForDatabaseDeleted(invalidDatabaseName, waitTime)
+ .url(baseUrl)
- // ensure the page has fully loaded
- .waitForElementPresent('.databases.table', waitTime, false)
- .clickWhenVisible('.add-new-database-btn')
- .waitForElementVisible('#js-new-database-name', waitTime, false)
- .setValue('#js-new-database-name', [invalidDatabaseName])
- .clickWhenVisible('#js-create-database', waitTime, false)
- .waitForElementVisible('.global-notification.alert.alert-error', waitTime, false)
- .url(baseUrl + '/_all_dbs')
- .waitForElementVisible('html', waitTime, false)
- .getText('html', function (result) {
- var data = result.value,
- createdDatabaseIsPresent = data.indexOf(invalidDatabaseName);
+ // ensure the page has fully loaded
+ .waitForElementPresent('.databases.table', waitTime, false)
+ .clickWhenVisible('.add-new-database-btn')
+ .waitForElementVisible('#js-new-database-name', waitTime, false)
+ .setValue('#js-new-database-name', [invalidDatabaseName])
+ .clickWhenVisible('#js-create-database', waitTime, false)
+ .waitForElementVisible('.global-notification.alert.alert-error', waitTime, false)
+ .url(baseUrl + '/_all_dbs')
+ .waitForElementVisible('html', waitTime, false)
+ .getText('html', function (result) {
+ var data = result.value,
+ createdDatabaseIsPresent = data.indexOf(invalidDatabaseName);
- this.verify.ok(createdDatabaseIsPresent === -1,
- 'Checking if new database shows up in _all_dbs.');
- })
- .end();
- }
+ this.verify.ok(createdDatabaseIsPresent === -1,
+ 'Checking if new database shows up in _all_dbs.');
+ })
+ .end();
+ }
};
diff --git a/app/addons/databases/tests/nightwatch/deletesDatabase.js b/app/addons/databases/tests/nightwatch/deletesDatabase.js
index 9e2212c..d82c314 100644
--- a/app/addons/databases/tests/nightwatch/deletesDatabase.js
+++ b/app/addons/databases/tests/nightwatch/deletesDatabase.js
@@ -28,8 +28,7 @@ module.exports = {
.clickWhenVisible('.delete-db-modal input[type="text"]', waitTime, false)
.setValue('.delete-db-modal input[type="text"]', [newDatabaseName, client.Keys.ENTER])
.checkForDatabaseDeleted(newDatabaseName, waitTime)
-
- .end();
+ .end();
},
'Deletes a database from the list': function (client) {
@@ -53,6 +52,6 @@ module.exports = {
.checkForDatabaseDeleted(newDatabaseName, waitTime)
.assert.elementNotPresent('a[href="database/' + newDatabaseName + '/_all_docs"]')
- .end();
+ .end();
}
};
diff --git a/app/addons/databases/tests/nightwatch/deletesDatabaseSpecialChars.js b/app/addons/databases/tests/nightwatch/deletesDatabaseSpecialChars.js
index 9527567..37d8b28 100644
--- a/app/addons/databases/tests/nightwatch/deletesDatabaseSpecialChars.js
+++ b/app/addons/databases/tests/nightwatch/deletesDatabaseSpecialChars.js
@@ -30,7 +30,7 @@ module.exports = {
.checkForDatabaseDeleted(newDatabaseName, waitTime)
- .end();
+ .end();
},
'Deletes a database from the list with special chars': function (client) {
@@ -53,6 +53,6 @@ module.exports = {
.checkForDatabaseDeleted(newDatabaseName, waitTime)
.assert.elementNotPresent('a[href="database/' + newDatabaseName + '/_all_docs"]')
- .end();
+ .end();
}
};
diff --git a/app/addons/databases/tests/nightwatch/permissionsDbTable.js b/app/addons/databases/tests/nightwatch/permissionsDbTable.js
index 64711f7..5ad73f5 100644
--- a/app/addons/databases/tests/nightwatch/permissionsDbTable.js
+++ b/app/addons/databases/tests/nightwatch/permissionsDbTable.js
@@ -31,6 +31,6 @@ module.exports = {
.waitForElementVisible('[data-name="database-load-fail-name"]', waitTime, false)
.assert.containsText('[data-name="database-load-fail-name"]', '_global_changes')
- .end();
+ .end();
}
};
diff --git a/app/addons/databases/tests/nightwatch/specialCharListLinks.js b/app/addons/databases/tests/nightwatch/specialCharListLinks.js
index 06f31df..aef1b68 100644
--- a/app/addons/databases/tests/nightwatch/specialCharListLinks.js
+++ b/app/addons/databases/tests/nightwatch/specialCharListLinks.js
@@ -44,6 +44,6 @@ function createTest (db) {
.assert.containsText('.no-results-screen', 'No Documents Found')
.assert.containsText('.faux-header__doc-header-title', db)
- .end();
+ .end();
};
}
diff --git a/app/addons/documentation/routes.js b/app/addons/documentation/routes.js
index be075d3..1d828ca 100644
--- a/app/addons/documentation/routes.js
+++ b/app/addons/documentation/routes.js
@@ -27,7 +27,7 @@ var DocumentationRouteObject = FauxtonAPI.RouteObject.extend({
return <OnePaneSimpleLayout
component={<DocumentationComponents.DocumentationPage/>}
crumbs={[
- {'name': 'Documentation'}
+ {'name': 'Documentation'}
]}
/>;
}
diff --git a/app/addons/documentation/tests/nightwatch/checksDocsPage.js b/app/addons/documentation/tests/nightwatch/checksDocsPage.js
index 1185015..e36e3c5 100644
--- a/app/addons/documentation/tests/nightwatch/checksDocsPage.js
+++ b/app/addons/documentation/tests/nightwatch/checksDocsPage.js
@@ -30,6 +30,6 @@ module.exports = {
.waitForElementVisible('a[href="https://twitter.com/couchdb"]', waitTime, false)
.waitForElementVisible('a[href="https://plus.google.com/+CouchDB"]', waitTime, false)
.waitForElementVisible('a[href="https://www.linkedin.com/company/apache-couchdb"]', waitTime, false)
- .end();
+ .end();
}
};
diff --git a/app/addons/documents/__tests__/changes.test.js b/app/addons/documents/__tests__/changes.test.js
index 4b9df66..0745458 100644
--- a/app/addons/documents/__tests__/changes.test.js
+++ b/app/addons/documents/__tests__/changes.test.js
@@ -37,7 +37,7 @@ describe('ChangesTabContent', () => {
it('should add filter markup', () => {
const submitBtn = el.find('[type="submit"]'),
- addItemField = el.find('.js-changes-filter-field');
+ addItemField = el.find('.js-changes-filter-field');
addItemField.simulate('change', {target: {value: 'I wandered lonely as a filter'}});
submitBtn.simulate('submit');
@@ -50,7 +50,7 @@ describe('ChangesTabContent', () => {
it('should call addFilter action on click', () => {
const submitBtn = el.find('[type="submit"]'),
- addItemField = el.find('.js-changes-filter-field');
+ addItemField = el.find('.js-changes-filter-field');
const spy = sinon.spy(Actions, 'addFilter');
@@ -62,7 +62,7 @@ describe('ChangesTabContent', () => {
it('should remove filter markup', () => {
const submitBtn = el.find('[type="submit"]'),
- addItemField = el.find('.js-changes-filter-field');
+ addItemField = el.find('.js-changes-filter-field');
addItemField.simulate('change', {target: {value: 'I wandered lonely as a filter'}});
submitBtn.simulate('submit');
@@ -79,7 +79,7 @@ describe('ChangesTabContent', () => {
it('should call removeFilter action on click', () => {
const submitBtn = el.find('[type="submit"]'),
- addItemField = el.find('.js-changes-filter-field');
+ addItemField = el.find('.js-changes-filter-field');
const spy = sinon.spy(Actions, 'removeFilter');
@@ -92,7 +92,7 @@ describe('ChangesTabContent', () => {
it('should not add empty filters', () => {
const submitBtn = el.find('[type="submit"]'),
- addItemField = el.find('.js-changes-filter-field');
+ addItemField = el.find('.js-changes-filter-field');
addItemField.simulate('change', {target: {value: ''}});
submitBtn.simulate('submit');
@@ -106,7 +106,7 @@ describe('ChangesTabContent', () => {
it('should not add the same filter twice', () => {
const submitBtn = el.find('[type="submit"]'),
- addItemField = el.find('.js-changes-filter-field');
+ addItemField = el.find('.js-changes-filter-field');
const filter = 'I am unique in the whole wide world';
addItemField.simulate('change', {target: {value: filter}});
diff --git a/app/addons/documents/__tests__/fetch-actions.test.js b/app/addons/documents/__tests__/fetch-actions.test.js
index 2e1059f..ba85e5f 100644
--- a/app/addons/documents/__tests__/fetch-actions.test.js
+++ b/app/addons/documents/__tests__/fetch-actions.test.js
@@ -216,20 +216,20 @@ describe('Docs Fetch API', () => {
expect(res).toEqual({
docType: Constants.INDEX_RESULTS_DOC_TYPE.VIEW,
docs: [
- {
- id: "foo",
- key: "foo",
- value: {
- rev: "1-1390740c4877979dbe8998382876556c"
- }
- },
- {
- id: "foo2",
- key: "foo2",
- value: {
- rev: "2-1390740c4877979dbe8998382876556c"
- }
- }]
+ {
+ id: "foo",
+ key: "foo",
+ value: {
+ rev: "1-1390740c4877979dbe8998382876556c"
+ }
+ },
+ {
+ id: "foo2",
+ key: "foo2",
+ value: {
+ rev: "2-1390740c4877979dbe8998382876556c"
+ }
+ }]
});
});
});
diff --git a/app/addons/documents/__tests__/pagination-footer.test.js b/app/addons/documents/__tests__/pagination-footer.test.js
index 97c0d95..952382a 100644
--- a/app/addons/documents/__tests__/pagination-footer.test.js
+++ b/app/addons/documents/__tests__/pagination-footer.test.js
@@ -25,54 +25,54 @@ describe('PaginationFooter', () => {
it('does not show table controls if showPrioritizedEnabled is false', () => {
const wrapper = mount(<PaginationFooter
- showPrioritizedEnabled={false}
- hasResults={true}
- prioritizedEnabled={false}
- displayedFields={displayedFields}
- perPage={20}
- canShowNext={false}
- canShowPrevious={false}
- toggleShowAllColumns={() => {}}
- docs={[]}
- pageStart={1}
- pageEnd={20}
- />);
+ showPrioritizedEnabled={false}
+ hasResults={true}
+ prioritizedEnabled={false}
+ displayedFields={displayedFields}
+ perPage={20}
+ canShowNext={false}
+ canShowPrevious={false}
+ toggleShowAllColumns={() => {}}
+ docs={[]}
+ pageStart={1}
+ pageEnd={20}
+ />);
expect(wrapper.find('#footer-doc-control-prioritized').length).toBe(0);
});
it('does not show table controls if hasResults is false', () => {
const wrapper = mount(<PaginationFooter
- showPrioritizedEnabled={true}
- hasResults={false}
- prioritizedEnabled={false}
- displayedFields={displayedFields}
- perPage={20}
- canShowNext={false}
- canShowPrevious={false}
- toggleShowAllColumns={() => {}}
- docs={[]}
- pageStart={1}
- pageEnd={20}
- />);
+ showPrioritizedEnabled={true}
+ hasResults={false}
+ prioritizedEnabled={false}
+ displayedFields={displayedFields}
+ perPage={20}
+ canShowNext={false}
+ canShowPrevious={false}
+ toggleShowAllColumns={() => {}}
+ docs={[]}
+ pageStart={1}
+ pageEnd={20}
+ />);
expect(wrapper.find('#footer-doc-control-prioritized').length).toBe(0);
});
it('does show table controls if showPrioritizedEnabled and hasResults are true', () => {
const wrapper = mount(<PaginationFooter
- showPrioritizedEnabled={true}
- hasResults={true}
- prioritizedEnabled={false}
- displayedFields={displayedFields}
- perPage={20}
- canShowNext={false}
- canShowPrevious={false}
- toggleShowAllColumns={() => {}}
- docs={[]}
- pageStart={1}
- pageEnd={20}
- />);
+ showPrioritizedEnabled={true}
+ hasResults={true}
+ prioritizedEnabled={false}
+ displayedFields={displayedFields}
+ perPage={20}
+ canShowNext={false}
+ canShowPrevious={false}
+ toggleShowAllColumns={() => {}}
+ docs={[]}
+ pageStart={1}
+ pageEnd={20}
+ />);
expect(wrapper.find('#footer-doc-control-prioritized').length).toBe(1);
});
@@ -80,19 +80,19 @@ describe('PaginationFooter', () => {
it('calls paginateNext when clicked and available', () => {
const spy = sinon.spy();
const wrapper = mount(<PaginationFooter
- showPrioritizedEnabled={true}
- hasResults={true}
- prioritizedEnabled={false}
- displayedFields={displayedFields}
- perPage={20}
- canShowNext={true}
- canShowPrevious={false}
- toggleShowAllColumns={() => {}}
- docs={[]}
- pageStart={1}
- pageEnd={20}
- paginateNext={spy}
- />);
+ showPrioritizedEnabled={true}
+ hasResults={true}
+ prioritizedEnabled={false}
+ displayedFields={displayedFields}
+ perPage={20}
+ canShowNext={true}
+ canShowPrevious={false}
+ toggleShowAllColumns={() => {}}
+ docs={[]}
+ pageStart={1}
+ pageEnd={20}
+ paginateNext={spy}
+ />);
wrapper.instance().nextClicked({ preventDefault: () => {} });
expect(spy.calledOnce).toBe(true);
@@ -101,19 +101,19 @@ describe('PaginationFooter', () => {
it('does not call paginateNext when clicked and not available', () => {
const spy = sinon.spy();
const wrapper = mount(<PaginationFooter
- showPrioritizedEnabled={true}
- hasResults={true}
- prioritizedEnabled={false}
- displayedFields={displayedFields}
- perPage={20}
- canShowNext={false}
- canShowPrevious={false}
- toggleShowAllColumns={() => {}}
- docs={[]}
- pageStart={1}
- pageEnd={20}
- paginateNext={spy}
- />);
+ showPrioritizedEnabled={true}
+ hasResults={true}
+ prioritizedEnabled={false}
+ displayedFields={displayedFields}
+ perPage={20}
+ canShowNext={false}
+ canShowPrevious={false}
+ toggleShowAllColumns={() => {}}
+ docs={[]}
+ pageStart={1}
+ pageEnd={20}
+ paginateNext={spy}
+ />);
wrapper.instance().nextClicked({ preventDefault: () => {} });
expect(spy.calledOnce).toBe(false);
@@ -122,19 +122,19 @@ describe('PaginationFooter', () => {
it('calls paginatePrevious when clicked and available', () => {
const spy = sinon.spy();
const wrapper = mount(<PaginationFooter
- showPrioritizedEnabled={true}
- hasResults={true}
- prioritizedEnabled={false}
- displayedFields={displayedFields}
- perPage={20}
- canShowNext={false}
- canShowPrevious={true}
- toggleShowAllColumns={() => {}}
- docs={[]}
- pageStart={1}
- pageEnd={20}
- paginatePrevious={spy}
- />);
+ showPrioritizedEnabled={true}
+ hasResults={true}
+ prioritizedEnabled={false}
+ displayedFields={displayedFields}
+ perPage={20}
+ canShowNext={false}
+ canShowPrevious={true}
+ toggleShowAllColumns={() => {}}
+ docs={[]}
+ pageStart={1}
+ pageEnd={20}
+ paginatePrevious={spy}
+ />);
wrapper.instance().previousClicked({ preventDefault: () => {} });
expect(spy.calledOnce).toBe(true);
@@ -143,19 +143,19 @@ describe('PaginationFooter', () => {
it('does not call paginatePrevious when clicked and not available', () => {
const spy = sinon.spy();
const wrapper = mount(<PaginationFooter
- showPrioritizedEnabled={true}
- hasResults={true}
- prioritizedEnabled={false}
- displayedFields={displayedFields}
- perPage={20}
- canShowNext={false}
- canShowPrevious={false}
- toggleShowAllColumns={() => {}}
- docs={[]}
- pageStart={1}
- pageEnd={20}
- paginatePrevious={spy}
- />);
+ showPrioritizedEnabled={true}
+ hasResults={true}
+ prioritizedEnabled={false}
+ displayedFields={displayedFields}
+ perPage={20}
+ canShowNext={false}
+ canShowPrevious={false}
+ toggleShowAllColumns={() => {}}
+ docs={[]}
+ pageStart={1}
+ pageEnd={20}
+ paginatePrevious={spy}
+ />);
wrapper.instance().previousClicked({ preventDefault: () => {} });
expect(spy.calledOnce).toBe(false);
@@ -163,36 +163,36 @@ describe('PaginationFooter', () => {
it('renders custom text when no docs', () => {
const wrapper = mount(<PaginationFooter
- showPrioritizedEnabled={true}
- hasResults={true}
- prioritizedEnabled={false}
- displayedFields={displayedFields}
- perPage={20}
- canShowNext={false}
- canShowPrevious={false}
- toggleShowAllColumns={() => {}}
- docs={[]}
- pageStart={1}
- pageEnd={20}
- />);
+ showPrioritizedEnabled={true}
+ hasResults={true}
+ prioritizedEnabled={false}
+ displayedFields={displayedFields}
+ perPage={20}
+ canShowNext={false}
+ canShowPrevious={false}
+ toggleShowAllColumns={() => {}}
+ docs={[]}
+ pageStart={1}
+ pageEnd={20}
+ />);
expect(wrapper.find('.current-docs span').text()).toMatch('Showing 0 documents.');
});
it('renders text indicating range when docs', () => {
const wrapper = mount(<PaginationFooter
- showPrioritizedEnabled={true}
- hasResults={true}
- prioritizedEnabled={false}
- displayedFields={displayedFields}
- perPage={20}
- canShowNext={false}
- canShowPrevious={false}
- toggleShowAllColumns={() => {}}
- docs={[{_id: 'foo'}]}
- pageStart={1}
- pageEnd={20}
- />);
+ showPrioritizedEnabled={true}
+ hasResults={true}
+ prioritizedEnabled={false}
+ displayedFields={displayedFields}
+ perPage={20}
+ canShowNext={false}
+ canShowPrevious={false}
+ toggleShowAllColumns={() => {}}
+ docs={[{_id: 'foo'}]}
+ pageStart={1}
+ pageEnd={20}
+ />);
expect(wrapper.find('.current-docs span').text()).toMatch('Showing document 1 - 20.');
});
diff --git a/app/addons/documents/__tests__/queryoptions-actions.test.js b/app/addons/documents/__tests__/queryoptions-actions.test.js
index 0fa54f3..7072617 100644
--- a/app/addons/documents/__tests__/queryoptions-actions.test.js
+++ b/app/addons/documents/__tests__/queryoptions-actions.test.js
@@ -77,16 +77,16 @@ describe('Docs Query Options API', () => {
it('queryOptionsUpdateBetweenKeys returns the proper event to dispatch', () => {
const newBetweenKeys = {
include: true,
- startkey: '\"_design\"',
- endkey: '\"_design\"'
+ startkey: '"_design"',
+ endkey: '"_design"'
};
expect(Actions.queryOptionsUpdateBetweenKeys(newBetweenKeys)).toEqual({
type: ActionTypes.INDEX_RESULTS_REDUX_NEW_QUERY_OPTIONS,
options: {
betweenKeys: {
include: true,
- startkey: '\"_design\"',
- endkey: '\"_design\"'
+ startkey: '"_design"',
+ endkey: '"_design"'
}
}
});
@@ -148,8 +148,8 @@ describe('Docs Query Options API', () => {
options: {
betweenKeys: {
include: false,
- startkey: '\"_design\"',
- endkey: '\"_design0\"'
+ startkey: '"_design"',
+ endkey: '"_design0"'
},
showBetweenKeys: true,
showByKeys: false
diff --git a/app/addons/documents/__tests__/reducers.test.js b/app/addons/documents/__tests__/reducers.test.js
index 1257300..f9a08d9 100644
--- a/app/addons/documents/__tests__/reducers.test.js
+++ b/app/addons/documents/__tests__/reducers.test.js
@@ -381,8 +381,8 @@ describe('Docs Reducers', () => {
showBetweenKeys: true,
betweenKeys: {
include: true,
- startkey: '\"_design\"',
- endkey: '\"_design0\"'
+ startkey: '"_design"',
+ endkey: '"_design0"'
}
}
};
@@ -390,8 +390,8 @@ describe('Docs Reducers', () => {
const newState = Reducers.default(initialState, action);
expect(Reducers.getQueryOptionsParams(newState)).toEqual({
inclusive_end: true,
- start_key: '\"_design\"',
- end_key: '\"_design0\"'
+ start_key: '"_design"',
+ end_key: '"_design0"'
});
});
diff --git a/app/addons/documents/__tests__/resources.test.js b/app/addons/documents/__tests__/resources.test.js
index cbcf28d..c6951ea 100644
--- a/app/addons/documents/__tests__/resources.test.js
+++ b/app/addons/documents/__tests__/resources.test.js
@@ -93,8 +93,8 @@ describe('QueryParams', () => {
it('parses startkey, endkey', () => {
const params = {
- 'startkey':'[\"a\",\"b\"]',
- 'endkey':'[\"c\",\"d\"]'
+ 'startkey':'["a","b"]',
+ 'endkey':'["c","d"]'
};
const result = Models.QueryParams.parse(params);
@@ -115,7 +115,7 @@ describe('QueryParams', () => {
it('does not modify input', () => {
const params = {
- key:'[\"a\",\"b\"]'
+ key:'["a","b"]'
};
const clone = _.clone(params);
Models.QueryParams.parse(params);
@@ -140,8 +140,8 @@ describe('QueryParams', () => {
const result = Models.QueryParams.stringify(params);
assert.deepEqual(result, {
- 'startkey':'[\"a\",\"b\"]',
- 'endkey':'[\"c\",\"d\"]'
+ 'startkey':'["a","b"]',
+ 'endkey':'["c","d"]'
});
});
@@ -149,7 +149,7 @@ describe('QueryParams', () => {
const params = {'key':['a', 'b']};
const result = Models.QueryParams.stringify(params);
- assert.deepEqual(result, { 'key': '[\"a\",\"b\"]' });
+ assert.deepEqual(result, { 'key': '["a","b"]' });
});
it('does not modify input', () => {
diff --git a/app/addons/documents/__tests__/table-row.test.js b/app/addons/documents/__tests__/table-row.test.js
index b2636c8..5f727f3 100644
--- a/app/addons/documents/__tests__/table-row.test.js
+++ b/app/addons/documents/__tests__/table-row.test.js
@@ -41,7 +41,6 @@ describe('Docs Table Row', () => {
const wrapper = shallow(<TableRow
onClick={sinon.stub()}
docChecked={sinon.stub()}
- isSelected={sinon.stub()}
el={elem}
data={data}
index={0}
diff --git a/app/addons/documents/changes/components.js b/app/addons/documents/changes/components.js
index 60afcd8..9a9c86c 100644
--- a/app/addons/documents/changes/components.js
+++ b/app/addons/documents/changes/components.js
@@ -178,7 +178,7 @@ class AddFilterForm extends React.Component {
}
focusFilterField () {
- ReactDOM.findDOMNode(this.refs.addItem).focus();
+ this.addItem.focus();
}
inputClassNames () {
@@ -194,8 +194,13 @@ class AddFilterForm extends React.Component {
<form className="form-inline js-filter-form" onSubmit={this.submitForm}>
<fieldset>
<i className="fonticon-filter" />
- <input type="text" ref="addItem" className={this.inputClassNames()} placeholder="Sequence or ID"
- onChange={(e) => this.setState({ filter: e.target.value })} value={this.state.filter} />
+ <input
+ type="text"
+ ref={node => this.addItem = node}
+ className={this.inputClassNames()}
+ placeholder="Sequence or ID"
+ onChange={(e) => this.setState({ filter: e.target.value })}
+ value={this.state.filter} />
<button type="submit" className="btn btn-secondary">Filter</button>
<div className="help-block"></div>
</fieldset>
@@ -355,7 +360,7 @@ export class ChangesCodeTransition extends React.Component {
return (
<div key='1' style={{opacity: style.opacity, height: style.height + 'px'}}>
<Components.CodeFormat
- code={this.props.code}
+ code={this.props.code}
/>
</div>
);
@@ -371,10 +376,10 @@ export class ChangesCodeTransition extends React.Component {
render () {
return (
<TransitionMotion
- styles={this.getStyles()}
- willLeave={this.willLeave}
- willEnter={this.willEnter}
- >
+ styles={this.getStyles()}
+ willLeave={this.willLeave}
+ willEnter={this.willEnter}
+ >
{this.getChildren.bind(this)}
</TransitionMotion>
);
diff --git a/app/addons/documents/components/header-docs-left.js b/app/addons/documents/components/header-docs-left.js
index 1d14778..8be0e58 100644
--- a/app/addons/documents/components/header-docs-left.js
+++ b/app/addons/documents/components/header-docs-left.js
@@ -31,11 +31,11 @@ function getDropdownItems (items) {
if (el.title && el.links) {
const items = el.links.map((subel) => {
- return <Item onClick={subel.onClick} icon={subel.icon} url={subel.url}>{subel.title}</Item>;
+ return <Item key={subel.title} onClick={subel.onClick} icon={subel.icon} url={subel.url}>{subel.title}</Item>;
});
return ([
- <li className="header-label">{el.title}</li>,
+ <li key={el.title} className="header-label">{el.title}</li>,
items
]);
}
diff --git a/app/addons/documents/designdocinfo/stores.js b/app/addons/documents/designdocinfo/stores.js
index 4024229..1202e95 100644
--- a/app/addons/documents/designdocinfo/stores.js
+++ b/app/addons/documents/designdocinfo/stores.js
@@ -56,19 +56,19 @@ Stores.DesignDocInfoStore = FauxtonAPI.Store.extend({
case ActionTypes.DESIGN_FETCHING:
this._isLoading = true;
this.triggerChange();
- break;
+ break;
case ActionTypes.DESIGN_DOC_MONITOR:
this.monitorDesignDoc(action.options);
this.triggerChange();
- break;
+ break;
case ActionTypes.DESIGN_DOC_REFRESH:
this.triggerChange();
- break;
+ break;
default:
- return;
+ return;
// do nothing
}
}
diff --git a/app/addons/documents/doc-editor/__tests__/doc-editor.components.test.js b/app/addons/documents/doc-editor/__tests__/doc-editor.components.test.js
index bc72537..178eb47 100644
--- a/app/addons/documents/doc-editor/__tests__/doc-editor.components.test.js
+++ b/app/addons/documents/doc-editor/__tests__/doc-editor.components.test.js
@@ -202,7 +202,7 @@ describe("Custom Extension Buttons", () => {
render() {
return (
<div>
- <button>Oh no she di'n't!</button>
+ <button>Oh no she di'n't!</button>
<span id="testDatabaseName">{this.props.database.id}</span>
</div>
);
diff --git a/app/addons/documents/doc-editor/components.js b/app/addons/documents/doc-editor/components.js
index 7c9afbc..8f98824 100644
--- a/app/addons/documents/doc-editor/components.js
+++ b/app/addons/documents/doc-editor/components.js
@@ -60,7 +60,7 @@ class DocEditorController extends React.Component {
return (
<GeneralComponents.CodeEditor
id="doc-editor"
- ref="docEditor"
+ ref={node => this.docEditor = node}
defaultCode={code}
mode="json"
autoFocus={true}
@@ -110,7 +110,7 @@ class DocEditorController extends React.Component {
};
getEditor = () => {
- return (this.refs.docEditor) ? this.refs.docEditor.getEditor() : null;
+ return (this.docEditor) ? this.docEditor.getEditor() : null;
};
checkDocIsValid = () => {
@@ -124,7 +124,7 @@ class DocEditorController extends React.Component {
};
clearChanges = () => {
- this.refs.docEditor.clearChanges();
+ this.docEditor.clearChanges();
};
getExtensionIcons = () => {
@@ -184,7 +184,7 @@ class DocEditorController extends React.Component {
</div>
<UploadModal
- ref="uploadModal"
+ ref={node => this.uploadModal = node}
visible={this.state.uploadModalVisible}
doc={this.state.doc} />
<CloneDocModal
@@ -346,7 +346,7 @@ class UploadModal extends React.Component {
<Modal.Body>
<div className={errorClasses}>{this.state.errorMessage}</div>
<div>
- <form ref="uploadForm" className="form">
+ <form ref={node => this.uploadForm = node} className="form">
<p>
Select a file to upload as an attachment to this document. Uploading a file saves the document as a new
revision.
@@ -430,7 +430,7 @@ class CloneDocModal extends React.Component {
<p>
You can modify the following generated ID for your new document.
</p>
- <input ref="newDocId" type="text" autoFocus={true} className="input-block-level"
+ <input ref={node => this.newDocId = node} type="text" autoFocus={true} className="input-block-level"
onChange={this.docIDChange} value={this.state.uuid} />
</form>
</Modal.Body>
diff --git a/app/addons/documents/doc-editor/stores.js b/app/addons/documents/doc-editor/stores.js
index a553de3..d0c6e70 100644
--- a/app/addons/documents/doc-editor/stores.js
+++ b/app/addons/documents/doc-editor/stores.js
@@ -128,71 +128,71 @@ Stores.DocEditorStore = FauxtonAPI.Store.extend({
switch (action.type) {
case ActionTypes.RESET_DOC:
this.reset();
- break;
+ break;
case ActionTypes.DOC_LOADED:
this.docLoaded(action.options);
this.triggerChange();
- break;
+ break;
case ActionTypes.SHOW_CLONE_DOC_MODAL:
this.showCloneDocModal();
this.triggerChange();
- break;
+ break;
case ActionTypes.HIDE_CLONE_DOC_MODAL:
this.hideCloneDocModal();
this.triggerChange();
- break;
+ break;
case ActionTypes.SHOW_DELETE_DOC_CONFIRMATION_MODAL:
this.showDeleteDocModal();
this.triggerChange();
- break;
+ break;
case ActionTypes.HIDE_DELETE_DOC_CONFIRMATION_MODAL:
this.hideDeleteDocModal();
this.triggerChange();
- break;
+ break;
case ActionTypes.SHOW_UPLOAD_MODAL:
this.showUploadModal();
this.triggerChange();
- break;
+ break;
case ActionTypes.HIDE_UPLOAD_MODAL:
this.hideUploadModal();
this.triggerChange();
- break;
+ break;
case ActionTypes.FILE_UPLOAD_SUCCESS:
this._numFilesUploaded++;
this.triggerChange();
- break;
+ break;
case ActionTypes.FILE_UPLOAD_ERROR:
this.setFileUploadErrorMsg(action.options.error);
this.triggerChange();
- break;
+ break;
case ActionTypes.RESET_UPLOAD_MODAL:
this.resetUploadModal();
this.triggerChange();
- break;
+ break;
case ActionTypes.START_FILE_UPLOAD:
this.startFileUpload();
this.triggerChange();
- break;
+ break;
case ActionTypes.SET_FILE_UPLOAD_PERCENTAGE:
this._fileUploadLoadPercentage = action.options.percent;
this.triggerChange();
- break;
+ break;
default:
- return;
+ return;
// do nothing
}
}
diff --git a/app/addons/documents/header/header.js b/app/addons/documents/header/header.js
index 2a0382a..ba7c3b4 100644
--- a/app/addons/documents/header/header.js
+++ b/app/addons/documents/header/header.js
@@ -29,11 +29,11 @@ export default class BulkDocumentHeaderController extends React.Component {
let metadata, json, table;
if ((docType === Constants.INDEX_RESULTS_DOC_TYPE.VIEW)) {
metadata = <Button
- className={selectedLayout === Constants.LAYOUT_ORIENTATION.METADATA ? 'active' : ''}
- onClick={this.toggleLayout.bind(this, Constants.LAYOUT_ORIENTATION.METADATA)}
- >
+ className={selectedLayout === Constants.LAYOUT_ORIENTATION.METADATA ? 'active' : ''}
+ onClick={this.toggleLayout.bind(this, Constants.LAYOUT_ORIENTATION.METADATA)}
+ >
Metadata
- </Button>;
+ </Button>;
} else if ((docType === Constants.INDEX_RESULTS_DOC_TYPE.MANGO_INDEX)) {
return null;
}
@@ -43,18 +43,18 @@ export default class BulkDocumentHeaderController extends React.Component {
// query options panel.
if (!queryOptionsParams.reduce) {
table = <Button
- className={selectedLayout === Constants.LAYOUT_ORIENTATION.TABLE ? 'active' : ''}
- onClick={this.toggleLayout.bind(this, Constants.LAYOUT_ORIENTATION.TABLE)}
- >
- <i className="fonticon-table" /> Table
- </Button>;
+ className={selectedLayout === Constants.LAYOUT_ORIENTATION.TABLE ? 'active' : ''}
+ onClick={this.toggleLayout.bind(this, Constants.LAYOUT_ORIENTATION.TABLE)}
+ >
+ <i className="fonticon-table" /> Table
+ </Button>;
json = <Button
- className={selectedLayout === Constants.LAYOUT_ORIENTATION.JSON ? 'active' : ''}
- onClick={this.toggleLayout.bind(this, Constants.LAYOUT_ORIENTATION.JSON)}
- >
- <i className="fonticon-json" /> JSON
- </Button>;
+ className={selectedLayout === Constants.LAYOUT_ORIENTATION.JSON ? 'active' : ''}
+ onClick={this.toggleLayout.bind(this, Constants.LAYOUT_ORIENTATION.JSON)}
+ >
+ <i className="fonticon-json" /> JSON
+ </Button>;
}
return (
@@ -95,4 +95,4 @@ export default class BulkDocumentHeaderController extends React.Component {
return;
}
}
-};
+}
diff --git a/app/addons/documents/helpers.js b/app/addons/documents/helpers.js
index 0886927..3c2a2ac 100644
--- a/app/addons/documents/helpers.js
+++ b/app/addons/documents/helpers.js
@@ -102,9 +102,9 @@ const selectedViewContainsReduceFunction = (designDocs, selectedNavItem) => {
let showReduce = false;
// If a map/reduce view is selected, check if view contains reduce field
if (designDocs && isViewSelected(selectedNavItem)) {
- const ddocID = '_design/' + selectedNavItem.params.designDocName;
- const ddoc = designDocs.find(ddoc => ddoc._id === ddocID);
- showReduce = ddoc !== undefined && ddoc.views
+ const ddocID = '_design/' + selectedNavItem.params.designDocName;
+ const ddoc = designDocs.find(ddoc => ddoc._id === ddocID);
+ showReduce = ddoc !== undefined && ddoc.views
&& ddoc.views[selectedNavItem.params.indexName] !== undefined
&& ddoc.views[selectedNavItem.params.indexName].reduce !== undefined;
}
diff --git a/app/addons/documents/index-editor/__tests__/actions.test.js b/app/addons/documents/index-editor/__tests__/actions.test.js
index 080fe7b..6630058 100644
--- a/app/addons/documents/index-editor/__tests__/actions.test.js
+++ b/app/addons/documents/index-editor/__tests__/actions.test.js
@@ -37,14 +37,14 @@ describe('Index Editor Actions', function () {
_id: designDocId,
_rev: '1-231',
views: {
- 'test-view': {
- map: 'function () {};'
- },
- 'test-view2': {
- map: 'function () {};'
- }
+ 'test-view': {
+ map: 'function () {};'
+ },
+ 'test-view2': {
+ map: 'function () {};'
}
- }], {
+ }
+ }], {
params: { limit: 10 },
database: database
});
diff --git a/app/addons/documents/index-editor/components/DesignDocSelector.js b/app/addons/documents/index-editor/components/DesignDocSelector.js
index 0be5b10..fef9817 100644
--- a/app/addons/documents/index-editor/components/DesignDocSelector.js
+++ b/app/addons/documents/index-editor/components/DesignDocSelector.js
@@ -42,9 +42,9 @@ export default class DesignDocSelector extends Component {
return this.props.designDocList.map ((designDoc) => {
return (<option key={designDoc} value={designDoc}>{designDoc}</option>);
});
- } else {
- return [];
}
+ return [];
+
}
selectDesignDoc(e) {
diff --git a/app/addons/documents/index-editor/components/ReduceEditor.js b/app/addons/documents/index-editor/components/ReduceEditor.js
index 3158f1c..3b4a4c1 100644
--- a/app/addons/documents/index-editor/components/ReduceEditor.js
+++ b/app/addons/documents/index-editor/components/ReduceEditor.js
@@ -65,11 +65,11 @@ export default class ReduceEditor extends Component {
return this.state.reduce;
}
- return this.refs.reduceEditor.getValue();
+ return this.reduceEditor.getValue();
}
getEditor() {
- return this.refs.reduceEditor.getEditor();
+ return this.reduceEditor.getEditor();
}
updateReduceCode(code) {
@@ -86,7 +86,7 @@ export default class ReduceEditor extends Component {
if (this.state.hasCustomReduce) {
customReduceSection = <CodeEditorPanel
- ref='reduceEditor'
+ ref={node => this.reduceEditor = node}
id='reduce-function'
title={'Custom Reduce function'}
defaultCode={this.state.reduce}
@@ -115,7 +115,6 @@ export default class ReduceEditor extends Component {
selectId="reduce-function-selector"
selectValue={this.state.reduceSelectedOption} />
</div>
-
{customReduceSection}
</div>
);
diff --git a/app/addons/documents/index-editor/stores.js b/app/addons/documents/index-editor/stores.js
index fb68204..7cb3e76 100644
--- a/app/addons/documents/index-editor/stores.js
+++ b/app/addons/documents/index-editor/stores.js
@@ -204,53 +204,53 @@ Stores.IndexEditorStore = FauxtonAPI.Store.extend({
switch (action.type) {
case ActionTypes.CLEAR_INDEX:
this.reset();
- break;
+ break;
case ActionTypes.EDIT_INDEX:
this.editIndex(action.options);
- break;
+ break;
case ActionTypes.VIEW_NAME_CHANGE:
this.setViewName(action.name);
- break;
+ break;
case ActionTypes.EDIT_NEW_INDEX:
this.editIndex(action.options);
- break;
+ break;
case ActionTypes.SELECT_REDUCE_CHANGE:
this.updateReduceFromSelect(action.reduceSelectedOption);
- break;
+ break;
case ActionTypes.DESIGN_DOC_CHANGE:
this.setDesignDocId(action.options.value);
- break;
+ break;
case ActionTypes.VIEW_SAVED:
- break;
+ break;
case ActionTypes.VIEW_CREATED:
- break;
+ break;
case ActionTypes.VIEW_ADD_DESIGN_DOC:
this.addDesignDoc(action.designDoc);
this.setView();
- break;
+ break;
case ActionTypes.VIEW_UPDATE_MAP_CODE:
this.setMap(action.code);
- break;
+ break;
case ActionTypes.VIEW_UPDATE_REDUCE_CODE:
this.setReduce(action.code);
- break;
+ break;
case ActionTypes.DESIGN_DOC_NEW_NAME_UPDATED:
this._newDesignDocName = action.options.value;
- break;
+ break;
default:
- return;
+ return;
}
this.triggerChange();
diff --git a/app/addons/documents/index-results/actions/queryoptions.js b/app/addons/documents/index-results/actions/queryoptions.js
index efba5fa..60d21f7 100644
--- a/app/addons/documents/index-results/actions/queryoptions.js
+++ b/app/addons/documents/index-results/actions/queryoptions.js
@@ -43,13 +43,13 @@ export const queryOptionsToggleReduce = (previousReduce) => {
return updateQueryOptions({
reduce: !previousReduce
});
- } else {
- // Disables includeDocs if reduce is changing to true
- return updateQueryOptions({
- reduce: !previousReduce,
- includeDocs: false
- });
}
+ // Disables includeDocs if reduce is changing to true
+ return updateQueryOptions({
+ reduce: !previousReduce,
+ includeDocs: false
+ });
+
};
export const queryOptionsUpdateGroupLevel = (newGroupLevel) => {
@@ -112,8 +112,8 @@ export const queryOptionsFilterOnlyDdocs = () => {
return updateQueryOptions({
betweenKeys: {
include: false,
- startkey: '\"_design\"',
- endkey: '\"_design0\"'
+ startkey: '"_design"',
+ endkey: '"_design0"'
},
showBetweenKeys: true,
showByKeys: false
diff --git a/app/addons/documents/index-results/api.js b/app/addons/documents/index-results/api.js
index 23eb7b5..7065238 100644
--- a/app/addons/documents/index-results/api.js
+++ b/app/addons/documents/index-results/api.js
@@ -26,17 +26,16 @@ export const queryAllDocs = (fetchUrl, params) => {
headers: {
'Accept': 'application/json; charset=utf-8'
}
- })
- .then(res => res.json())
- .then(json => {
- if (json.error) {
- throw new Error('(' + json.error + ') ' + json.reason);
- }
- return {
- docs: json.rows,
- docType: Constants.INDEX_RESULTS_DOC_TYPE.VIEW
- };
- });
+ }).then(res => res.json())
+ .then(json => {
+ if (json.error) {
+ throw new Error('(' + json.error + ') ' + json.reason);
+ }
+ return {
+ docs: json.rows,
+ docType: Constants.INDEX_RESULTS_DOC_TYPE.VIEW
+ };
+ });
};
export const queryMapReduceView = (fetchUrl, params) => {
@@ -58,16 +57,16 @@ export const queryMapReduceView = (fetchUrl, params) => {
'Accept': 'application/json; charset=utf-8'
}
})
- .then(res => res.json())
- .then(json => {
- if (json.error) {
- throw new Error('(' + json.error + ') ' + json.reason);
- }
- return {
- docs: json.rows,
- docType: Constants.INDEX_RESULTS_DOC_TYPE.VIEW
- };
- });
+ .then(res => res.json())
+ .then(json => {
+ if (json.error) {
+ throw new Error('(' + json.error + ') ' + json.reason);
+ }
+ return {
+ docs: json.rows,
+ docType: Constants.INDEX_RESULTS_DOC_TYPE.VIEW
+ };
+ });
};
export const postToBulkDocs = (databaseName, payload) => {
@@ -81,7 +80,7 @@ export const postToBulkDocs = (databaseName, payload) => {
'Content-Type': 'application/json'
}
})
- .then(res => res.json());
+ .then(res => res.json());
};
export const postToIndexBulkDelete = (databaseName, payload) => {
@@ -95,5 +94,5 @@ export const postToIndexBulkDelete = (databaseName, payload) => {
'Content-Type': 'application/json'
}
})
- .then(res => res.json());
+ .then(res => res.json());
};
diff --git a/app/addons/documents/index-results/components/pagination/PaginationFooter.js b/app/addons/documents/index-results/components/pagination/PaginationFooter.js
index 9d00674..5f1c663 100644
--- a/app/addons/documents/index-results/components/pagination/PaginationFooter.js
+++ b/app/addons/documents/index-results/components/pagination/PaginationFooter.js
@@ -89,4 +89,4 @@ export default class PaginationFooter extends React.Component {
</footer>
);
}
-};
+}
diff --git a/app/addons/documents/index-results/components/queryoptions/AdditionalParams.js b/app/addons/documents/index-results/components/queryoptions/AdditionalParams.js
index f3be5f0..48f09b9 100644
--- a/app/addons/documents/index-results/components/queryoptions/AdditionalParams.js
+++ b/app/addons/documents/index-results/components/queryoptions/AdditionalParams.js
@@ -75,4 +75,4 @@ export default class AdditionalParams extends React.Component {
</div>
);
}
-};
+}
diff --git a/app/addons/documents/index-results/components/queryoptions/KeySearchFields.js b/app/addons/documents/index-results/components/queryoptions/KeySearchFields.js
index dddb63e..1fb2f90 100644
--- a/app/addons/documents/index-results/components/queryoptions/KeySearchFields.js
+++ b/app/addons/documents/index-results/components/queryoptions/KeySearchFields.js
@@ -28,8 +28,8 @@ export default class KeySearchFields extends React.Component {
updateBetweenKeys () {
this.props.updateBetweenKeys({
- startkey: ReactDOM.findDOMNode(this.refs.startkey).value,
- endkey: ReactDOM.findDOMNode(this.refs.endkey).value,
+ startkey: this.startkey.value,
+ endkey: this.endkey.value,
include: this.props.betweenKeys.include
});
}
@@ -91,13 +91,29 @@ export default class KeySearchFields extends React.Component {
<div className="controls controls-row">
<div>
<label htmlFor="startkey" className="drop-down">Start key</label>
- <input id="startkey" ref="startkey" type="text" onChange={this.updateBetweenKeys.bind(this)} value={this.props.betweenKeys.startkey} placeholder='e.g., "1234"' />
+ <input
+ id="startkey"
+ ref={node => this.startkey = node}
+ type="text"
+ onChange={this.updateBetweenKeys.bind(this)}
+ value={this.props.betweenKeys.startkey}
+ placeholder='e.g., "1234"' />
</div>
<div>
<label htmlFor="endkey" className="drop-down">End key</label>
- <input id="endkey" ref="endkey" onChange={this.updateBetweenKeys.bind(this)} value={this.props.betweenKeys.endkey} type="text" placeholder='e.g., "1234"'/>
+ <input
+ id="endkey"
+ ref={node => this.endkey = node}
+ onChange={this.updateBetweenKeys.bind(this)}
+ value={this.props.betweenKeys.endkey}
+ type="text"
+ placeholder='e.g., "1234"'/>
<div className="controls include-end-key-row checkbox controls-row inline">
- <input id="qoIncludeEndKeyInResults" ref="inclusive_end" type="checkbox" onChange={this.updateInclusiveEnd.bind(this)} checked={this.props.betweenKeys.include}/>
+ <input
+ id="qoIncludeEndKeyInResults"
+ type="checkbox"
+ onChange={this.updateInclusiveEnd.bind(this)}
+ checked={this.props.betweenKeys.include}/>
<label htmlFor="qoIncludeEndKeyInResults">Include End Key in results</label>
</div>
</div>
@@ -108,4 +124,4 @@ export default class KeySearchFields extends React.Component {
</div>
);
}
-};
+}
diff --git a/app/addons/documents/index-results/components/queryoptions/MainFieldsView.js b/app/addons/documents/index-results/components/queryoptions/MainFieldsView.js
index 104605b..7b3fedf 100644
--- a/app/addons/documents/index-results/components/queryoptions/MainFieldsView.js
+++ b/app/addons/documents/index-results/components/queryoptions/MainFieldsView.js
@@ -86,7 +86,7 @@ export default class MainFieldsView extends React.Component {
<div className="row-fluid fieldsets">
<div className="checkbox inline">
<input disabled={this.props.reduce} onChange={this.toggleIncludeDocs.bind(this)} id="qoIncludeDocs"
- name="include_docs" type="checkbox" checked={includeDocs} />
+ name="include_docs" type="checkbox" checked={includeDocs} />
<label className={this.props.reduce ? 'disabled' : ''} htmlFor="qoIncludeDocs" id="qoIncludeDocsLabel">Include Docs</label>
</div>
{this.reduce()}
diff --git a/app/addons/documents/index-results/components/queryoptions/QueryOptions.js b/app/addons/documents/index-results/components/queryoptions/QueryOptions.js
index 7fe7f10..0727cd9 100644
--- a/app/addons/documents/index-results/components/queryoptions/QueryOptions.js
+++ b/app/addons/documents/index-results/components/queryoptions/QueryOptions.js
@@ -155,7 +155,7 @@ export default class QueryOptions extends React.Component {
fonticon="fonticon-gears"
text="Options"
active={this.showAsActive()} />
- {this.getTray()}
+ {this.getTray()}
</div>
</div>
</div>
diff --git a/app/addons/documents/index-results/components/results/ResultsScreen.js b/app/addons/documents/index-results/components/results/ResultsScreen.js
index 4cdb0f6..ff48be5 100644
--- a/app/addons/documents/index-results/components/results/ResultsScreen.js
+++ b/app/addons/documents/index-results/components/results/ResultsScreen.js
@@ -55,20 +55,20 @@ export default class ResultsScreen extends React.Component {
let data = this.props.results.results;
return _.map(data, function (doc, i) {
return (
- <Document
- key={doc.id + i}
- doc={doc}
- onClick={this.props.isEditable ? this.onClick : noop}
- keylabel={doc.keylabel}
- docContent={doc.content}
- checked={this.props.isSelected(doc.id)}
- header={doc.header}
- docChecked={this.props.docChecked}
- isDeletable={doc.isDeletable}
- docIdentifier={doc.id} >
- {doc.url ? this.getUrlFragment('#' + doc.url) : doc.url}
- </Document>
- );
+ <Document
+ key={doc.id + i}
+ doc={doc}
+ onClick={this.props.isEditable ? this.onClick : noop}
+ keylabel={doc.keylabel}
+ docContent={doc.content}
+ checked={this.props.isSelected(doc.id)}
+ header={doc.header}
+ docChecked={this.props.docChecked}
+ isDeletable={doc.isDeletable}
+ docIdentifier={doc.id} >
+ {doc.url ? this.getUrlFragment('#' + doc.url) : doc.url}
+ </Document>
+ );
}, this);
}
@@ -130,4 +130,4 @@ export default class ResultsScreen extends React.Component {
);
}
-};
+}
diff --git a/app/addons/documents/index-results/components/results/TableRow.js b/app/addons/documents/index-results/components/results/TableRow.js
index c9da4ac..5fe2daf 100644
--- a/app/addons/documents/index-results/components/results/TableRow.js
+++ b/app/addons/documents/index-results/components/results/TableRow.js
@@ -63,11 +63,11 @@ export default class TableRow extends React.Component {
}
getAdditionalInfoRow (el) {
- const attachmentCount = Object.keys(el._attachments ||Â {}).length;
+ const attachmentCount = Object.keys(el._attachments || {}).length;
let attachmentIndicator = null;
let textAttachments = null;
- const conflictCount = Object.keys(el._conflicts ||Â {}).length;
+ const conflictCount = Object.keys(el._conflicts || {}).length;
let conflictIndicator = null;
let textConflicts = null;
diff --git a/app/addons/documents/index-results/components/results/TableView.js b/app/addons/documents/index-results/components/results/TableView.js
index 580f2a0..550a088 100644
--- a/app/addons/documents/index-results/components/results/TableView.js
+++ b/app/addons/documents/index-results/components/results/TableView.js
@@ -101,4 +101,4 @@ export default class TableView extends React.Component {
</div>
);
}
-};
+}
diff --git a/app/addons/documents/index-results/components/results/WrappedAutocomplete.js b/app/addons/documents/index-results/components/results/WrappedAutocomplete.js
index 5b1c52a..17c9814 100644
--- a/app/addons/documents/index-results/components/results/WrappedAutocomplete.js
+++ b/app/addons/documents/index-results/components/results/WrappedAutocomplete.js
@@ -38,4 +38,4 @@ export default function WrappedAutocomplete ({
</div>
</div>
);
-};
+}
diff --git a/app/addons/documents/index-results/containers/IndexResultsContainer.js b/app/addons/documents/index-results/containers/IndexResultsContainer.js
index 91dcbc8..4ba8da8 100644
--- a/app/addons/documents/index-results/containers/IndexResultsContainer.js
+++ b/app/addons/documents/index-results/containers/IndexResultsContainer.js
@@ -69,12 +69,12 @@ const mapDispatchToProps = (dispatch, ownProps) => {
},
bulkDeleteDocs: (docs, fetchParams, queryOptionsParams) => {
dispatch(bulkDeleteDocs(ownProps.databaseName,
- ownProps.queryDocs,
- docs,
- ownProps.designDocs,
- fetchParams,
- queryOptionsParams,
- ownProps.docType));
+ ownProps.queryDocs,
+ docs,
+ ownProps.designDocs,
+ fetchParams,
+ queryOptionsParams,
+ ownProps.docType));
},
changeLayout: (newLayout) => {
dispatch(changeLayout(newLayout));
diff --git a/app/addons/documents/index-results/helpers/table-view.js b/app/addons/documents/index-results/helpers/table-view.js
index b5c72c4..bb735ce 100644
--- a/app/addons/documents/index-results/helpers/table-view.js
+++ b/app/addons/documents/index-results/helpers/table-view.js
@@ -12,13 +12,13 @@
import Constants from "../../constants";
import {
- isJSONDocBulkDeletable,
- isJSONDocEditable,
- hasBulkDeletableDoc,
- getDocUrl,
- getDocId,
- getDocRev
- } from "./shared-helpers";
+ isJSONDocBulkDeletable,
+ isJSONDocEditable,
+ hasBulkDeletableDoc,
+ getDocUrl,
+ getDocId,
+ getDocRev
+} from "./shared-helpers";
export const getPseudoSchema = (docs) => {
let cache = [];
diff --git a/app/addons/documents/index-results/reducers.js b/app/addons/documents/index-results/reducers.js
index cfa73d5..426a7da 100644
--- a/app/addons/documents/index-results/reducers.js
+++ b/app/addons/documents/index-results/reducers.js
@@ -173,7 +173,7 @@ export default function resultsState(state = initialState, action) {
default:
return state;
}
-};
+}
// we don't want to muddy the waters with autogenerated mango docs
export const removeGeneratedMangoDocs = (doc) => {
@@ -196,9 +196,9 @@ export const getDataForRendering = (state, databaseName, deleteEnabled = true) =
if (Constants.LAYOUT_ORIENTATION.JSON === options.selectedLayout) {
return getJsonViewData(docsWithoutGeneratedMangoDocs, options);
- } else {
- return getTableViewData(docsWithoutGeneratedMangoDocs, options);
}
+ return getTableViewData(docsWithoutGeneratedMangoDocs, options);
+
};
// Should we show the input checkbox where the user can elect to display
diff --git a/app/addons/documents/mango/components/ExecutionStats.js b/app/addons/documents/mango/components/ExecutionStats.js
index 3b070d7..01f5d27 100644
--- a/app/addons/documents/mango/components/ExecutionStats.js
+++ b/app/addons/documents/mango/components/ExecutionStats.js
@@ -49,7 +49,7 @@ export default class ExecutionStats extends React.Component {
}
warningPopupComponent(warningText) {
- if (!!warningText) {
+ if (warningText) {
return (<div className="warning">
<i className="fonticon-attention-circled"></i> {warningText}
</div>);
@@ -95,7 +95,7 @@ export default class ExecutionStats extends React.Component {
const warningText = this.getWarning(executionStats, warning);
let warningComponent = null;
- if (!!warningText) {
+ if (warningText) {
warningComponent = <i className="fonticon-attention-circled"></i>;
}
@@ -104,7 +104,7 @@ export default class ExecutionStats extends React.Component {
executionStatsComponent = (
<span className="execution-stats-component">Executed in {this.humanizeDuration(executionStats.execution_time_ms)}</span>
);
- } else if (!!warningText) {
+ } else if (warningText) {
executionStatsComponent = (
<span className="execution-stats-component">Warning</span>
);
@@ -112,15 +112,15 @@ export default class ExecutionStats extends React.Component {
const popup = this.popup(executionStats, warningText);
return (
- <OverlayTrigger trigger={['hover', 'focus', 'click']} placement="right" overlay={popup}>
- <span className="execution-stats">
- {warningComponent}
- {executionStatsComponent}
- </span>
- </OverlayTrigger>
+ <OverlayTrigger trigger={['hover', 'focus', 'click']} placement="right" overlay={popup}>
+ <span className="execution-stats">
+ {warningComponent}
+ {executionStatsComponent}
+ </span>
+ </OverlayTrigger>
);
}
-};
+}
ExecutionStats.propTypes = {
executionStats: PropTypes.object,
diff --git a/app/addons/documents/mango/components/ExplainPage.js b/app/addons/documents/mango/components/ExplainPage.js
index db7eef3..cf44918 100644
--- a/app/addons/documents/mango/components/ExplainPage.js
+++ b/app/addons/documents/mango/components/ExplainPage.js
@@ -17,11 +17,11 @@ import React, { Component } from "react";
export default class ExplainPage extends Component {
componentDidMount () {
prettyPrint();
- };
+ }
componentDidUpdate () {
prettyPrint();
- };
+ }
render () {
return (
@@ -29,7 +29,7 @@ export default class ExplainPage extends Component {
<pre className="prettyprint">{JSON.stringify(this.props.explainPlan, null, ' ')}</pre>
</div>
);
- };
+ }
}
ExplainPage.propTypes = {
diff --git a/app/addons/documents/mango/components/MangoIndexEditor.js b/app/addons/documents/mango/components/MangoIndexEditor.js
index 6e98af7..739a651 100644
--- a/app/addons/documents/mango/components/MangoIndexEditor.js
+++ b/app/addons/documents/mango/components/MangoIndexEditor.js
@@ -48,15 +48,15 @@ export default class MangoIndexEditor extends Component {
}
setEditorValue(newValue = '') {
- return this.refs.codeEditor.getEditor().setValue(newValue);
+ return this.codeEditor.getEditor().setValue(newValue);
}
getEditorValue() {
- return this.refs.codeEditor.getValue();
+ return this.codeEditor.getValue();
}
editorHasErrors() {
- return this.refs.codeEditor.getEditor().hasErrors();
+ return this.codeEditor.getEditor().hasErrors();
}
onTemplateSelected(selectedItem) {
@@ -72,7 +72,7 @@ export default class MangoIndexEditor extends Component {
<ReactSelect
className="mango-select"
options={this.props.templates}
- ref="templates"
+ ref={node => this.templates = node}
placeholder="Examples"
searchable={false}
clearable={false}
@@ -83,7 +83,7 @@ export default class MangoIndexEditor extends Component {
<PaddedBorderedBox>
<CodeEditorPanel
id="query-field"
- ref="codeEditor"
+ ref={node => this.codeEditor = node}
title="Index"
docLink={getDocUrl('MANGO_INDEX')}
defaultCode={this.props.queryIndexCode} />
diff --git a/app/addons/documents/mango/components/MangoQueryEditor.js b/app/addons/documents/mango/components/MangoQueryEditor.js
index 88e9a2f..f04a158 100644
--- a/app/addons/documents/mango/components/MangoQueryEditor.js
+++ b/app/addons/documents/mango/components/MangoQueryEditor.js
@@ -46,15 +46,15 @@ export default class MangoQueryEditor extends Component {
}
setEditorValue (newValue = '') {
- return this.refs.codeEditor.getEditor().setValue(newValue);
+ return this.codeEditor.getEditor().setValue(newValue);
}
getEditorValue () {
- return this.refs.codeEditor.getValue();
+ return this.codeEditor.getValue();
}
editorHasErrors () {
- return this.refs.codeEditor.getEditor().hasErrors();
+ return this.codeEditor.getEditor().hasErrors();
}
onHistorySelected(selectedItem) {
@@ -69,7 +69,7 @@ export default class MangoQueryEditor extends Component {
<ReactSelect
className="mango-select"
options={this.props.history}
- ref="history"
+ ref={node => this.history = node}
placeholder="Query history"
searchable={false}
clearable={false}
@@ -80,7 +80,7 @@ export default class MangoQueryEditor extends Component {
<PaddedBorderedBox>
<CodeEditorPanel
id="query-field"
- ref="codeEditor"
+ ref={node => this.codeEditor = node}
title={this.props.editorTitle}
docLink={getDocUrl('MANGO_SEARCH')}
defaultCode={this.props.queryFindCode} />
diff --git a/app/addons/documents/mango/components/MangoQueryEditorContainer.js b/app/addons/documents/mango/components/MangoQueryEditorContainer.js
index 6df41bd..7bbb310 100644
--- a/app/addons/documents/mango/components/MangoQueryEditorContainer.js
+++ b/app/addons/documents/mango/components/MangoQueryEditorContainer.js
@@ -24,7 +24,7 @@ const getAvailableQueryIndexes = ({ availableIndexes }) => {
return [];
}
return availableIndexes.filter(({ type }) => {
- return ['json', 'special'].includes(type);
+ return ['json', 'special'].includes(type);
});
};
diff --git a/app/addons/documents/mango/mango.actions.js b/app/addons/documents/mango/mango.actions.js
index 58de757..e0e6c8c 100644
--- a/app/addons/documents/mango/mango.actions.js
+++ b/app/addons/documents/mango/mango.actions.js
@@ -92,12 +92,12 @@ export default {
});
})
.catch((error) => {
- FauxtonAPI.addNotification({
- msg: 'Failed to create index. ' + this.errorReason(error),
- type: 'error',
- clear: true
- });
+ FauxtonAPI.addNotification({
+ msg: 'Failed to create index. ' + this.errorReason(error),
+ type: 'error',
+ clear: true
});
+ });
};
},
diff --git a/app/addons/documents/mango/mango.api.js b/app/addons/documents/mango/mango.api.js
index 2ae90ca..1d0b452 100644
--- a/app/addons/documents/mango/mango.api.js
+++ b/app/addons/documents/mango/mango.api.js
@@ -92,13 +92,13 @@ const supportsExecutionStats = (databaseName) => {
mangoQuery(databaseName, {
selector: {
"_id": {"$gt": "a" }
- },
+ },
execution_stats: true
}, {limit: 1})
- .then(resp => {
- supportsExecutionStatsCache = resp.status == 200;
- resolve(supportsExecutionStatsCache);
- });
+ .then(resp => {
+ supportsExecutionStatsCache = resp.status == 200;
+ resolve(supportsExecutionStatsCache);
+ });
});
}
return Promise.resolve(supportsExecutionStatsCache);
diff --git a/app/addons/documents/mango/mango.constants.js b/app/addons/documents/mango/mango.constants.js
index aee1c19..b212092 100644
--- a/app/addons/documents/mango/mango.constants.js
+++ b/app/addons/documents/mango/mango.constants.js
@@ -2,12 +2,12 @@ export default {
INDEX_TEMPLATES: [{
label: 'Single field (json)',
code: {
- "index": {
- "fields": ["foo"]
- },
- "name": "foo-json-index",
- "type" : "json"
- }
+ "index": {
+ "fields": ["foo"]
+ },
+ "name": "foo-json-index",
+ "type" : "json"
+ }
}, {
label: 'Multiple fields (json)',
code: {
diff --git a/app/addons/documents/mango/mango.reducers.js b/app/addons/documents/mango/mango.reducers.js
index 06fd8be..8e4cd80 100644
--- a/app/addons/documents/mango/mango.reducers.js
+++ b/app/addons/documents/mango/mango.reducers.js
@@ -202,4 +202,4 @@ export default function mangoquery(state = initialState, action) {
default:
return state;
}
-};
+}
diff --git a/app/addons/documents/mangolayout.js b/app/addons/documents/mangolayout.js
index ef9d917..a873f8e 100644
--- a/app/addons/documents/mangolayout.js
+++ b/app/addons/documents/mangolayout.js
@@ -80,18 +80,18 @@ export const MangoContent = ({ edit, designDocs, explainPlan, databaseName, fetc
/>;
let resultsPage = <IndexResultsContainer
- fetchUrl={fetchUrl}
- designDocs={designDocs}
- ddocsOnly={false}
- databaseName={databaseName}
- fetchAtStartup={false}
- queryDocs={queryDocs}
- docType={docType} />;
+ fetchUrl={fetchUrl}
+ designDocs={designDocs}
+ ddocsOnly={false}
+ databaseName={databaseName}
+ fetchAtStartup={false}
+ queryDocs={queryDocs}
+ docType={docType} />;
let mangoFooter = <MangoFooter
- databaseName={databaseName}
- fetchUrl={fetchUrl}
- queryDocs={queryDocs} />;
+ databaseName={databaseName}
+ fetchUrl={fetchUrl}
+ queryDocs={queryDocs} />;
if (explainPlan) {
resultsPage = <MangoComponents.ExplainPage explainPlan={explainPlan} />;
@@ -116,7 +116,7 @@ export const MangoContent = ({ edit, designDocs, explainPlan, databaseName, fetc
class MangoLayout extends Component {
constructor(props) {
super(props);
- };
+ }
render() {
const { database, edit, docURL, crumbs, designDocs, fetchUrl, databaseName, queryFindCode } = this.props;
@@ -146,11 +146,11 @@ class MangoLayout extends Component {
fetchUrl={fetchUrl}
queryDocs={queryFunction}
docType={docType}
- />
+ />
</div>
);
}
-};
+}
const mapStateToProps = ({ mangoQuery }) => {
return {
diff --git a/app/addons/documents/resources.js b/app/addons/documents/resources.js
index 15a394a..5ae57a2 100644
--- a/app/addons/documents/resources.js
+++ b/app/addons/documents/resources.js
@@ -107,7 +107,7 @@ Documents.BulkDeleteDocCollection = FauxtonAPI.Collection.extend({
model: Documents.BulkDeleteDoc,
- sync: function ()Â {
+ sync: function () {
},
@@ -130,11 +130,9 @@ Documents.BulkDeleteDocCollection = FauxtonAPI.Collection.extend({
contentType: 'application/json',
dataType: 'json',
data: JSON.stringify(payload),
- })
- .then(function (res) {
+ }).then(function (res) {
that.handleResponse(res, promise);
- })
- .fail(function () {
+ }).fail(function () {
var ids = _.reduce(that.toArray(), function (acc, doc) {
acc.push(doc.id);
return acc;
diff --git a/app/addons/documents/rev-browser/actions.js b/app/addons/documents/rev-browser/actions.js
index ec080bc..7e9fcee 100644
--- a/app/addons/documents/rev-browser/actions.js
+++ b/app/addons/documents/rev-browser/actions.js
@@ -28,19 +28,19 @@ export const initDiffEditor = (dbName, docId) => dispatch => {
// XXX: we need spec compliant promise support and get rid of jQ "deferreds"
Promise.all([db.get(docId), getTree(db, docId)])
- .then(([doc, tree]) => {
- const conflictingRevs = getConflictingRevs(tree.paths, tree.winner, Object.keys(tree.deleted));
- const initialRev = conflictingRevs[0];
-
- if (!initialRev) {
- return dispatch(treeLoaded(tree, doc, conflictingRevs, null, dbName));
- }
-
- db.get(doc._id, {rev: initialRev})
- .then((conflictDoc) => {
- dispatch(treeLoaded(tree, doc, conflictingRevs, conflictDoc, dbName));
- });
- });
+ .then(([doc, tree]) => {
+ const conflictingRevs = getConflictingRevs(tree.paths, tree.winner, Object.keys(tree.deleted));
+ const initialRev = conflictingRevs[0];
+
+ if (!initialRev) {
+ return dispatch(treeLoaded(tree, doc, conflictingRevs, null, dbName));
+ }
+
+ db.get(doc._id, {rev: initialRev})
+ .then((conflictDoc) => {
+ dispatch(treeLoaded(tree, doc, conflictingRevs, conflictDoc, dbName));
+ });
+ });
};
function getConflictingRevs (paths, winner, deleted) {
@@ -52,9 +52,9 @@ function getConflictingRevs (paths, winner, deleted) {
return acc;
}, [])
- .filter((el) => {
- return deleted.indexOf(el) === -1;
- });
+ .filter((el) => {
+ return deleted.indexOf(el) === -1;
+ });
}
const treeLoaded = (tree, doc, conflictingRevs, conflictDoc, databaseName) => {
@@ -111,22 +111,22 @@ export const selectRevAsWinner = (databaseName, docId, paths, revToWin) => dispa
const payload = buildBulkDeletePayload(docId, revsToDelete);
post(FauxtonAPI.urls('bulk_docs', 'server', databaseName, ''), payload)
- .then((resp) => {
- if (resp.error) {
- return FauxtonAPI.addNotification({
- msg: 'Failed to delete clean up conflicts!',
- type: 'error',
+ .then((resp) => {
+ if (resp.error) {
+ return FauxtonAPI.addNotification({
+ msg: 'Failed to delete clean up conflicts!',
+ type: 'error',
+ clear: true
+ });
+ }
+
+ FauxtonAPI.addNotification({
+ msg: 'Conflicts successfully solved.',
clear: true
});
- }
-
- FauxtonAPI.addNotification({
- msg: 'Conflicts successfully solved.',
- clear: true
+ dispatch(toggleConfirmModal(false, null));
+ FauxtonAPI.navigate(FauxtonAPI.urls('allDocs', 'app', databaseName, ''));
});
- dispatch(toggleConfirmModal(false, null));
- FauxtonAPI.navigate(FauxtonAPI.urls('allDocs', 'app', databaseName, ''));
- });
};
function buildBulkDeletePayload (docId, revs) {
diff --git a/app/addons/documents/rev-browser/components/confirmmodal.js b/app/addons/documents/rev-browser/components/confirmmodal.js
index 77fc8a7..16e6796 100644
--- a/app/addons/documents/rev-browser/components/confirmmodal.js
+++ b/app/addons/documents/rev-browser/components/confirmmodal.js
@@ -48,7 +48,7 @@ export default class ConfirmModal extends React.Component {
</Modal.Header>
<Modal.Body>
<p>
- <i className="icon-warning-sign"></i> Do you want to delete all conflicting revisions for this document?
+ <i className="icon-warning-sign"></i> Do you want to delete all conflicting revisions for this document?
</p>
diff --git a/app/addons/documents/rev-browser/components/splitscreenarea.js b/app/addons/documents/rev-browser/components/splitscreenarea.js
index 49aa300..b848d66 100644
--- a/app/addons/documents/rev-browser/components/splitscreenarea.js
+++ b/app/addons/documents/rev-browser/components/splitscreenarea.js
@@ -41,8 +41,8 @@ export default class SplitScreenArea extends React.Component {
const format = (input) => { return JSON.stringify(input, null, ' '); };
const jsmode = new JavaScriptMode();
- const left = ReactDOM.findDOMNode(this.refs.revLeftOurs);
- const right = ReactDOM.findDOMNode(this.refs.revRightTheirs);
+ const left = this.revLeftOurs;
+ const right = this.revRightTheirs;
const leftRes = highlight.render(format(this.props.ours), jsmode, theme, 0, true);
left.innerHTML = leftRes.html;
@@ -61,12 +61,12 @@ export default class SplitScreenArea extends React.Component {
<div className="revision-split-area">
<div data-id="ours" style={{width: '50%'}}>
<div style={{marginBottom: '20px'}}>{ours._rev} (Server-Selected Rev)</div>
- <pre ref="revLeftOurs"></pre>
+ <pre ref={node => this.revLeftOurs = node}></pre>
</div>
<div data-id="theirs" style={{width: '50%'}}>
<div style={{marginBottom: '20px'}}>{theirs._rev}</div>
- <pre ref="revRightTheirs"></pre>
+ <pre ref={node => this.revRightTheirs = node}></pre>
</div>
</div>
);
diff --git a/app/addons/documents/rev-browser/container.js b/app/addons/documents/rev-browser/container.js
index 345b05d..d0ea5c6 100644
--- a/app/addons/documents/rev-browser/container.js
+++ b/app/addons/documents/rev-browser/container.js
@@ -37,7 +37,6 @@ import {
const mapStateToProps = ({revisionBrowser}, ownProps) => {
return {
- databaseName: ownProps.databaseName,
docId: ownProps.docId,
tree: getTree(revisionBrowser),
doc: getDoc(revisionBrowser),
diff --git a/app/addons/documents/rev-browser/rev-browser.components.js b/app/addons/documents/rev-browser/rev-browser.components.js
new file mode 100644
index 0000000..4ae29e0
--- /dev/null
+++ b/app/addons/documents/rev-browser/rev-browser.components.js
@@ -0,0 +1,429 @@
+import app from "../../../app";
+
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy of
+// the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations under
+// the License.
+
+import PropTypes from 'prop-types';
+
+import React from "react";
+import ReactDOM from "react-dom";
+import RevActions from "./rev-browser.actions";
+import RevStores from "./rev-browser.stores";
+import ReactComponents from "../../components/react-components";
+import { ButtonGroup, Button, Modal } from "react-bootstrap";
+import ReactSelect from "react-select";
+import jdp from "jsondiffpatch";
+import jdpformatters from "jsondiffpatch/src/formatters/html";
+import ace from "brace";
+import "jsondiffpatch/public/formatters-styles/html.css";
+
+const storageKeyDeleteConflictsModal = 'deleteConflictsHideModal';
+
+const store = RevStores.revBrowserStore;
+const ConfirmButton = ReactComponents.ConfirmButton;
+
+require('brace/ext/static_highlight');
+const highlight = ace.acequire('ace/ext/static_highlight');
+
+require('brace/mode/json');
+const JavaScriptMode = ace.acequire('ace/mode/json').Mode;
+
+require('brace/theme/idle_fingers');
+const theme = ace.acequire('ace/theme/idle_fingers');
+
+
+class DiffyController extends React.Component {
+
+ constructor (props) {
+ super(props);
+
+ this.state = this.getStoreState();
+ }
+
+ getStoreState () {
+
+ return {
+ tree: store.getRevTree(),
+ ours: store.getOurs(),
+ theirs: store.getTheirs(),
+ conflictingRevs: store.getConflictingRevs(),
+ dropdownData: store.getDropdownData(),
+ isDiffViewEnabled: store.getIsDiffViewEnabled(),
+ databaseName: store.getDatabaseName()
+ };
+ }
+
+ componentDidMount () {
+ store.on('change', this.onChange, this);
+ }
+
+ componentWillUnmount () {
+ store.off('change', this.onChange);
+ }
+
+ onChange () {
+ this.setState(this.getStoreState());
+ }
+
+ toggleDiffView (enableDiff) {
+ RevActions.toggleDiffView(enableDiff);
+ }
+
+ render () {
+ const {tree, ours, theirs, conflictingRevs, isDiffViewEnabled} = this.state;
+
+ if (!tree) {
+ return null;
+ }
+
+ // no conflicts happened for this doc
+ if (!theirs || !conflictingRevs.length) {
+ return <div style={{textAlign: 'center', color: '#fff'}}><h2>No conflicts</h2></div>;
+ }
+
+ return (
+ <div className="revision-wrapper scrollable">
+ <RevisionBrowserControls {...this.state} />
+ <div className="revision-view-controls">
+ <ButtonGroup className="two-sides-toggle-button">
+ <Button
+ style={{width: '120px'}}
+ className={isDiffViewEnabled ? 'active' : ''}
+ onClick={this.toggleDiffView.bind(this, true)}
+ >
+ <i className="icon-columns" /> Diff
+ </Button>
+ <Button
+ style={{width: '120px'}}
+ className={isDiffViewEnabled ? '' : 'active'}
+ onClick={this.toggleDiffView.bind(this, false)}
+ >
+ <i className="icon-file-text" /> Document
+ </Button>
+ </ButtonGroup>
+ </div>
+
+ {isDiffViewEnabled ?
+ <RevisionDiffArea ours={ours} theirs={theirs} /> :
+ <SplitScreenArea ours={ours} theirs={theirs} /> }
+ </div>
+ );
+ }
+}
+
+
+class SplitScreenArea extends React.Component {
+
+ constructor (props) {
+ super(props);
+ }
+
+ componentDidUpdate () {
+ this.hightlightAfterRender();
+ }
+
+ componentDidMount () {
+ this.hightlightAfterRender();
+ }
+
+ hightlightAfterRender () {
+ const format = (input) => { return JSON.stringify(input, null, ' '); };
+
+ const jsmode = new JavaScriptMode();
+ const left = this.revLeftOurs;
+ const right = this.revRightTheirs;
+
+ const leftRes = highlight.render(format(this.props.ours), jsmode, theme, 0, true);
+ left.innerHTML = leftRes.html;
+ const rightRes = highlight.render(format(this.props.theirs), jsmode, theme, 0, true);
+ right.innerHTML = rightRes.html;
+ }
+
+ render () {
+ const {ours, theirs} = this.props;
+
+ if (!ours || !theirs) {
+ return <div></div>;
+ }
+
+ return (
+ <div className="revision-split-area">
+ <div data-id="ours" style={{width: '50%'}}>
+ <div style={{marginBottom: '20px'}}>{ours._rev} (Server-Selected Rev)</div>
+ <pre ref={node => this.revLeftOurs = node}></pre>
+ </div>
+
+ <div data-id="theirs" style={{width: '50%'}}>
+ <div style={{marginBottom: '20px'}}>{theirs._rev}</div>
+ <pre ref={node => this.revRightTheirs = node}></pre>
+ </div>
+ </div>
+ );
+ }
+}
+
+const RevisionDiffArea = ({ours, theirs}) => {
+ if (!ours || !theirs) {
+ return <div></div>;
+ }
+
+ const delta = jdp.diff(ours, theirs);
+ const html = jdpformatters.format(delta, ours);
+
+ return (
+ <div className="revision-diff-area">
+ <div
+ style={{marginTop: '30px'}}
+ dangerouslySetInnerHTML={{__html: html}}
+ ></div>
+ </div>
+ );
+};
+RevisionDiffArea.propTypes = {
+ ours: PropTypes.object,
+ theirs: PropTypes.object,
+ currentRev: PropTypes.string
+};
+
+
+const ConflictingRevisionsDropDown = ({options, selected, onRevisionClick, onBackwardClick, onForwardClick}) => {
+ return (
+ <div className="conflicting-revs-dropdown">
+ <BackForwardControls backward onClick={onBackwardClick} />
+ <div style={{width: '345px', margin: '0 5px'}}>
+ <ReactSelect
+ name="form-field-name"
+ value={selected}
+ options={options}
+ clearable={false}
+ onChange={onRevisionClick} />
+ </div>
+ <BackForwardControls forward onClick={onForwardClick} />
+ </div>
+ );
+};
+ConflictingRevisionsDropDown.propTypes = {
+ options: PropTypes.array.isRequired,
+ selected: PropTypes.string.isRequired,
+ onRevisionClick: PropTypes.func.isRequired,
+ onBackwardClick: PropTypes.func.isRequired,
+ onForwardClick: PropTypes.func.isRequired,
+};
+
+class RevisionBrowserControls extends React.Component {
+
+ constructor (props) {
+ super(props);
+
+ this.state = {showModal: false};
+ }
+
+ onRevisionClick (revTheirs) {
+
+ RevActions.chooseLeaves(this.props.ours, revTheirs.value);
+ }
+
+ onForwardClick () {
+ const conflictingRevs = this.props.conflictingRevs;
+ const index = conflictingRevs.indexOf(this.props.theirs._rev);
+
+ const next = conflictingRevs[index + 1];
+
+ if (!next) {
+ return;
+ }
+
+ RevActions.chooseLeaves(this.props.ours, next);
+ }
+
+ onBackwardClick () {
+ const conflictingRevs = this.props.conflictingRevs;
+ const index = conflictingRevs.indexOf(this.props.theirs._rev);
+
+ const next = conflictingRevs[index - 1];
+
+ if (!next) {
+ return;
+ }
+
+ RevActions.chooseLeaves(this.props.ours, next);
+ }
+
+ selectAsWinner (docToWin, doNotShowModalAgain) {
+ if (doNotShowModalAgain) {
+ app.utils.localStorageSet(storageKeyDeleteConflictsModal, true);
+ }
+
+ RevActions.selectRevAsWinner(this.props.databaseName, docToWin._id, this.props.tree.paths, docToWin._rev);
+ }
+
+ onSelectAsWinnerClick (docToWin) {
+ if (app.utils.localStorageGet(storageKeyDeleteConflictsModal) !== true) {
+ RevActions.showConfirmModal(true, docToWin);
+ return;
+ }
+
+ this.selectAsWinner(docToWin);
+ }
+
+ render () {
+ const {tree} = this.props;
+ const cellStyle = {paddingRight: '30px'};
+
+ return (
+ <div className="revision-browser-controls">
+ <ConfirmModal onConfirm={this.selectAsWinner.bind(this)} />
+ <table style={{margin: '10px 60px', width: '100%'}}>
+ <tbody>
+ <tr style={{height: '60px'}}>
+ <td style={cellStyle}>Server-Selected Rev: </td>
+ <td style={cellStyle}>
+ <div style={{lineHeight: '36px', height: '36px', width: '337px', color: '#000', backgroundColor: '#ffbbbb'}}>
+ <b style={{paddingLeft: '10px'}}>{tree.winner}</b>
+ </div>
+ </td>
+ <td>
+ <ConfirmButton
+ onClick={this.onSelectAsWinnerClick.bind(this, this.props.ours)}
+ style={{marginRight: '10px', width: '220px'}}
+ text="Delete Other Conflicts"
+ buttonType="btn-secondary"
+ customIcon="icon-trophy" />
+ </td>
+ </tr>
+ <tr style={{height: '60px'}}>
+ <td style={cellStyle}>Conflicting Revisions: </td>
+ <td style={cellStyle}>
+ <ConflictingRevisionsDropDown
+ onRevisionClick={this.onRevisionClick.bind(this)}
+ onForwardClick={this.onForwardClick.bind(this)}
+ onBackwardClick={this.onBackwardClick.bind(this)}
+ options={this.props.dropdownData}
+ selected={this.props.theirs._rev} />
+ </td>
+ <td>
+ <ConfirmButton
+ data-id="button-select-theirs"
+ onClick={this.onSelectAsWinnerClick.bind(this, this.props.theirs)}
+ style={{marginRight: '10px', width: '220px'}}
+ text="Select as Winner"
+ buttonType="btn-secondary"
+ customIcon="icon-trophy" />
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+
+ );
+ }
+}
+RevisionBrowserControls.propTypes = {
+ tree: PropTypes.object.isRequired,
+ ours: PropTypes.object.isRequired,
+ conflictingRevs: PropTypes.array.isRequired,
+};
+
+class ConfirmModal extends React.Component {
+
+ constructor (props) {
+ super(props);
+
+ this.state = this.getStoreState();
+ }
+
+ getStoreState () {
+ return {
+ show: store.getShowConfirmModal(),
+ docToWin: store.getDocToWin(),
+ checked: false
+ };
+ }
+
+ componentDidMount () {
+ store.on('change', this.onChange, this);
+ }
+
+ componentWillUnmount () {
+ store.off('change', this.onChange);
+ }
+
+ onChange () {
+ this.setState(this.getStoreState());
+ }
+
+ close () {
+ RevActions.showConfirmModal(false, null);
+ }
+
+ onDeleteConflicts () {
+ const hideModal = this.state.checked;
+ this.props.onConfirm(this.state.docToWin, hideModal);
+ }
+
+ render () {
+ return (
+ <Modal dialogClassName="delete-conflicts-modal" show={this.state.show} onHide={this.close}>
+ <Modal.Header closeButton={false}>
+ <Modal.Title>Solve Conflicts</Modal.Title>
+ </Modal.Header>
+ <Modal.Body>
+ <p>
+ <i className="icon-warning-sign"></i> Do you want to delete all conflicting revisions for this document?
+ </p>
+
+
+ </Modal.Body>
+ <Modal.Footer>
+ <div style={{float: 'left', marginTop: '10px'}}>
+ <label>
+ <input
+ style={{margin: '0 5px 3px 0'}}
+ onChange={() => { this.setState({checked: !this.state.checked }); }}
+ type="checkbox" />
+ Do not show this warning message again
+ </label>
+ </div>
+ <a
+ style={{marginRight: '10px', cursor: 'pointer'}}
+ onClick={this.close}
+ data-bypass="true"
+ >
+ Cancel
+ </a>
+
+ <ConfirmButton
+ onClick={this.onDeleteConflicts.bind(this)}
+ text="Delete Revisions"
+ buttonType="btn-danger" />
+ </Modal.Footer>
+ </Modal>
+ );
+ }
+}
+ConfirmModal.propTypes = {
+ onConfirm: PropTypes.func.isRequired,
+};
+
+const BackForwardControls = ({onClick, forward}) => {
+ const icon = forward ? 'fonticon-right-open' : 'fonticon-left-open';
+ const style = {height: '20px', width: '11px', marginTop: '7px'};
+
+ return <div style={style} className={icon} onClick={onClick}></div>;
+};
+BackForwardControls.propTypes = {
+ onClick: PropTypes.func.isRequired,
+};
+
+export default {
+ DiffyController: DiffyController
+};
diff --git a/app/addons/documents/rev-browser/rev-browser.stores.js b/app/addons/documents/rev-browser/rev-browser.stores.js
new file mode 100644
index 0000000..831ae24
--- /dev/null
+++ b/app/addons/documents/rev-browser/rev-browser.stores.js
@@ -0,0 +1,120 @@
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy of
+// the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations under
+// the License.
+
+import FauxtonAPI from "../../../core/api";
+import ActionTypes from "./rev-browser.actiontypes";
+
+const Stores = {};
+
+Stores.RevBrowserStore = FauxtonAPI.Store.extend({
+ initialize: function () {
+ this.reset();
+ },
+
+ reset: function () {
+ this._revTree = null;
+
+ this._ours = null;
+ this._theirs = null;
+
+ this._dropDownData = null;
+ this._isDiffViewEnabled = true;
+
+ this._databaseName = null;
+
+ this._showConfirmModal = false;
+ this._docToWin = null;
+ },
+
+ prepareDropdownData: function (revs) {
+ return revs.map((el) => {
+
+ return { value: el, label: el };
+ });
+ },
+
+ getRevTree: function () {
+ return this._revTree;
+ },
+
+ getDatabaseName: function () {
+ return this._databaseName;
+ },
+
+ getOurs: function () {
+ return this._ours;
+ },
+
+ getTheirs: function () {
+ return this._theirs;
+ },
+
+ getConflictingRevs: function () {
+ return this._conflictingRevs;
+ },
+
+ getDropdownData: function () {
+ return this._dropDownData;
+ },
+
+ getIsDiffViewEnabled: function () {
+ return this._isDiffViewEnabled;
+ },
+
+ getShowConfirmModal: function () {
+ return this._showConfirmModal;
+ },
+
+ getDocToWin: function () {
+ return this._docToWin;
+ },
+
+ dispatch: function (action) {
+ switch (action.type) {
+ case ActionTypes.REV_BROWSER_REV_TREE_LOADED:
+ this._revTree = action.options.tree;
+ this._ours = action.options.doc;
+ this._conflictingRevs = action.options.conflictingRevs;
+ this._theirs = action.options.conflictDoc;
+
+ this._dropDownData = this.prepareDropdownData(this._conflictingRevs);
+
+ this._databaseName = action.options.databaseName;
+ break;
+
+ case ActionTypes.REV_BROWSER_DIFF_DOCS_READY:
+ this._theirs = action.options.theirs;
+ break;
+
+ case ActionTypes.REV_BROWSER_DIFF_ENABLE_DIFF_VIEW:
+ this._isDiffViewEnabled = action.options.enableDiff;
+ break;
+
+ case ActionTypes.REV_BROWSER_SHOW_CONFIRM_MODAL:
+ this._showConfirmModal = action.options.show;
+ this._docToWin = action.options.docToWin;
+ break;
+
+ default:
+ return;
+ // do nothing
+ }
+
+ this.triggerChange();
+ }
+
+});
+
+Stores.revBrowserStore = new Stores.RevBrowserStore();
+Stores.revBrowserStore.dispatchToken = FauxtonAPI.dispatcher.register(Stores.revBrowserStore.dispatch);
+
+export default Stores;
diff --git a/app/addons/documents/routes-doc-editor.js b/app/addons/documents/routes-doc-editor.js
index a5f49ce..3701666 100644
--- a/app/addons/documents/routes-doc-editor.js
+++ b/app/addons/documents/routes-doc-editor.js
@@ -55,7 +55,7 @@ const DocEditorRouteObject = FauxtonAPI.RouteObject.extend({
endpoint={this.doc.url('apiurl')}
docURL={docURL}
component={<RevBrowserContainer docId={docId} databaseName={databaseName} />}
- />;
+ />;
},
codeEditor: function (databaseName, docId) {
@@ -79,10 +79,10 @@ const DocEditorRouteObject = FauxtonAPI.RouteObject.extend({
endpoint={this.doc.url('apiurl')}
docURL={this.doc.documentation()}
component={<ReactComponents.DocEditorController
- database={this.database}
- isNewDoc={docId ? false : true}
- />}
- />;
+ database={this.database}
+ isNewDoc={docId ? false : true}
+ />}
+ />;
},
showLocalDoc: function(databaseName, docId) {
diff --git a/app/addons/documents/routes-index-editor.js b/app/addons/documents/routes-index-editor.js
index 75ca693..ad19c8c 100644
--- a/app/addons/documents/routes-index-editor.js
+++ b/app/addons/documents/routes-index-editor.js
@@ -86,7 +86,7 @@ const IndexEditorAndResults = BaseRoute.extend({
ddocsOnly={false}
deleteEnabled={false}
selectedNavItem={selectedNavItem}
- />;
+ />;
},
createView: function (database, _designDoc) {
@@ -117,7 +117,7 @@ const IndexEditorAndResults = BaseRoute.extend({
dbName={this.database.id}
dropDownLinks={dropDownLinks}
database={this.database}
- />;
+ />;
},
editView: function (databaseName, ddocName, viewName) {
@@ -146,7 +146,7 @@ const IndexEditorAndResults = BaseRoute.extend({
dbName={this.database.id}
dropDownLinks={dropDownLinks}
database={this.database}
- />;
+ />;
}
});
diff --git a/app/addons/documents/sidebar/__tests__/sidebar.components.test.js b/app/addons/documents/sidebar/__tests__/sidebar.components.test.js
index 5df2405..ad17a2d 100644
--- a/app/addons/documents/sidebar/__tests__/sidebar.components.test.js
+++ b/app/addons/documents/sidebar/__tests__/sidebar.components.test.js
@@ -93,7 +93,7 @@ describe('DesignDoc', () => {
const subOptions = el.find('.accordion-body li');
assert.equal(subOptions.length, 1);
- });
+ });
it('confirm design doc sidebar extensions appear', function () {
const el = mount(<DesignDoc
diff --git a/app/addons/documents/sidebar/reducers.js b/app/addons/documents/sidebar/reducers.js
index ef295f4..6359823 100644
--- a/app/addons/documents/sidebar/reducers.js
+++ b/app/addons/documents/sidebar/reducers.js
@@ -27,4 +27,4 @@ export default function resultsState(state = initialState, action) {
default:
return state;
}
-};
+}
diff --git a/app/addons/documents/sidebar/sidebar.js b/app/addons/documents/sidebar/sidebar.js
index 90760bb..c8e1fe4 100644
--- a/app/addons/documents/sidebar/sidebar.js
+++ b/app/addons/documents/sidebar/sidebar.js
@@ -386,7 +386,7 @@ class DesignDocList extends React.Component {
// only pass down the selected nav info and toggle info if they're relevant for this particular design doc
let expanded = false,
- toggledSections = {};
+ toggledSections = {};
if (_.has(this.props.toggledSections, ddName)) {
expanded = this.props.toggledSections[ddName].visible;
toggledSections = this.props.toggledSections[ddName].indexGroups;
@@ -574,7 +574,7 @@ class CloneIndexModal extends React.Component {
};
submit = () => {
- if (!this.refs.designDocSelector.validate()) {
+ if (!this.designDocSelector.validate()) {
return;
}
if (this.props.newIndexName === '') {
@@ -615,7 +615,7 @@ class CloneIndexModal extends React.Component {
<div className="row">
<DesignDocSelector
- ref="designDocSelector"
+ ref={node => this.designDocSelector = node}
designDocList={this.props.designDocArray}
selectedDesignDocName={this.props.selectedDesignDoc}
newDesignDocName={this.props.newDesignDocName}
diff --git a/app/addons/documents/sidebar/stores.js b/app/addons/documents/sidebar/stores.js
index adaeb0e..135b3de 100644
--- a/app/addons/documents/sidebar/stores.js
+++ b/app/addons/documents/sidebar/stores.js
@@ -274,55 +274,55 @@ Stores.SidebarStore = FauxtonAPI.Store.extend({
switch (action.type) {
case ActionTypes.SIDEBAR_SET_SELECTED_NAV_ITEM:
this.setSelected(action.options);
- break;
+ break;
case ActionTypes.SIDEBAR_NEW_OPTIONS:
this.newOptions(action.options);
- break;
+ break;
case ActionTypes.SIDEBAR_TOGGLE_CONTENT:
this.toggleContent(action.designDoc, action.indexGroup);
- break;
+ break;
case ActionTypes.SIDEBAR_FETCHING:
this._loading = true;
- break;
+ break;
case ActionTypes.SIDEBAR_SHOW_DELETE_INDEX_MODAL:
this.showDeleteIndexModal(action.options);
- break;
+ break;
case ActionTypes.SIDEBAR_HIDE_DELETE_INDEX_MODAL:
this._deleteIndexModalVisible = false;
- break;
+ break;
case ActionTypes.SIDEBAR_SHOW_CLONE_INDEX_MODAL:
this.showCloneIndexModal(action.options);
- break;
+ break;
case ActionTypes.SIDEBAR_HIDE_CLONE_INDEX_MODAL:
this._cloneIndexModalVisible = false;
- break;
+ break;
case ActionTypes.SIDEBAR_CLONE_MODAL_DESIGN_DOC_CHANGE:
this._cloneIndexModalSelectedDesignDoc = action.options.value;
- break;
+ break;
case ActionTypes.SIDEBAR_CLONE_MODAL_DESIGN_DOC_NEW_NAME_UPDATED:
this._cloneIndexModalNewDesignDocName = action.options.value;
- break;
+ break;
case ActionTypes.SIDEBAR_CLONE_MODAL_UPDATE_INDEX_NAME:
this._cloneIndexModalNewIndexName = action.options.value;
- break;
+ break;
case ActionTypes.SIDEBAR_UPDATED_DESIGN_DOCS:
this.updatedDesignDocs(action.options.designDocs);
this._loading = false;
- break;
+ break;
default:
- return;
+ return;
// do nothing
}
diff --git a/app/addons/documents/tests/nightwatch/bulkDelete.js b/app/addons/documents/tests/nightwatch/bulkDelete.js
index f5df763..c3330ea 100644
--- a/app/addons/documents/tests/nightwatch/bulkDelete.js
+++ b/app/addons/documents/tests/nightwatch/bulkDelete.js
@@ -16,10 +16,10 @@ module.exports = {
'Bulk deletes on json view': function (client) {
var waitTime = client.globals.maxWaitTime,
- newDatabaseName = client.globals.testDatabaseName,
- newDocumentName1 = 'bulktest1',
- newDocumentName2 = 'bulktest2',
- baseUrl = client.globals.test_settings.launch_url;
+ newDatabaseName = client.globals.testDatabaseName,
+ newDocumentName1 = 'bulktest1',
+ newDocumentName2 = 'bulktest2',
+ baseUrl = client.globals.test_settings.launch_url;
client
.loginToGUI()
@@ -39,9 +39,9 @@ module.exports = {
.waitForElementNotPresent('[data-id="' + newDocumentName1 + '"]', waitTime, false)
.getText('body', function (result) {
var data = result.value,
- isPresentFirstDoc = data.indexOf(newDocumentName1) !== -1,
- isPresentSecondDoc = data.indexOf(newDocumentName2) !== -1,
- bothMissing = !isPresentFirstDoc && !isPresentSecondDoc;
+ isPresentFirstDoc = data.indexOf(newDocumentName1) !== -1,
+ isPresentSecondDoc = data.indexOf(newDocumentName2) !== -1,
+ bothMissing = !isPresentFirstDoc && !isPresentSecondDoc;
this.verify.ok(bothMissing,
'Checking if documents were deleted');
@@ -51,10 +51,10 @@ module.exports = {
'Bulk deletes on table/metadata view': function (client) {
var waitTime = client.globals.maxWaitTime,
- newDatabaseName = client.globals.testDatabaseName,
- newDocumentName1 = 'bulktest1',
- newDocumentName2 = 'bulktest2',
- baseUrl = client.globals.test_settings.launch_url;
+ newDatabaseName = client.globals.testDatabaseName,
+ newDocumentName1 = 'bulktest1',
+ newDocumentName2 = 'bulktest2',
+ baseUrl = client.globals.test_settings.launch_url;
client
.loginToGUI()
@@ -73,9 +73,9 @@ module.exports = {
.waitForElementNotPresent('.table-view-docs ', waitTime, false)
.getText('body', function (result) {
var data = result.value,
- isPresentFirstDoc = data.indexOf(newDocumentName1) !== -1,
- isPresentSecondDoc = data.indexOf(newDocumentName2) !== -1,
- bothMissing = !isPresentFirstDoc && !isPresentSecondDoc;
+ isPresentFirstDoc = data.indexOf(newDocumentName1) !== -1,
+ isPresentSecondDoc = data.indexOf(newDocumentName2) !== -1,
+ bothMissing = !isPresentFirstDoc && !isPresentSecondDoc;
this.verify.ok(bothMissing,
'Checking if documents were deleted');
@@ -85,8 +85,8 @@ module.exports = {
'Select all works after changing the page': function (client) {
var waitTime = client.globals.maxWaitTime,
- newDatabaseName = client.globals.testDatabaseName,
- baseUrl = client.globals.test_settings.launch_url;
+ newDatabaseName = client.globals.testDatabaseName,
+ baseUrl = client.globals.test_settings.launch_url;
client
.loginToGUI()
diff --git a/app/addons/documents/tests/nightwatch/checkSidebarBehavior.js b/app/addons/documents/tests/nightwatch/checkSidebarBehavior.js
index 680eee7..3261494 100644
--- a/app/addons/documents/tests/nightwatch/checkSidebarBehavior.js
+++ b/app/addons/documents/tests/nightwatch/checkSidebarBehavior.js
@@ -16,8 +16,8 @@ module.exports = {
'Checks if design docs that have special chars in the ID show up in the UI and are clickable': function (client) {
const waitTime = 10000,
- newDatabaseName = client.globals.testDatabaseName,
- baseUrl = client.globals.test_settings.launch_url;
+ newDatabaseName = client.globals.testDatabaseName,
+ baseUrl = client.globals.test_settings.launch_url;
const docNormal = 'ddoc_normal';
const docSpecialChars = 'ddoc_with.$pecialcharacters()+-';
const docSpecialCharsEncoded = 'ddoc_with.%24pecialcharacters()%2B-';
@@ -37,6 +37,6 @@ module.exports = {
.assert.visible('a[href="#/database/' + newDatabaseName + '/_design/' + docSpecialCharsEncoded + '/_info"]')
// Verify display name is not encoded
.assert.containsText('span[title="_design/' + docSpecialChars + '"]', docSpecialChars)
- .end();
+ .end();
}
};
diff --git a/app/addons/documents/tests/nightwatch/cloneDoc.js b/app/addons/documents/tests/nightwatch/cloneDoc.js
index 7f636ae..35c35cc 100644
--- a/app/addons/documents/tests/nightwatch/cloneDoc.js
+++ b/app/addons/documents/tests/nightwatch/cloneDoc.js
@@ -54,6 +54,6 @@ module.exports = {
'check that document is correctly reloaded'
);
})
- .end();
+ .end();
},
};
diff --git a/app/addons/documents/tests/nightwatch/createsDocument.js b/app/addons/documents/tests/nightwatch/createsDocument.js
index 2a1d68e..30aac01 100644
--- a/app/addons/documents/tests/nightwatch/createsDocument.js
+++ b/app/addons/documents/tests/nightwatch/createsDocument.js
@@ -55,10 +55,10 @@ module.exports = {
'Checking if new document shows up in _all_docs.'
);
})
- .end();
+ .end();
},
- 'Creates a _local document' : (client) => {
+ 'Creates a _local document' : (client) => {
/*jshint multistr: true */
const waitTime = client.globals.maxWaitTime,
newDatabaseName = client.globals.testDatabaseName,
@@ -105,7 +105,7 @@ module.exports = {
'Checking if new document shows up in _all_docs.'
);
})
- .end();
+ .end();
},
'Creates a Document through Create Document toolbar button': (client) => {
@@ -148,6 +148,6 @@ module.exports = {
'Checking if new document shows up in _all_docs.'
);
})
- .end();
+ .end();
}
};
diff --git a/app/addons/documents/tests/nightwatch/createsDocumentWithoutId.js b/app/addons/documents/tests/nightwatch/createsDocumentWithoutId.js
index 464db4b..d7c7c5e 100644
--- a/app/addons/documents/tests/nightwatch/createsDocumentWithoutId.js
+++ b/app/addons/documents/tests/nightwatch/createsDocumentWithoutId.js
@@ -45,6 +45,6 @@ module.exports = {
.clickWhenVisible('#doc-editor-actions-panel .save-doc')
.checkForStringPresent(newDatabaseName + '/_all_docs', '"total_rows":1')
- .end();
+ .end();
}
};
diff --git a/app/addons/documents/tests/nightwatch/deleteDatabaseModal.js b/app/addons/documents/tests/nightwatch/deleteDatabaseModal.js
index 98163f9..32fc47b 100644
--- a/app/addons/documents/tests/nightwatch/deleteDatabaseModal.js
+++ b/app/addons/documents/tests/nightwatch/deleteDatabaseModal.js
@@ -44,7 +44,7 @@ module.exports = {
.waitForElementVisible('.delete-db-modal', waitTime, false)
.waitForElementVisible('.delete-db-modal input[type="text"]', waitTime, false)
.assert.elementPresent('.warning')
- .end();
+ .end();
},
'Shows no warning for non system databases': function (client) {
@@ -63,6 +63,6 @@ module.exports = {
.waitForElementVisible('.delete-db-modal', waitTime, false)
.waitForElementVisible('.delete-db-modal input[type="text"]', waitTime, false)
.assert.elementNotPresent('.warning')
- .end();
+ .end();
}
};
diff --git a/app/addons/documents/tests/nightwatch/deletesDocuments.js b/app/addons/documents/tests/nightwatch/deletesDocuments.js
index 960bd82..1435461 100644
--- a/app/addons/documents/tests/nightwatch/deletesDocuments.js
+++ b/app/addons/documents/tests/nightwatch/deletesDocuments.js
@@ -53,7 +53,7 @@ module.exports = {
this.verify.ok(createdDocumentANotPresent && createdDocumentBNotPresent,
'Checking if new documents no longer shows up in _all_docs.');
})
- .end();
+ .end();
},
'Deletes a document on table/metadata view': function (client) {
@@ -93,7 +93,7 @@ module.exports = {
this.verify.ok(createdDocumentANotPresent && createdDocumentBNotPresent,
'Checking if new documents no longer shows up in _all_docs.');
})
- .end();
+ .end();
},
'Deleting a new Design Doc automatically removes it from the sidebar': function (client) {
@@ -103,9 +103,9 @@ module.exports = {
var designDoc = {
"_id": "_design/sidebar-update",
"views": {
- "new-index": {
- "map": "function (doc) {\n emit(doc._id, 1);\n}"
- }
+ "new-index": {
+ "map": "function (doc) {\n emit(doc._id, 1);\n}"
+ }
},
"language": "javascript"
};
@@ -162,7 +162,7 @@ module.exports = {
this.verify.ok(createdDocumentANotPresent,
'Checking if new document no longer shows up in _all_docs.');
})
- .end();
+ .end();
},
};
diff --git a/app/addons/documents/tests/nightwatch/doubleEmitResults.js b/app/addons/documents/tests/nightwatch/doubleEmitResults.js
index 40cae8e..5aa61cc 100644
--- a/app/addons/documents/tests/nightwatch/doubleEmitResults.js
+++ b/app/addons/documents/tests/nightwatch/doubleEmitResults.js
@@ -20,17 +20,17 @@ module.exports = {
var baseUrl = client.globals.test_settings.launch_url;
client
- .loginToGUI()
- .populateDatabase(newDatabaseName)
- .url(baseUrl + '/#/database/' + newDatabaseName + '/_design/testdesigndoc/_view/stubview')
- .clickWhenVisible('.fonticon-json')
- .waitForElementPresent('.clearfix', waitTime, false)
- .waitForElementPresent('.doc-row', waitTime, false)
- .execute(function () {
- return document.querySelectorAll('.doc-row').length;
- }, function (result) {
- client.assert.equal(result.value, 20);
- })
- .end();
+ .loginToGUI()
+ .populateDatabase(newDatabaseName)
+ .url(baseUrl + '/#/database/' + newDatabaseName + '/_design/testdesigndoc/_view/stubview')
+ .clickWhenVisible('.fonticon-json')
+ .waitForElementPresent('.clearfix', waitTime, false)
+ .waitForElementPresent('.doc-row', waitTime, false)
+ .execute(function () {
+ return document.querySelectorAll('.doc-row').length;
+ }, function (result) {
+ client.assert.equal(result.value, 20);
+ })
+ .end();
},
};
diff --git a/app/addons/documents/tests/nightwatch/editDocumentsFromView.js b/app/addons/documents/tests/nightwatch/editDocumentsFromView.js
index 4f1303f..7f87e0e 100644
--- a/app/addons/documents/tests/nightwatch/editDocumentsFromView.js
+++ b/app/addons/documents/tests/nightwatch/editDocumentsFromView.js
@@ -15,18 +15,18 @@
module.exports = {
'Edit is allowed from default Map Views' : function (client) {
const waitTime = client.globals.maxWaitTime,
- newDatabaseName = client.globals.testDatabaseName,
- baseUrl = client.globals.test_settings.launch_url,
- newDocumentName = '_design/abc',
- ddocContents = {
- "views": {
- "evens": {
- "map": "function (doc) { if (doc.number%2 === 0) { emit(doc._id, doc.number); } }",
- "reduce" : "_count"
- }
- },
- "language": "javascript"
- };
+ newDatabaseName = client.globals.testDatabaseName,
+ baseUrl = client.globals.test_settings.launch_url,
+ newDocumentName = '_design/abc',
+ ddocContents = {
+ "views": {
+ "evens": {
+ "map": "function (doc) { if (doc.number%2 === 0) { emit(doc._id, doc.number); } }",
+ "reduce" : "_count"
+ }
+ },
+ "language": "javascript"
+ };
client
.createDocument(newDocumentName, newDatabaseName, ddocContents)
.populateDatabase(newDatabaseName)
@@ -53,6 +53,6 @@ module.exports = {
.clickWhenVisible('#query-options-tray label[for="qoReduce"]')
.clickWhenVisible('#button-options button[type="submit"]')
.waitForElementNotPresent('i.fonticon-pencil', waitTime)
- .end();
+ .end();
}
};
diff --git a/app/addons/documents/tests/nightwatch/encodingSupport.js b/app/addons/documents/tests/nightwatch/encodingSupport.js
index 41af968..79265ae 100644
--- a/app/addons/documents/tests/nightwatch/encodingSupport.js
+++ b/app/addons/documents/tests/nightwatch/encodingSupport.js
@@ -25,7 +25,7 @@ module.exports = {
.waitForElementPresent('.bulk-action-component-panel', waitTime, true)
.clickWhenVisible('#mango-query', waitTime, true)
.waitForElementPresent('.mango-editor-wrapper', waitTime, true)
- .end();
+ .end();
},
'permissions supports encoding': function (client) {
@@ -42,7 +42,7 @@ module.exports = {
.waitForElementPresent('.bulk-action-component-panel', waitTime, true)
.clickWhenVisible('#permissions', waitTime, true)
.waitForElementPresent('.permissions-page', waitTime, true)
- .end();
+ .end();
},
'changes supports encoding': function (client) {
@@ -59,6 +59,6 @@ module.exports = {
.waitForElementPresent('.bulk-action-component-panel', waitTime, true)
.clickWhenVisible('#changes', waitTime, true)
.waitForElementPresent('.changes-header', waitTime, true)
- .end();
+ .end();
}
};
diff --git a/app/addons/documents/tests/nightwatch/mangoIndex.js b/app/addons/documents/tests/nightwatch/mangoIndex.js
index 932e4e3..6742063 100644
--- a/app/addons/documents/tests/nightwatch/mangoIndex.js
+++ b/app/addons/documents/tests/nightwatch/mangoIndex.js
@@ -44,7 +44,7 @@ module.exports = {
.checkForStringPresent(newDatabaseName + '/_index', 'gans_gans_mango')
.waitForElementPresent('.prettyprint', waitTime, false)
.assert.containsText('#dashboard-lower-content', 'gans_gans_mango')
- .end();
+ .end();
},
'Deleting new named indexes with mango': function (client) {
diff --git a/app/addons/documents/tests/nightwatch/mangoQuery.js b/app/addons/documents/tests/nightwatch/mangoQuery.js
index cce3f09..22e794f 100644
--- a/app/addons/documents/tests/nightwatch/mangoQuery.js
+++ b/app/addons/documents/tests/nightwatch/mangoQuery.js
@@ -41,6 +41,6 @@ module.exports = {
.waitForElementPresent('.prettyprint', waitTime, false)
.assert.containsText('#dashboard-lower-content', 'number')
.assert.containsText('#dashboard-lower-content', 'ente_ente_mango_ananas_res')
- .end();
+ .end();
}
};
diff --git a/app/addons/documents/tests/nightwatch/navigateFromNewDoc.js b/app/addons/documents/tests/nightwatch/navigateFromNewDoc.js
index 786f5fa..323fc85 100644
--- a/app/addons/documents/tests/nightwatch/navigateFromNewDoc.js
+++ b/app/addons/documents/tests/nightwatch/navigateFromNewDoc.js
@@ -18,8 +18,8 @@ module.exports = {
// a bug fix for where the Ace Editor threw a JS error preventing the subsequent page from loading]
'Navigate to and from New Doc Page' : function (client) {
var waitTime = client.globals.maxWaitTime,
- newDatabaseName = client.globals.testDatabaseName,
- baseUrl = client.globals.test_settings.launch_url;
+ newDatabaseName = client.globals.testDatabaseName,
+ baseUrl = client.globals.test_settings.launch_url;
var newLink = '/#/database/' + newDatabaseName + '/new';
diff --git a/app/addons/documents/tests/nightwatch/navigateNotFoundDB.js b/app/addons/documents/tests/nightwatch/navigateNotFoundDB.js
index d5d3471..610b493 100644
--- a/app/addons/documents/tests/nightwatch/navigateNotFoundDB.js
+++ b/app/addons/documents/tests/nightwatch/navigateNotFoundDB.js
@@ -18,7 +18,7 @@ module.exports = {
// a bug fix for where the Ace Editor threw a JS error preventing the subsequent page from loading]
'Navigate to a database that does not exist' : function (client) {
const waitTime = client.globals.maxWaitTime,
- baseUrl = client.globals.test_settings.launch_url;
+ baseUrl = client.globals.test_settings.launch_url;
client
.loginToGUI()
diff --git a/app/addons/documents/tests/nightwatch/paginateView.js b/app/addons/documents/tests/nightwatch/paginateView.js
index 80c8a30..d7c848a 100644
--- a/app/addons/documents/tests/nightwatch/paginateView.js
+++ b/app/addons/documents/tests/nightwatch/paginateView.js
@@ -14,7 +14,7 @@
module.exports = {
- 'change number of items per page': function (client) {
+ 'change number of items per page': function (client) {
var waitTime = client.globals.maxWaitTime,
newDatabaseName = client.globals.testDatabaseName,
baseUrl = client.globals.test_settings.launch_url;
diff --git a/app/addons/documents/tests/nightwatch/previousButton.js b/app/addons/documents/tests/nightwatch/previousButton.js
index 25c770a..aee4c52 100644
--- a/app/addons/documents/tests/nightwatch/previousButton.js
+++ b/app/addons/documents/tests/nightwatch/previousButton.js
@@ -21,6 +21,6 @@ module.exports = {
.url(baseUrl + '/#/database/' + newDatabaseName + '/_index')
.clickWhenVisible('.faux-header__breadcrumbs-link')
.assert.urlContains('_all_docs')
- .end();
+ .end();
}
};
diff --git a/app/addons/documents/tests/nightwatch/queryOptions.js b/app/addons/documents/tests/nightwatch/queryOptions.js
index 4df2bd3..130ccee 100644
--- a/app/addons/documents/tests/nightwatch/queryOptions.js
+++ b/app/addons/documents/tests/nightwatch/queryOptions.js
@@ -37,6 +37,6 @@ module.exports = {
.assert.elementPresent('#doc-list [data-id="document_2"]')
.waitForElementPresent('#doc-list [data-id="document_3"]', waitTime, false)
.assert.elementPresent('#doc-list [data-id="document_3"]')
- .end();
+ .end();
}
};
diff --git a/app/addons/documents/tests/nightwatch/queryOptionsCloseBug.js b/app/addons/documents/tests/nightwatch/queryOptionsCloseBug.js
index 314b0e3..67aba3a 100644
--- a/app/addons/documents/tests/nightwatch/queryOptionsCloseBug.js
+++ b/app/addons/documents/tests/nightwatch/queryOptionsCloseBug.js
@@ -37,6 +37,6 @@ module.exports = {
.waitForElementNotPresent('.query-options .js-view-query-update', waitTime, false)
- .end();
+ .end();
}
};
diff --git a/app/addons/documents/tests/nightwatch/replicateDatabaseButton.js b/app/addons/documents/tests/nightwatch/replicateDatabaseButton.js
index d19db66..7d540ca 100644
--- a/app/addons/documents/tests/nightwatch/replicateDatabaseButton.js
+++ b/app/addons/documents/tests/nightwatch/replicateDatabaseButton.js
@@ -14,44 +14,44 @@
var helpers = require('../../../../../test/nightwatch_tests/helpers/helpers.js');
var testDbName = 'test_database';
module.exports = {
- before: function (client, done) {
- var nano = helpers.getNanoInstance(client.globals.test_settings.db_url);
- nano.db.create(testDbName, function () {
- done();
- });
- },
-
- after: function (client, done) {
- var nano = helpers.getNanoInstance(client.globals.test_settings.db_url);
- nano.db.destroy(testDbName, function () {
- done();
- });
- },
-
- 'Shows correct view on replicate database': function (client) {
- var waitTime = client.globals.maxWaitTime,
- baseUrl = client.globals.test_settings.launch_url;
- var srcDbSelector = '.replication__page .replication__section:nth-child(2) .replication__input-react-select .Select-value-label';
- client
- .loginToGUI()
- .url(baseUrl + '/#/database/' + testDbName + '/_all_docs')
- .waitForElementNotPresent('.global-notification .fonticon-cancel', waitTime, false)
-
- .clickWhenVisible('.faux-header__doc-header-dropdown-toggle')
- .clickWhenVisible('.faux-header__doc-header-dropdown-itemwrapper .fonticon-replicate')
-
- //Wait for replication page to show up
- .waitForElementVisible('.replication__page', waitTime, false)
-
- //Wait for source select to show
- .waitForElementVisible(srcDbSelector, waitTime, false)
-
- //Get the text values
- .getText(srcDbSelector, function (data) {
- this.verify.ok(data.value === testDbName,
- 'Check if database name is filled in source name');
- })
- .end();
- }
+ before: function (client, done) {
+ var nano = helpers.getNanoInstance(client.globals.test_settings.db_url);
+ nano.db.create(testDbName, function () {
+ done();
+ });
+ },
+
+ after: function (client, done) {
+ var nano = helpers.getNanoInstance(client.globals.test_settings.db_url);
+ nano.db.destroy(testDbName, function () {
+ done();
+ });
+ },
+
+ 'Shows correct view on replicate database': function (client) {
+ var waitTime = client.globals.maxWaitTime,
+ baseUrl = client.globals.test_settings.launch_url;
+ var srcDbSelector = '.replication__page .replication__section:nth-child(2) .replication__input-react-select .Select-value-label';
+ client
+ .loginToGUI()
+ .url(baseUrl + '/#/database/' + testDbName + '/_all_docs')
+ .waitForElementNotPresent('.global-notification .fonticon-cancel', waitTime, false)
+
+ .clickWhenVisible('.faux-header__doc-header-dropdown-toggle')
+ .clickWhenVisible('.faux-header__doc-header-dropdown-itemwrapper .fonticon-replicate')
+
+ //Wait for replication page to show up
+ .waitForElementVisible('.replication__page', waitTime, false)
+
+ //Wait for source select to show
+ .waitForElementVisible(srcDbSelector, waitTime, false)
+
+ //Get the text values
+ .getText(srcDbSelector, function (data) {
+ this.verify.ok(data.value === testDbName,
+ 'Check if database name is filled in source name');
+ })
+ .end();
+ }
};
diff --git a/app/addons/documents/tests/nightwatch/revBrowser.js b/app/addons/documents/tests/nightwatch/revBrowser.js
index 003a8f4..9674c79 100644
--- a/app/addons/documents/tests/nightwatch/revBrowser.js
+++ b/app/addons/documents/tests/nightwatch/revBrowser.js
@@ -57,6 +57,6 @@ module.exports = {
this.verify.ok(result.value.indexOf('"color": "white"') !== -1, 'check if doc version was promoted');
})
- .end();
+ .end();
}
};
diff --git a/app/addons/documents/tests/nightwatch/selectDocViaTypeahead.js b/app/addons/documents/tests/nightwatch/selectDocViaTypeahead.js
index 87e9bee..a4b1974 100644
--- a/app/addons/documents/tests/nightwatch/selectDocViaTypeahead.js
+++ b/app/addons/documents/tests/nightwatch/selectDocViaTypeahead.js
@@ -32,7 +32,7 @@ module.exports = {
.waitForElementPresent('.Select-option', waitTime, false)
.keys(['\uE015', '\uE015', '\uE006'])
.waitForElementPresent('.panel-button.upload', waitTime, false)
- .end();
+ .end();
},
'Select doc works for capitalised id': function (client) {
@@ -41,7 +41,7 @@ module.exports = {
baseUrl = client.globals.test_settings.launch_url;
client
- .createDocument('MY_CAP_DOC_ID', newDatabaseName, {value: 1, value: 2})
+ .createDocument('MY_CAP_DOC_ID', newDatabaseName, {value: 2})
.loginToGUI()
.url(baseUrl + '/#/database/' + newDatabaseName + '/_all_docs')
.clickWhenVisible('.fonticon-json')
@@ -53,6 +53,6 @@ module.exports = {
.waitForElementPresent('.Select-option', waitTime, false)
.keys(['\uE015', '\uE015', '\uE006'])
.waitForElementPresent('.panel-button.upload', waitTime, false)
- .end();
+ .end();
}
};
diff --git a/app/addons/documents/tests/nightwatch/viewCreate.js b/app/addons/documents/tests/nightwatch/viewCreate.js
index 28a3b7e..dba31d0 100644
--- a/app/addons/documents/tests/nightwatch/viewCreate.js
+++ b/app/addons/documents/tests/nightwatch/viewCreate.js
@@ -32,7 +32,7 @@ module.exports = {
.waitForElementNotPresent('.loading-lines', waitTime, false)
.waitForElementPresent('.table-view-docs', waitTime, false)
.assert.containsText('td[title="blerg"]', 'blerg')
- .end();
+ .end();
},
'Creates a Design Doc using the dropdown at "all documents"': function (client) {
@@ -55,7 +55,7 @@ module.exports = {
.waitForElementNotPresent('.loading-lines', waitTime, false)
.waitForElementPresent('.table-view-docs', waitTime, false)
.assert.containsText('td[title="hasehase"]', 'hasehase')
- .end();
+ .end();
},
'Creates a Design Doc and does not crash after navigating': function (client) {
@@ -80,7 +80,7 @@ module.exports = {
// page now automatically redirects user to results of View. Confirm the new doc is present.
.waitForElementPresent('.table-view-docs', waitTime, false)
.assert.containsText('td[title="hasehase"]', 'hasehase')
- .end();
+ .end();
},
'Creates a Design Doc using the dropdown at "the upper dropdown in the header"': function (client) {
@@ -103,7 +103,7 @@ module.exports = {
.waitForElementNotPresent('.loading-lines', waitTime, false)
.waitForElementPresent('.table-view-docs', waitTime, false)
.assert.containsText('td[title="gansgans"]', 'gansgans')
- .end();
+ .end();
},
'Adds a View to a DDoc using an existing DDoc': function (client) {
@@ -131,7 +131,7 @@ module.exports = {
.waitForElementNotPresent('.loading-lines', waitTime, false)
.waitForElementPresent('.table-view-docs', waitTime, false)
.assert.containsText('td[title="enteente"]', 'enteente')
- .end();
+ .end();
}
};
diff --git a/app/addons/documents/tests/nightwatch/viewCreateBadView.js b/app/addons/documents/tests/nightwatch/viewCreateBadView.js
index d6991dd..66eb74a 100644
--- a/app/addons/documents/tests/nightwatch/viewCreateBadView.js
+++ b/app/addons/documents/tests/nightwatch/viewCreateBadView.js
@@ -17,8 +17,8 @@ module.exports = {
'Displays an error if reduce is not possible': function (client) {
/*jshint multistr: true */
const waitTime = client.globals.maxWaitTime,
- newDatabaseName = client.globals.testDatabaseName,
- baseUrl = client.globals.test_settings.launch_url;
+ newDatabaseName = client.globals.testDatabaseName,
+ baseUrl = client.globals.test_settings.launch_url;
client
.loginToGUI()
@@ -51,8 +51,8 @@ module.exports = {
'Visit url of broken view displays error': function (client) {
const newDatabaseName = client.globals.testDatabaseName,
- baseUrl = client.globals.test_settings.launch_url,
- waitTime = client.globals.maxWaitTime;
+ baseUrl = client.globals.test_settings.launch_url,
+ waitTime = client.globals.maxWaitTime;
client
.loginToGUI()
diff --git a/app/addons/documents/tests/nightwatch/viewEdit.js b/app/addons/documents/tests/nightwatch/viewEdit.js
index 76b8d68..6214a8e 100644
--- a/app/addons/documents/tests/nightwatch/viewEdit.js
+++ b/app/addons/documents/tests/nightwatch/viewEdit.js
@@ -45,7 +45,7 @@ module.exports = {
// confirm the new index name is present
.waitForElementVisible('#testdesigndoc_hasenindex5000', waitTime, false)
- .end();
+ .end();
},
'Edits a design doc': function (client) {
@@ -97,14 +97,14 @@ module.exports = {
.waitForAttribute('#doc-list', 'textContent', function (docContents) {
return (/hasehase6000/).test(docContents);
})
- .end();
+ .end();
},
'Edits two design docs to confirm Map Editor correct on second': function (client) {
/*jshint multistr: true */
var waitTime = client.globals.maxWaitTime,
- newDatabaseName = client.globals.testDatabaseName,
- baseUrl = client.globals.test_settings.launch_url;
+ newDatabaseName = client.globals.testDatabaseName,
+ baseUrl = client.globals.test_settings.launch_url;
client
.deleteDatabase(newDatabaseName)
@@ -188,8 +188,8 @@ module.exports = {
'Editing a view and putting it into a new design doc removes it from the old design doc': function (client) {
var waitTime = client.globals.maxWaitTime,
- newDatabaseName = client.globals.testDatabaseName,
- baseUrl = client.globals.test_settings.launch_url;
+ newDatabaseName = client.globals.testDatabaseName,
+ baseUrl = client.globals.test_settings.launch_url;
client
.deleteDatabase(newDatabaseName)
diff --git a/app/addons/documents/tests/nightwatch/viewQueryOptions.js b/app/addons/documents/tests/nightwatch/viewQueryOptions.js
index d8c419d..f5c7aa2 100644
--- a/app/addons/documents/tests/nightwatch/viewQueryOptions.js
+++ b/app/addons/documents/tests/nightwatch/viewQueryOptions.js
@@ -32,14 +32,14 @@ module.exports = {
.assert.elementNotPresent('#doc-list [data-id="document_2"]')
.assert.elementNotPresent('#doc-list [data-id="document_0"]')
.assert.elementPresent('#doc-list [data-id="document_1"]')
- .end();
+ .end();
},
'Edit view: Queryoptions works querying index with newlines in key field': function (client) {
/*jshint multistr: true */
var waitTime = client.globals.maxWaitTime,
- newDatabaseName = client.globals.testDatabaseName,
- baseUrl = client.globals.test_settings.launch_url;
+ newDatabaseName = client.globals.testDatabaseName,
+ baseUrl = client.globals.test_settings.launch_url;
client
.populateDatabase(newDatabaseName, 3)
diff --git a/app/addons/fauxton/appwrapper.js b/app/addons/fauxton/appwrapper.js
index 2074c77..8510433 100644
--- a/app/addons/fauxton/appwrapper.js
+++ b/app/addons/fauxton/appwrapper.js
@@ -99,4 +99,4 @@ export default class App extends React.Component {
</div>
);
}
-};
+}
diff --git a/app/addons/fauxton/navigation/components/NavLink.js b/app/addons/fauxton/navigation/components/NavLink.js
index 14a9841..6ba591c 100644
--- a/app/addons/fauxton/navigation/components/NavLink.js
+++ b/app/addons/fauxton/navigation/components/NavLink.js
@@ -31,7 +31,7 @@ const NavLink = ({link, active, isMinimized}) => {
<span className="faux-navbar__text">{link.title}</span>;
let linkIcon = null;
- if (!!link.icon) {
+ if (link.icon) {
linkIcon = (
<i className={classNames(
link.icon,
diff --git a/app/addons/fauxton/navigation/stores.js b/app/addons/fauxton/navigation/stores.js
index 0026e43..b3faf39 100644
--- a/app/addons/fauxton/navigation/stores.js
+++ b/app/addons/fauxton/navigation/stores.js
@@ -180,64 +180,64 @@ Stores.NavBarStore = FauxtonAPI.Store.extend({
switch (action.type) {
case ActionTypes.ADD_NAVBAR_LINK:
this.addLink(action.link);
- break;
+ break;
case ActionTypes.TOGGLE_NAVBAR_MENU:
this.toggleMenu();
- break;
+ break;
case ActionTypes.UPDATE_NAVBAR_LINK:
this.updateLink(action.link);
- break;
+ break;
case ActionTypes.CLEAR_NAVBAR_LINK:
this.reset();
- break;
+ break;
case ActionTypes.REMOVE_NAVBAR_LINK:
this.removeLink(action.link);
- break;
+ break;
case ActionTypes.SHOW_NAVBAR_LINK_BADGE:
this.showLinkBadge(action.link);
- break;
+ break;
case ActionTypes.HIDE_NAVBAR_LINK_BADGE:
this.hideLinkBadge(action.link);
- break;
+ break;
case ActionTypes.NAVBAR_SET_VERSION_INFO:
this.setVersion(action.version);
- break;
+ break;
case ActionTypes.NAVBAR_ACTIVE_LINK:
this.setActiveLink(action.name);
- break;
+ break;
case ActionTypes.NAVBAR_HIDE:
this.hideNavBar();
- break;
+ break;
case ActionTypes.NAVBAR_SHOW:
this.showNavBar();
- break;
+ break;
case ActionTypes.NAVBAR_SHOW_HIDE_LOGIN_LOGOUT_SECTION:
this._loginSectionVisible = action.visible;
- break;
+ break;
case ActionTypes.NAVBAR_SHOW_LOGIN_BUTTON:
this._loginSectionVisible = true;
this._loginVisibleInsteadOfLogout = true;
- break;
+ break;
case ActionTypes.NAVBAR_SHOW_LOGOUT_BUTTON:
this._loginSectionVisible = true;
this._loginVisibleInsteadOfLogout = false;
- break;
+ break;
default:
- return;
+ return;
// do nothing
}
diff --git a/app/addons/fauxton/notifications/__tests__/components.test.js b/app/addons/fauxton/notifications/__tests__/components.test.js
index 6cdb98c..829f920 100644
--- a/app/addons/fauxton/notifications/__tests__/components.test.js
+++ b/app/addons/fauxton/notifications/__tests__/components.test.js
@@ -86,7 +86,7 @@ describe('NotificationPanelRow', () => {
isVisible={true}
filter="all"
item={notifications.success}
- />);
+ />);
assert.notOk(row1.find('li').prop('aria-hidden'));
@@ -95,7 +95,7 @@ describe('NotificationPanelRow', () => {
isVisible={true}
filter="all"
item={notifications.error}
- />
+ />
);
assert.notOk(row2.find('li').prop('aria-hidden'));
@@ -111,10 +111,10 @@ describe('NotificationPanelRow', () => {
it('hides notification when filter doesn\'t match', () => {
var rowEl = mount(
<Views.NotificationPanelRow
- style={style}
- isVisible={true}
- filter="success"
- item={notifications.info}
+ style={style}
+ isVisible={true}
+ filter="success"
+ item={notifications.info}
/>);
assert.ok(rowEl.find('li').prop('aria-hidden'));
});
@@ -122,10 +122,10 @@ describe('NotificationPanelRow', () => {
it('shows notification when filter exact match', () => {
const rowEl = mount(
<Views.NotificationPanelRow
- style={style}
- isVisible={true}
- filter="info"
- item={notifications.info}
+ style={style}
+ isVisible={true}
+ filter="info"
+ item={notifications.info}
/>);
assert.notOk(rowEl.find('li').prop('aria-hidden'));
});
diff --git a/app/addons/fauxton/notifications/notifications.js b/app/addons/fauxton/notifications/notifications.js
index 3e0f8f4..7473d0a 100644
--- a/app/addons/fauxton/notifications/notifications.js
+++ b/app/addons/fauxton/notifications/notifications.js
@@ -282,7 +282,7 @@ class Notification extends React.Component {
<div
style={{opacity: style.opacity, minHeight: style.minHeight + 'px'}}
className={'global-notification alert alert-' + this.props.type}
- ref="notification">
+ ref={node => this.notification = node}>
<a data-bypass href="#" onClick={this.hide}><i className="pull-right fonticon-cancel" /></a>
<i className={'notification-icon ' + iconMap[this.props.type]} />
<span dangerouslySetInnerHTML={this.getMsg()}></span>
@@ -325,22 +325,22 @@ class NotificationCenterPanel extends React.Component {
getNotifications = (items) => {
let notifications;
if (!items.length && !this.props.notifications.length) {
- notifications = <li className="no-notifications">
+ notifications = <li className="no-notifications">
No notifications.
- </li>;
+ </li>;
} else {
notifications = items
- .map(({key, data: notification, style}) => {
- return (
- <NotificationPanelRow
- isVisible={this.props.visible}
- item={notification}
- filter={this.props.filter}
- key={key}
- style={style}
- />
- );
- });
+ .map(({key, data: notification, style}) => {
+ return (
+ <NotificationPanelRow
+ isVisible={this.props.visible}
+ item={notification}
+ filter={this.props.filter}
+ key={key}
+ style={style}
+ />
+ );
+ });
}
return (
@@ -352,28 +352,28 @@ class NotificationCenterPanel extends React.Component {
getStyles = (prevItems = []) => {
return this.props.notifications
- .map(notification => {
- let item = prevItems.find(style => style.key === (notification.notificationId.toString()));
- let style = !item ? {opacity: 0, height: 0} : false;
-
- if (!style && (notification.type === this.props.filter || this.props.filter === 'all')) {
- style = {
- opacity: spring(1, presets.stiff),
- height: spring(61, presets.stiff)
- };
- } else if (notification.type !== this.props.filter) {
- style = {
- opacity: spring(0, presets.stiff),
- height: spring(0, presets.stiff)
- };
- }
+ .map(notification => {
+ let item = prevItems.find(style => style.key === (notification.notificationId.toString()));
+ let style = !item ? {opacity: 0, height: 0} : false;
- return {
- key: notification.notificationId.toString(),
- style,
- data: notification
- };
- });
+ if (!style && (notification.type === this.props.filter || this.props.filter === 'all')) {
+ style = {
+ opacity: spring(1, presets.stiff),
+ height: spring(61, presets.stiff)
+ };
+ } else if (notification.type !== this.props.filter) {
+ style = {
+ opacity: spring(0, presets.stiff),
+ height: spring(0, presets.stiff)
+ };
+ }
+
+ return {
+ key: notification.notificationId.toString(),
+ style,
+ data: notification
+ };
+ });
};
render() {
@@ -404,17 +404,17 @@ class NotificationCenterPanel extends React.Component {
<ul className="notification-filter flex-layout flex-row">
<li className={filterClasses.all} title="All notifications" data-filter="all"
- onClick={Actions.selectNotificationFilter.bind(this, 'all')}>All</li>
+ onClick={Actions.selectNotificationFilter.bind(this, 'all')}>All</li>
<li className={filterClasses.success} title="Success notifications" data-filter="success"
- onClick={Actions.selectNotificationFilter.bind(this, 'success')}>
+ onClick={Actions.selectNotificationFilter.bind(this, 'success')}>
<span className="fonticon fonticon-ok-circled" />
</li>
<li className={filterClasses.error} title="Error notifications" data-filter="error"
- onClick={Actions.selectNotificationFilter.bind(this, 'error')}>
+ onClick={Actions.selectNotificationFilter.bind(this, 'error')}>
<span className="fonticon fonticon-attention-circled" />
</li>
<li className={filterClasses.info} title="Info notifications" data-filter="info"
- onClick={Actions.selectNotificationFilter.bind(this, 'info')}>
+ onClick={Actions.selectNotificationFilter.bind(this, 'info')}>
<span className="fonticon fonticon-info-circled" />
</li>
</ul>
diff --git a/app/addons/fauxton/notifications/stores.js b/app/addons/fauxton/notifications/stores.js
index 79f05a0..9d124c7 100644
--- a/app/addons/fauxton/notifications/stores.js
+++ b/app/addons/fauxton/notifications/stores.js
@@ -133,51 +133,51 @@ Stores.NotificationStore = FauxtonAPI.Store.extend({
switch (action.type) {
case ActionTypes.ADD_NOTIFICATION:
this.addNotification(action.options.info);
- break;
+ break;
case ActionTypes.CLEAR_ALL_NOTIFICATIONS:
this.clearNotifications();
- break;
+ break;
case ActionTypes.CLEAR_SINGLE_NOTIFICATION:
this.clearNotification(action.options.notificationId);
- break;
+ break;
case ActionTypes.START_HIDING_NOTIFICATION:
this.startHidingNotification(action.options.notificationId);
- break;
+ break;
case ActionTypes.HIDE_NOTIFICATION:
this.hideNotification(action.options.notificationId);
- break;
+ break;
case ActionTypes.HIDE_ALL_NOTIFICATIONS:
this.hideAllNotifications();
- break;
+ break;
case ActionTypes.SHOW_NOTIFICATION_CENTER:
this._notificationCenterVisible = true;
- break;
+ break;
case ActionTypes.HIDE_NOTIFICATION_CENTER:
this._notificationCenterVisible = false;
- break;
+ break;
case ActionTypes.SELECT_NOTIFICATION_FILTER:
this.setNotificationFilter(action.options.filter);
- break;
+ break;
case ActionTypes.SHOW_PERMANENT_NOTIFICATION:
this._permanentNotificationVisible = true;
this.setPermanentNotificationMessage(action.options.msg);
- break;
+ break;
case ActionTypes.HIDE_PERMANENT_NOTIFICATION:
this._permanentNotificationVisible = false;
- break;
+ break;
default:
- return;
+ return;
// do nothing
}
diff --git a/app/addons/fauxton/tests/nightwatch/highlightsidebar.js b/app/addons/fauxton/tests/nightwatch/highlightsidebar.js
index daa4c59..585f39d 100644
--- a/app/addons/fauxton/tests/nightwatch/highlightsidebar.js
+++ b/app/addons/fauxton/tests/nightwatch/highlightsidebar.js
@@ -25,6 +25,6 @@ module.exports = {
.pause(1000)
.waitForElementVisible('.replication__activity_header-btn', waitTime, false)
.assert.cssClassPresent('a[href="#/replication"]', 'faux-navbar__link--active')
- .end();
+ .end();
}
};
diff --git a/app/addons/fauxton/tests/nightwatch/notificationCenter.js b/app/addons/fauxton/tests/nightwatch/notificationCenter.js
index 8360041..5df5e55 100644
--- a/app/addons/fauxton/tests/nightwatch/notificationCenter.js
+++ b/app/addons/fauxton/tests/nightwatch/notificationCenter.js
@@ -37,6 +37,6 @@ module.exports = {
this.verify.ok(/You\shave\sbeen\slogged\sin\./.test(content),
'Confirming login message appears');
})
- .end();
+ .end();
}
};
diff --git a/app/addons/permissions/actions.js b/app/addons/permissions/actions.js
index 969768b..2b44b49 100644
--- a/app/addons/permissions/actions.js
+++ b/app/addons/permissions/actions.js
@@ -32,22 +32,22 @@ export const fetchPermissions = url => dispatch => {
headers: {'Accept': 'application/json' },
credentials: 'include'
})
- .then((res) => res.json())
- .then(json => {
- if (json.error && json.reason) {
- dispatch(receivedPermissions(
- {admins:{roles:["_admin"]}, members:{roles:["_admin"]}}));
- throw new Error(json.reason);
- }
- dispatch(receivedPermissions(json));
- })
- .catch((err) => {
- FauxtonAPI.addNotification({
- msg: 'Failed to retrieve permissions. Please try again. Reason:'
+ .then((res) => res.json())
+ .then(json => {
+ if (json.error && json.reason) {
+ dispatch(receivedPermissions(
+ {admins:{roles:["_admin"]}, members:{roles:["_admin"]}}));
+ throw new Error(json.reason);
+ }
+ dispatch(receivedPermissions(json));
+ })
+ .catch((err) => {
+ FauxtonAPI.addNotification({
+ msg: 'Failed to retrieve permissions. Please try again. Reason:'
+ err.message,
- type: 'error'
- });
- });
+ type: 'error'
+ });
+ });
};
export const setPermissionOnObject = (p, section, type, value) => {
@@ -106,24 +106,24 @@ export const updatePermissionUnsafe = (url, p, dispatch) => {
method: 'PUT',
body: JSON.stringify(p)
})
- .then((res) => res.json())
- .then((json) => {
- if (!json.ok) {
- throw new Error(json.reason);
- }
- return json;
- })
- .then(() => {
- FauxtonAPI.addNotification({
- msg: 'Database permissions has been updated.'
- });
+ .then((res) => res.json())
+ .then((json) => {
+ if (!json.ok) {
+ throw new Error(json.reason);
+ }
+ return json;
+ })
+ .then(() => {
+ FauxtonAPI.addNotification({
+ msg: 'Database permissions has been updated.'
+ });
- return dispatch(receivedPermissions(p));
- })
- .catch((error) => {
- FauxtonAPI.addNotification({
- msg: 'Could not update permissions - reason: ' + error,
- type: 'error'
+ return dispatch(receivedPermissions(p));
+ })
+ .catch((error) => {
+ FauxtonAPI.addNotification({
+ msg: 'Could not update permissions - reason: ' + error,
+ type: 'error'
+ });
});
- });
};
diff --git a/app/addons/permissions/components/PermissionsItem.js b/app/addons/permissions/components/PermissionsItem.js
index 1097b52..069b77a 100644
--- a/app/addons/permissions/components/PermissionsItem.js
+++ b/app/addons/permissions/components/PermissionsItem.js
@@ -14,7 +14,7 @@ import PropTypes from 'prop-types';
import React from 'react';
-const PermissionsItem = ({removeItem, section, type, value}) =>Â {
+const PermissionsItem = ({removeItem, section, type, value}) => {
return (
<li className="permissions__entry">
diff --git a/app/addons/permissions/components/PermissionsSection.js b/app/addons/permissions/components/PermissionsSection.js
index 73f9577..2ecd4a8 100644
--- a/app/addons/permissions/components/PermissionsSection.js
+++ b/app/addons/permissions/components/PermissionsSection.js
@@ -112,45 +112,45 @@ class PermissionsSection extends React.Component {
const { section } = this.props;
return (
- <div className={"permissions__" + section}>
- <header className="page-header">
- <h3>{section}</h3>
- <p className="help">
- {this.getHelp()}
- <a className="help-link" data-bypass="true" href={getDocUrl('DB_PERMISSION')} target="_blank">
- <i className="icon-question-sign"></i>
- </a>
- </p>
- </header>
- <div className="row-fluid">
- <div className="span6">
- <header>
- <h4>Users</h4>
- <p>Specify users who will have {this.props.section} access to this database.</p>
- </header>
- <form onSubmit={this.addNames} className="permission-item-form permissions-add-user form-inline">
- <input onChange={this.nameChange} value={this.state.newName} type="text" className="item input-small" placeholder="Username" />
- <button type="submit" className="btn btn-primary"><i className="icon fonticon-plus-circled" /> Add User</button>
- </form>
- <ul className="unstyled permission-items span10">
- {this.getNames()}
- </ul>
- </div>
- <div className="span6">
- <header>
- <h4>Roles</h4>
- <p>Users with any of the following role(s) will have {this.props.section} access.</p>
- </header>
- <form onSubmit={this.addRoles} className="permission-item-form permissions-add-role form-inline">
- <input onChange={this.roleChange} value={this.state.newRole} type="text" className="item input-small" placeholder="Role" />
- <button type="submit" className="btn btn-primary"><i className="icon fonticon-plus-circled" /> Add Role</button>
- </form>
- <ul className="unstyled permission-items span10">
- {this.getRoles()}
- </ul>
+ <div className={"permissions__" + section}>
+ <header className="page-header">
+ <h3>{section}</h3>
+ <p className="help">
+ {this.getHelp()}
+ <a className="help-link" data-bypass="true" href={getDocUrl('DB_PERMISSION')} target="_blank">
+ <i className="icon-question-sign"></i>
+ </a>
+ </p>
+ </header>
+ <div className="row-fluid">
+ <div className="span6">
+ <header>
+ <h4>Users</h4>
+ <p>Specify users who will have {this.props.section} access to this database.</p>
+ </header>
+ <form onSubmit={this.addNames} className="permission-item-form permissions-add-user form-inline">
+ <input onChange={this.nameChange} value={this.state.newName} type="text" className="item input-small" placeholder="Username" />
+ <button type="submit" className="btn btn-primary"><i className="icon fonticon-plus-circled" /> Add User</button>
+ </form>
+ <ul className="unstyled permission-items span10">
+ {this.getNames()}
+ </ul>
+ </div>
+ <div className="span6">
+ <header>
+ <h4>Roles</h4>
+ <p>Users with any of the following role(s) will have {this.props.section} access.</p>
+ </header>
+ <form onSubmit={this.addRoles} className="permission-item-form permissions-add-role form-inline">
+ <input onChange={this.roleChange} value={this.state.newRole} type="text" className="item input-small" placeholder="Role" />
+ <button type="submit" className="btn btn-primary"><i className="icon fonticon-plus-circled" /> Add Role</button>
+ </form>
+ <ul className="unstyled permission-items span10">
+ {this.getRoles()}
+ </ul>
+ </div>
</div>
</div>
- </div>
);
}
}
diff --git a/app/addons/permissions/reducers.js b/app/addons/permissions/reducers.js
index 3bf70b7..20bb27d 100644
--- a/app/addons/permissions/reducers.js
+++ b/app/addons/permissions/reducers.js
@@ -41,7 +41,7 @@ export default function permissions (state = initialState, action) {
default:
return state;
}
-};
+}
function getRoles (type, permissions) {
if (!permissions[type]) {
diff --git a/app/addons/replication/__tests__/api.tests.js b/app/addons/replication/__tests__/api.tests.js
index 7fe2982..e7f31b0 100644
--- a/app/addons/replication/__tests__/api.tests.js
+++ b/app/addons/replication/__tests__/api.tests.js
@@ -34,22 +34,22 @@ describe('Replication API', () => {
describe("removeSensiteiveUrlInfo", () => {
it('removes password username', () => {
- const url = 'http://tester:testerpass@127.0.0.1/fancy/db/name';
+ const url = 'http://tester:testerpass@127.0.0.1/fancy/db/name';
- const res = removeSensitiveUrlInfo(url);
+ const res = removeSensitiveUrlInfo(url);
- expect(res).toBe('http://127.0.0.1/fancy/db/name');
- });
+ expect(res).toBe('http://127.0.0.1/fancy/db/name');
+ });
- // see https://issues.apache.org/jira/browse/COUCHDB-3257
- // CouchDB accepts and returns invalid urls
- it('does not throw on invalid urls', () => {
- const url = 'http://tester:tes#terpass@127.0.0.1/fancy/db/name';
+ // see https://issues.apache.org/jira/browse/COUCHDB-3257
+ // CouchDB accepts and returns invalid urls
+ it('does not throw on invalid urls', () => {
+ const url = 'http://tester:tes#terpass@127.0.0.1/fancy/db/name';
- const res = removeSensitiveUrlInfo(url);
+ const res = removeSensitiveUrlInfo(url);
- expect(res).toBe('http://tester:tes#terpass@127.0.0.1/fancy/db/name');
- });
+ expect(res).toBe('http://tester:tes#terpass@127.0.0.1/fancy/db/name');
+ });
});
describe('getSource', () => {
@@ -312,9 +312,9 @@ describe('Replication API', () => {
it('returns true for support', () => {
fetchMock.getOnce('/_scheduler/jobs', {});
return supportNewApi(true)
- .then(resp => {
- assert.ok(resp);
- });
+ .then(resp => {
+ assert.ok(resp);
+ });
});
it('returns false for no support', () => {
@@ -324,9 +324,9 @@ describe('Replication API', () => {
});
return supportNewApi(true)
- .then(resp => {
- assert.notOk(resp);
- });
+ .then(resp => {
+ assert.notOk(resp);
+ });
});
});
@@ -336,31 +336,31 @@ describe('Replication API', () => {
"total_rows":2,
"offset":0,
"rows":[
- {
- "id":"_design/_replicator",
- "key":"_design/_replicator",
- "value":{
- "rev":"1-1390740c4877979dbe8998382876556c"
- },
- "doc":{"_id":"_design/_replicator",
+ {
+ "id":"_design/_replicator",
+ "key":"_design/_replicator",
+ "value":{
+ "rev":"1-1390740c4877979dbe8998382876556c"
+ },
+ "doc":{"_id":"_design/_replicator",
"_rev":"1-1390740c4877979dbe8998382876556c",
"language":"javascript",
"validate_doc_update":"\n function(newDoc, oldDoc, userCtx) {\n function reportError(error_msg) {\n log('Error writing document `' + newDoc._id +\n '\\' to the replicator database: ' + error_msg);\n throw({forbidden: error_msg});\n }\n\n function validateEndpoint(endpoint, fieldName) {\n if ((typeof endpoint !== 'string') &&\n ((typeof endpoint !== 'object') || (endpoint === null))) {\n\n [...]
}
},
- {
- "id":"_design/filters",
- "key":"_design/filters",
- "value":{
- "rev":"1-1390740c4877979dbe8998382876556c"
- },
- "doc":{
- "_id":"_design/filters",
- "_rev":"1-1390740c4877979dbe8998382876556c",
- "filters": {
- "afilter": "\n function (doc, req) { if (doc.type === 'a-doc') { return true; } \n return false }"
- }
+ {
+ "id":"_design/filters",
+ "key":"_design/filters",
+ "value":{
+ "rev":"1-1390740c4877979dbe8998382876556c"
+ },
+ "doc":{
+ "_id":"_design/filters",
+ "_rev":"1-1390740c4877979dbe8998382876556c",
+ "filters": {
+ "afilter": "\n function (doc, req) { if (doc.type === 'a-doc') { return true; } \n return false }"
}
+ }
},
{
"id":"c94d4839d1897105cb75e1251e0003ea",
@@ -369,38 +369,38 @@ describe('Replication API', () => {
"rev":"3-4559cb522de85ce03bd0e1991025e89a"
},
"doc":{"_id":"c94d4839d1897105cb75e1251e0003ea",
- "_rev":"3-4559cb522de85ce03bd0e1991025e89a",
- "user_ctx":{
- "name":"tester",
- "roles":["_admin", "_reader", "_writer"]},
+ "_rev":"3-4559cb522de85ce03bd0e1991025e89a",
+ "user_ctx":{
+ "name":"tester",
+ "roles":["_admin", "_reader", "_writer"]},
"source":{
"headers":{
"Authorization":"Basic dGVzdGVyOnRlc3RlcnBhc3M="
},
"url":"http://dev:5984/animaldb"},
- "target":{
- "headers":{
- "Authorization":"Basic dGVzdGVyOnRlc3RlcnBhc3M="},
- "url":"http://dev:5984/animaldb-clone"
- },
- "create_target":true,
- "continuous":false,
- "owner":"tester",
- "_replication_state":"completed",
- "_replication_state_time":"2017-02-28T12:16:28+00:00",
- "_replication_id":"0ce2939af29317b5dbe11c15570ddfda",
- "_replication_stats":{
- "revisions_checked":14,
- "missing_revisions_found":14,
- "docs_read":14,
- "docs_written":14,
- "changes_pending":null,
- "doc_write_failures":0,
- "checkpointed_source_seq":"15-g1AAAAJDeJyV0N0NgjAQAOAKRnlzBJ3AcKWl9Uk20ZbSEII4gm6im-gmugke1AQJ8aFpck3u50vuakJIVIaGrJqzKSADKrYxPqixECii123bVmWoFidMLGVsqEjYtP0voTcY9f6rzHqFKcglsz5K1imHkcJTnoJVPsqxUy4jxepEioJ7KM0cI7nih9BtkDSlkAif2zjp7qRHJwW9lLNdDkZ6S08nvQZJMsNT4b_d20k_d4oVE1aK6VT1AXTajes"
- }
+ "target":{
+ "headers":{
+ "Authorization":"Basic dGVzdGVyOnRlc3RlcnBhc3M="},
+ "url":"http://dev:5984/animaldb-clone"
+ },
+ "create_target":true,
+ "continuous":false,
+ "owner":"tester",
+ "_replication_state":"completed",
+ "_replication_state_time":"2017-02-28T12:16:28+00:00",
+ "_replication_id":"0ce2939af29317b5dbe11c15570ddfda",
+ "_replication_stats":{
+ "revisions_checked":14,
+ "missing_revisions_found":14,
+ "docs_read":14,
+ "docs_written":14,
+ "changes_pending":null,
+ "doc_write_failures":0,
+ "checkpointed_source_seq":"15-g1AAAAJDeJyV0N0NgjAQAOAKRnlzBJ3AcKWl9Uk20ZbSEII4gm6im-gmugke1AQJ8aFpck3u50vuakJIVIaGrJqzKSADKrYxPqixECii123bVmWoFidMLGVsqEjYtP0voTcY9f6rzHqFKcglsz5K1imHkcJTnoJVPsqxUy4jxepEioJ7KM0cI7nih9BtkDSlkAif2zjp7qRHJwW9lLNdDkZ6S08nvQZJMsNT4b_d20k_d4oVE1aK6VT1AXTajes"
}
+ }
}
- ]};
+ ]};
const _schedDocs = {
"offset": 0,
@@ -419,9 +419,9 @@ describe('Replication API', () => {
"changes_pending":null,
"doc_write_failures":0,
"checkpointed_source_seq":"56-g1AAAAGweJzLYWBgYMlgTmFQTElKzi9KdUhJMjTQy00tyixJTE_VS87JL01JzCvRy0styQEqZUpkSLL___9_VgZzIm8uUIDd1NIkNSk5LYVBAW6AKXb9aLYY47ElyQFIJtVDLeIBW2ScbGJiYGJKjBloNhnisSmPBUgyNAApoGX7QbaJg21LTDEwNE8zR_aWCVGW4VCFZNkBiGVgr3GALTNLSzQ0T0xEtgyHm7MAbEaMZw"},
- "last_updated":"2017-03-07T14:46:17Z",
- "start_time":"2017-03-07T14:46:16Z"
- }
+ "last_updated":"2017-03-07T14:46:17Z",
+ "start_time":"2017-03-07T14:46:16Z"
+ }
],
"total": 1
};
@@ -435,11 +435,11 @@ describe('Replication API', () => {
fetchMock.getOnce('/_scheduler/jobs', 404);
fetchMock.get('/_replicator/_all_docs?include_docs=true&limit=100', _repDocs);
return supportNewApi(true)
- .then(fetchReplicationDocs)
- .then(docs => {
- assert.deepEqual(docs.length, 1);
- assert.deepEqual(docs[0]._id, "c94d4839d1897105cb75e1251e0003ea");
- });
+ .then(fetchReplicationDocs)
+ .then(docs => {
+ assert.deepEqual(docs.length, 1);
+ assert.deepEqual(docs[0]._id, "c94d4839d1897105cb75e1251e0003ea");
+ });
});
});
@@ -453,12 +453,12 @@ describe('Replication API', () => {
fetchMock.get('/_replicator/_all_docs?include_docs=true&limit=100', _repDocs);
fetchMock.get('/_scheduler/docs?include_docs=true', _schedDocs);
return supportNewApi(true)
- .then(fetchReplicationDocs)
- .then(docs => {
- assert.deepEqual(docs.length, 1);
- assert.deepEqual(docs[0]._id, "c94d4839d1897105cb75e1251e0003ea");
- assert.deepEqual(docs[0].stateTime.toDateString(), (new Date('2017-03-07T14:46:17')).toDateString());
- });
+ .then(fetchReplicationDocs)
+ .then(docs => {
+ assert.deepEqual(docs.length, 1);
+ assert.deepEqual(docs[0]._id, "c94d4839d1897105cb75e1251e0003ea");
+ assert.deepEqual(docs[0].stateTime.toDateString(), (new Date('2017-03-07T14:46:17')).toDateString());
+ });
});
});
});
diff --git a/app/addons/replication/__tests__/newreplication.test.js b/app/addons/replication/__tests__/newreplication.test.js
index 2d5120d..7103a27 100644
--- a/app/addons/replication/__tests__/newreplication.test.js
+++ b/app/addons/replication/__tests__/newreplication.test.js
@@ -42,7 +42,7 @@ describe('New Replication Component', () => {
clearReplicationForm={() => {}}
hideConflictModal={() => {}}
updateFormField={() => { return () => {}; }}
- />);
+ />);
assert.ok(newreplication.instance().validate());
});
@@ -62,7 +62,7 @@ describe('New Replication Component', () => {
clearReplicationForm={() => {}}
hideConflictModal={() => {}}
updateFormField={() => { return () => {}; }}
- />);
+ />);
assert.ok(newreplication.instance().validate());
});
@@ -84,7 +84,7 @@ describe('New Replication Component', () => {
clearReplicationForm={() => {}}
hideConflictModal={() => {}}
updateFormField={() => { return () => {}; }}
- />);
+ />);
newreplication.instance().validate();
assert.ok(spy.calledOnce);
@@ -110,7 +110,7 @@ describe('New Replication Component', () => {
clearReplicationForm={() => {}}
hideConflictModal={() => {}}
updateFormField={() => { return () => {}; }}
- />);
+ />);
newreplication.instance().validate();
assert.ok(spy.calledOnce);
@@ -136,7 +136,7 @@ describe('New Replication Component', () => {
clearReplicationForm={() => {}}
hideConflictModal={() => {}}
updateFormField={() => { return () => {}; }}
- />);
+ />);
newreplication.instance().validate();
assert.ok(spy.calledOnce);
@@ -162,7 +162,7 @@ describe('New Replication Component', () => {
clearReplicationForm={() => {}}
hideConflictModal={() => {}}
updateFormField={() => { return () => {}; }}
- />);
+ />);
newreplication.instance().validate();
assert.ok(spy.calledOnce);
@@ -189,7 +189,7 @@ describe('New Replication Component', () => {
clearReplicationForm={() => {}}
hideConflictModal={() => {}}
updateFormField={() => { return () => {}; }}
- />);
+ />);
assert.notOk(newreplication.instance().confirmButtonEnabled());
});
@@ -212,7 +212,7 @@ describe('New Replication Component', () => {
clearReplicationForm={() => {}}
hideConflictModal={() => {}}
updateFormField={() => { return () => {}; }}
- />);
+ />);
assert.notOk(newreplication.instance().confirmButtonEnabled());
});
@@ -235,7 +235,7 @@ describe('New Replication Component', () => {
clearReplicationForm={() => {}}
hideConflictModal={() => {}}
updateFormField={() => { return () => {}; }}
- />);
+ />);
assert.notOk(newreplication.instance().confirmButtonEnabled());
@@ -259,7 +259,7 @@ describe('New Replication Component', () => {
clearReplicationForm={() => {}}
hideConflictModal={() => {}}
updateFormField={() => { return () => {}; }}
- />);
+ />);
assert.ok(newreplication.instance().confirmButtonEnabled());
@@ -296,7 +296,7 @@ describe('New Replication Component', () => {
clearReplicationForm={() => {}}
hideConflictModal={() => {}}
updateFormField={() => { return () => {}; }}
- />);
+ />);
newreplication.instance().runReplicationChecks();
});
@@ -324,7 +324,7 @@ describe('New Replication Component', () => {
clearReplicationForm={() => {}}
hideConflictModal={() => {}}
updateFormField={() => { return () => {}; }}
- />);
+ />);
newreplication.instance().showPasswordModal = showPasswordModal;
newreplication.instance().runReplicationChecks();
diff --git a/app/addons/replication/actions.js b/app/addons/replication/actions.js
index 83abb24..b12ffd7 100644
--- a/app/addons/replication/actions.js
+++ b/app/addons/replication/actions.js
@@ -42,15 +42,15 @@ function initReplicator (localSource) {
'Content-Type': 'application/json'
},
})
- .then(resp => resp.json())
- .then((databases) => {
- FauxtonAPI.dispatch({
- type: ActionTypes.REPLICATION_DATABASES_LOADED,
- options: {
- databases: databases
- }
+ .then(resp => resp.json())
+ .then((databases) => {
+ FauxtonAPI.dispatch({
+ type: ActionTypes.REPLICATION_DATABASES_LOADED,
+ options: {
+ databases: databases
+ }
+ });
});
- });
}
export const replicate = (params) => {
@@ -60,12 +60,12 @@ export const replicate = (params) => {
method: 'POST',
credentials: 'include',
headers: {
- 'Accept': 'application/json; charset=utf-8',
- 'Content-Type': 'application/json'
+ 'Accept': 'application/json; charset=utf-8',
+ 'Content-Type': 'application/json'
},
body: JSON.stringify(replicationDoc)
})
- .then(res => res.json());
+ .then(res => res.json());
const source = Helpers.getDatabaseLabel(replicationDoc.source);
const target = Helpers.getDatabaseLabel(replicationDoc.target);
@@ -94,16 +94,16 @@ export const replicate = (params) => {
clear: true
});
})
- .catch(json => {
- if (json.error && json.error === "not_found") {
- return createReplicatorDB().then(() => {
- return replicate(params);
- })
- .catch(handleError);
- }
+ .catch(json => {
+ if (json.error && json.error === "not_found") {
+ return createReplicatorDB().then(() => {
+ return replicate(params);
+ })
+ .catch(handleError);
+ }
- handleError(json);
- });
+ handleError(json);
+ });
};
function updateFormField (fieldName, value) {
@@ -122,7 +122,7 @@ function clearReplicationForm () {
const getReplicationActivity = (supportNewApi) => {
FauxtonAPI.dispatch({
- type: ActionTypes.REPLICATION_FETCHING_STATUS,
+ type: ActionTypes.REPLICATION_FETCHING_STATUS,
});
fetchReplicationDocs(supportNewApi).then(docs => {
@@ -135,23 +135,23 @@ const getReplicationActivity = (supportNewApi) => {
const getReplicateActivity = () => {
supportNewApi()
- .then(newApi => {
- if (!newApi) {
- return;
- }
-
- FauxtonAPI.dispatch({
- type: ActionTypes.REPLICATION_FETCHING_REPLICATE_STATUS,
- });
+ .then(newApi => {
+ if (!newApi) {
+ return;
+ }
- fetchReplicateInfo()
- .then(replicateInfo => {
FauxtonAPI.dispatch({
- type: ActionTypes.REPLICATION_REPLICATE_STATUS,
- options: replicateInfo
+ type: ActionTypes.REPLICATION_FETCHING_REPLICATE_STATUS,
});
+
+ fetchReplicateInfo()
+ .then(replicateInfo => {
+ FauxtonAPI.dispatch({
+ type: ActionTypes.REPLICATION_REPLICATE_STATUS,
+ options: replicateInfo
+ });
+ });
});
- });
};
const filterDocs = (filter) => {
@@ -228,40 +228,40 @@ export const deleteDocs = (docs) => {
method: 'POST',
body: JSON.stringify({docs: bulkDocs})
})
- .then(resp => {
- if (!resp.ok) {
- throw resp;
- }
- return resp.json();
- })
- .then(() => {
-
- let msg = 'The selected documents have been deleted.';
- if (docs.length === 1) {
- msg = `Document <code>${docs[0]._id}</code> has been deleted`;
- }
+ .then(resp => {
+ if (!resp.ok) {
+ throw resp;
+ }
+ return resp.json();
+ })
+ .then(() => {
- FauxtonAPI.addNotification({
- msg: msg,
- type: 'success',
- escape: false,
- clear: true
- });
+ let msg = 'The selected documents have been deleted.';
+ if (docs.length === 1) {
+ msg = `Document <code>${docs[0]._id}</code> has been deleted`;
+ }
- clearSelectedDocs();
- getReplicationActivity();
- })
- .catch(resp => {
- resp.json()
- .then(error => {
FauxtonAPI.addNotification({
- msg: error.reason,
- type: 'error',
+ msg: msg,
+ type: 'success',
+ escape: false,
clear: true
});
- });
- });
+ clearSelectedDocs();
+ getReplicationActivity();
+ })
+ .catch(resp => {
+ resp.json()
+ .then(error => {
+ FauxtonAPI.addNotification({
+ msg: error.reason,
+ type: 'error',
+ clear: true
+ });
+ });
+
+ });
};
const deleteReplicates = (replicates) => {
@@ -273,29 +273,29 @@ const deleteReplicates = (replicates) => {
});
deleteReplicatesApi(replicates)
- .then(() => {
- let msg = 'The selected replications have been deleted.';
- if (replicates.length === 1) {
- msg = `Replication <code>${replicates[0]._id}</code> has been deleted`;
- }
+ .then(() => {
+ let msg = 'The selected replications have been deleted.';
+ if (replicates.length === 1) {
+ msg = `Replication <code>${replicates[0]._id}</code> has been deleted`;
+ }
- clearSelectedReplicates();
- getReplicateActivity();
+ clearSelectedReplicates();
+ getReplicateActivity();
- FauxtonAPI.addNotification({
- msg: msg,
- type: 'success',
- escape: false,
- clear: true
- });
- }, (xhr) => {
- const errorMessage = JSON.parse(xhr.responseText);
- FauxtonAPI.addNotification({
- msg: errorMessage.reason,
- type: 'error',
- clear: true
+ FauxtonAPI.addNotification({
+ msg: msg,
+ type: 'success',
+ escape: false,
+ clear: true
+ });
+ }, (xhr) => {
+ const errorMessage = JSON.parse(xhr.responseText);
+ FauxtonAPI.addNotification({
+ msg: errorMessage.reason,
+ type: 'error',
+ clear: true
+ });
});
- });
};
export const getReplicationStateFrom = (id) => {
@@ -310,47 +310,47 @@ export const getReplicationStateFrom = (id) => {
},
method: 'GET'
})
- .then(resp => resp.json())
- .then((doc) => {
- const stateDoc = {
- replicationDocName: doc._id,
- replicationType: doc.continuous ? Constants.REPLICATION_TYPE.CONTINUOUS : Constants.REPLICATION_TYPE.ONE_TIME,
- };
-
- const sourceUrl = _.isObject(doc.source) ? doc.source.url : doc.source;
- const targetUrl = _.isObject(doc.target) ? doc.target.url : doc.target;
-
- if (sourceUrl.indexOf(window.location.hostname) > -1) {
- const url = new URL(sourceUrl);
- stateDoc.replicationSource = Constants.REPLICATION_SOURCE.LOCAL;
- stateDoc.localSource = decodeURIComponent(url.pathname.slice(1));
- } else {
- stateDoc.replicationSource = Constants.REPLICATION_SOURCE.REMOTE;
- stateDoc.remoteSource = decodeFullUrl(sourceUrl);
- }
+ .then(resp => resp.json())
+ .then((doc) => {
+ const stateDoc = {
+ replicationDocName: doc._id,
+ replicationType: doc.continuous ? Constants.REPLICATION_TYPE.CONTINUOUS : Constants.REPLICATION_TYPE.ONE_TIME,
+ };
+
+ const sourceUrl = _.isObject(doc.source) ? doc.source.url : doc.source;
+ const targetUrl = _.isObject(doc.target) ? doc.target.url : doc.target;
+
+ if (sourceUrl.indexOf(window.location.hostname) > -1) {
+ const url = new URL(sourceUrl);
+ stateDoc.replicationSource = Constants.REPLICATION_SOURCE.LOCAL;
+ stateDoc.localSource = decodeURIComponent(url.pathname.slice(1));
+ } else {
+ stateDoc.replicationSource = Constants.REPLICATION_SOURCE.REMOTE;
+ stateDoc.remoteSource = decodeFullUrl(sourceUrl);
+ }
- if (targetUrl.indexOf(window.location.hostname) > -1) {
- const url = new URL(targetUrl);
- stateDoc.replicationTarget = Constants.REPLICATION_TARGET.EXISTING_LOCAL_DATABASE;
- stateDoc.localTarget = decodeURIComponent(url.pathname.slice(1));
- } else {
- stateDoc.replicationTarget = Constants.REPLICATION_TARGET.EXISTING_REMOTE_DATABASE;
- stateDoc.remoteTarget = decodeFullUrl(targetUrl);
- }
+ if (targetUrl.indexOf(window.location.hostname) > -1) {
+ const url = new URL(targetUrl);
+ stateDoc.replicationTarget = Constants.REPLICATION_TARGET.EXISTING_LOCAL_DATABASE;
+ stateDoc.localTarget = decodeURIComponent(url.pathname.slice(1));
+ } else {
+ stateDoc.replicationTarget = Constants.REPLICATION_TARGET.EXISTING_REMOTE_DATABASE;
+ stateDoc.remoteTarget = decodeFullUrl(targetUrl);
+ }
- FauxtonAPI.dispatch({
- type: ActionTypes.REPLICATION_SET_STATE_FROM_DOC,
- options: stateDoc
- });
+ FauxtonAPI.dispatch({
+ type: ActionTypes.REPLICATION_SET_STATE_FROM_DOC,
+ options: stateDoc
+ });
- })
- .catch(error => {
- FauxtonAPI.addNotification({
- msg: error.reason,
- type: 'error',
- clear: true
+ })
+ .catch(error => {
+ FauxtonAPI.addNotification({
+ msg: error.reason,
+ type: 'error',
+ clear: true
+ });
});
- });
};
const showConflictModal = () => {
diff --git a/app/addons/replication/api.js b/app/addons/replication/api.js
index 8db1204..723f396 100644
--- a/app/addons/replication/api.js
+++ b/app/addons/replication/api.js
@@ -22,12 +22,12 @@ export const supportNewApi = (forceCheck) => {
if (!newApiPromise || forceCheck) {
newApiPromise = new FauxtonAPI.Promise((resolve) => {
get('/_scheduler/jobs', {raw: true})
- .then(resp => {
- if (resp.status > 202) {
- return resolve(false);
- }
- resolve(true);
- });
+ .then(resp => {
+ if (resp.status > 202) {
+ return resolve(false);
+ }
+ resolve(true);
+ });
});
}
@@ -120,7 +120,6 @@ export const getTarget = ({
replicationTarget,
localTarget,
remoteTarget,
- replicationSource,
username,
password
},
@@ -149,7 +148,7 @@ export const createTarget = (replicationTarget) => {
if (_.includes([
Constants.REPLICATION_TARGET.NEW_LOCAL_DATABASE,
Constants.REPLICATION_TARGET.NEW_REMOTE_DATABASE],
- replicationTarget)) {
+ replicationTarget)) {
return true;
}
@@ -285,50 +284,50 @@ export const combineDocsAndScheduler = (docs, schedulerDocs) => {
export const fetchReplicationDocs = () => {
return supportNewApi()
- .then(newApi => {
- const docsPromise = get('/_replicator/_all_docs?include_docs=true&limit=100')
- .then((res) => {
- if (res.error) {
- return [];
+ .then(newApi => {
+ const docsPromise = get('/_replicator/_all_docs?include_docs=true&limit=100')
+ .then((res) => {
+ if (res.error) {
+ return [];
+ }
+
+ return parseReplicationDocs(res.rows.filter(row => row.id.indexOf("_design/") === -1));
+ });
+
+ if (!newApi) {
+ return docsPromise;
}
-
- return parseReplicationDocs(res.rows.filter(row => row.id.indexOf("_design/") === -1));
- });
-
- if (!newApi) {
- return docsPromise;
- }
- const schedulerPromise = fetchSchedulerDocs();
- return FauxtonAPI.Promise.join(docsPromise, schedulerPromise, (docs, schedulerDocs) => {
- return combineDocsAndScheduler(docs, schedulerDocs);
- })
- .catch(() => {
- return [];
+ const schedulerPromise = fetchSchedulerDocs();
+ return FauxtonAPI.Promise.join(docsPromise, schedulerPromise, (docs, schedulerDocs) => {
+ return combineDocsAndScheduler(docs, schedulerDocs);
+ })
+ .catch(() => {
+ return [];
+ });
});
- });
};
export const fetchSchedulerDocs = () => {
return get('/_scheduler/docs?include_docs=true')
- .then((res) => {
- if (res.error) {
- return [];
- }
+ .then((res) => {
+ if (res.error) {
+ return [];
+ }
- return res.docs;
- });
+ return res.docs;
+ });
};
export const checkReplicationDocID = (docId) => {
return new Promise((resolve) => {
get(`/_replicator/${docId}`)
- .then(resp => {
- if (resp.error === "not_found") {
- resolve(false);
- return;
- }
- resolve(true);
- });
+ .then(resp => {
+ if (resp.error === "not_found") {
+ resolve(false);
+ return;
+ }
+ resolve(true);
+ });
});
};
@@ -352,16 +351,16 @@ export const parseReplicateInfo = (resp) => {
export const fetchReplicateInfo = () => {
return supportNewApi()
- .then(newApi => {
- if (!newApi) {
- return [];
- }
+ .then(newApi => {
+ if (!newApi) {
+ return [];
+ }
- return get('/_scheduler/jobs')
- .then(resp => {
- return parseReplicateInfo(resp);
+ return get('/_scheduler/jobs')
+ .then(resp => {
+ return parseReplicateInfo(resp);
+ });
});
- });
};
export const deleteReplicatesApi = (replicates) => {
diff --git a/app/addons/replication/components/activity.js b/app/addons/replication/components/activity.js
index 1641913..0d1ae98 100644
--- a/app/addons/replication/components/activity.js
+++ b/app/addons/replication/components/activity.js
@@ -96,7 +96,7 @@ export default class Activity extends React.Component {
visible={modalVisible}
onClose={this.closeModal.bind(this)}
onClick={this.confirmDeleteDocs.bind(this)}
- />
+ />
</div>
);
}
diff --git a/app/addons/replication/components/common-table.js b/app/addons/replication/components/common-table.js
index 3912261..1365817 100644
--- a/app/addons/replication/components/common-table.js
+++ b/app/addons/replication/components/common-table.js
@@ -23,8 +23,7 @@ export const formatUrl = (url) => {
try {
urlObj = new URL(removeCredentialsFromUrl(url));
encoded = encodeURIComponent(urlObj.pathname.slice(1));
- } catch (error) {
- console.log('error with url', url);
+ } catch (e) {
return '';
}
@@ -124,7 +123,7 @@ const RowActions = ({onlyDeleteAction, _id, url, deleteDocs}) => {
className="replication__row-btn icon-wrench replication__row-btn--no-left-pad"
title={'Edit replication'}
data-bypass="true"
- >
+ >
</a>
</li>
);
@@ -135,7 +134,7 @@ const RowActions = ({onlyDeleteAction, _id, url, deleteDocs}) => {
title={'Edit replication document'}
href={url}
data-bypass="true"
- >
+ >
</a>
</li>
);
@@ -188,10 +187,10 @@ const Row = ({
if (showStateRow) {
stateRow = <RowStatus
- statusTime={statusTime}
- status={status}
- errorMsg={errorMsg}
- />;
+ statusTime={statusTime}
+ status={status}
+ errorMsg={errorMsg}
+ />;
}
return (
@@ -210,7 +209,7 @@ const Row = ({
url={url}
error={status === "error" || status === 'retrying'}
errorMsg={errorMsg}
- />
+ />
</td>
</tr>
@@ -247,7 +246,7 @@ const BulkSelectHeader = ({isSelected, deleteDocs, someDocsSelected, onCheck}) =
<div className="replication__bulk-select-header">
<input className="replication__bulk-select-input" checked={isSelected} type="checkbox" onChange={onCheck} />
</div>
- {trash}
+ {trash}
</div>
);
};
@@ -380,7 +379,7 @@ export class ReplicationTable extends React.Component {
onCheck={this.props.selectAllDocs}
someDocsSelected={this.props.someDocsSelected}
deleteDocs={this.props.deleteDocs}
- />
+ />
</th>
<th className="replication__table-header-source" onClick={this.onSort('source')}>
Source
diff --git a/app/addons/replication/components/newreplication.js b/app/addons/replication/components/newreplication.js
index d09dfd0..1b64008 100644
--- a/app/addons/replication/components/newreplication.js
+++ b/app/addons/replication/components/newreplication.js
@@ -122,15 +122,15 @@ export default class NewReplicationController extends React.Component {
//check that source and target are not the same. They can trigger a false positive if they are ""
if ((remoteTarget === remoteSource && !isEmpty(remoteTarget))
- || (localSource === localTarget && !isEmpty(localSource))) {
- FauxtonAPI.addNotification({
- msg: 'Cannot replicate a database to itself',
- type: 'error',
- escape: false,
- clear: true
- });
+ || (localSource === localTarget && !isEmpty(localSource))) {
+ FauxtonAPI.addNotification({
+ msg: 'Cannot replicate a database to itself',
+ type: 'error',
+ escape: false,
+ clear: true
+ });
- return false;
+ return false;
}
return true;
@@ -209,8 +209,8 @@ export default class NewReplicationController extends React.Component {
}
render () {
- const {
- replicationSource,
+ const {
+ replicationSource,
replicationTarget,
replicationType,
replicationDocName,
@@ -269,7 +269,7 @@ export default class NewReplicationController extends React.Component {
onClick={this.showPasswordModal}
onClose={this.props.hideConflictModal}
docId={replicationDocName}
- />
+ />
</div>
);
}
diff --git a/app/addons/replication/components/options.js b/app/addons/replication/components/options.js
index 9690bac..f00ac2e 100644
--- a/app/addons/replication/components/options.js
+++ b/app/addons/replication/components/options.js
@@ -47,22 +47,22 @@ ReplicationType.propTypes = {
};
const ReplicationDoc = ({value, onChange}) =>
-<div className="replication__section">
- <div className="replication__input-label">
+ <div className="replication__section">
+ <div className="replication__input-label">
Replication Document:
- </div>
- <div className="replication__doc-name">
- <span className="fonticon fonticon-cancel replication__doc-name-icon" title="Clear field"
- onClick={() => onChange('')} />
- <input
- type="text"
- className="replication__doc-name-input"
- placeholder="Custom ID (optional)"
- value={value}
- onChange={(e) => onChange(e.target.value)}
- />
- </div>
-</div>;
+ </div>
+ <div className="replication__doc-name">
+ <span className="fonticon fonticon-cancel replication__doc-name-icon" title="Clear field"
+ onClick={() => onChange('')} />
+ <input
+ type="text"
+ className="replication__doc-name-input"
+ placeholder="Custom ID (optional)"
+ value={value}
+ onChange={(e) => onChange(e.target.value)}
+ />
+ </div>
+ </div>;
ReplicationDoc.propTypes = {
value: PropTypes.string.isRequired,
diff --git a/app/addons/replication/components/replicate-activity.js b/app/addons/replication/components/replicate-activity.js
index 8f10f6f..931185a 100644
--- a/app/addons/replication/components/replicate-activity.js
+++ b/app/addons/replication/components/replicate-activity.js
@@ -98,7 +98,7 @@ export default class Activity extends React.Component {
visible={modalVisible}
onClose={this.closeModal.bind(this)}
onClick={this.confirmDeleteDocs.bind(this)}
- />
+ />
</div>
);
}
diff --git a/app/addons/replication/components/source.js b/app/addons/replication/components/source.js
index c4c7975..5b5e8c2 100644
--- a/app/addons/replication/components/source.js
+++ b/app/addons/replication/components/source.js
@@ -30,7 +30,7 @@ const RemoteSourceInput = ({onChange, value}) =>
value={value}
onChange={(e) => onChange(e.target.value)}
/>
- <RemoteExample />
+ <RemoteExample />
</div>
</div>;
@@ -71,7 +71,7 @@ const ReplicationSourceRow = ({replicationSource, databases, localSource, remote
value={localSource}
databases={databases}
onChange={onChangeLocal}
- />;
+ />;
}
return <RemoteSourceInput value={remoteSource} onChange={onChangeRemote} />;
@@ -144,7 +144,7 @@ export class ReplicationSource extends React.Component {
remoteSource={remoteSource}
onChangeLocal={onLocalSourceChange}
onChangeRemote={onRemoteSourceChange}
- />;
+ />;
}
render () {
diff --git a/app/addons/replication/components/submit.js b/app/addons/replication/components/submit.js
index 97c744a..7d94ae7 100644
--- a/app/addons/replication/components/submit.js
+++ b/app/addons/replication/components/submit.js
@@ -17,25 +17,25 @@ import Components from '../../components/react-components';
const {ConfirmButton} = Components;
export const ReplicationSubmit = ({onClear, disabled, onClick}) =>
-<div className="replication__button-row">
- <ConfirmButton
- customIcon="fonticon-replicate"
- id="replicate"
- text="Start Replication"
- onClick={onClick}
- disabled={disabled}
- />
- <a
- className="replication__clear-link"
- href="#"
- data-bypass="true"
- onClick={(e) => {
- e.preventDefault();
- onClear();
- }}>
+ <div className="replication__button-row">
+ <ConfirmButton
+ customIcon="fonticon-replicate"
+ id="replicate"
+ text="Start Replication"
+ onClick={onClick}
+ disabled={disabled}
+ />
+ <a
+ className="replication__clear-link"
+ href="#"
+ data-bypass="true"
+ onClick={(e) => {
+ e.preventDefault();
+ onClear();
+ }}>
Clear
- </a>
-</div>;
+ </a>
+ </div>;
ReplicationSubmit.propTypes = {
diff --git a/app/addons/replication/components/target.js b/app/addons/replication/components/target.js
index dc9584e..255bc24 100644
--- a/app/addons/replication/components/target.js
+++ b/app/addons/replication/components/target.js
@@ -65,7 +65,7 @@ const RemoteTargetReplicationRow = ({onChange, value, newRemote}) => {
value={value}
onChange={(e) => onChange(e.target.value)}
/>
- <RemoteExample newRemote={newRemote} />
+ <RemoteExample newRemote={newRemote} />
</div>
);
};
@@ -128,19 +128,19 @@ const ReplicationTargetRow = ({
input = <NewLocalTargetReplicationRow
value={localTarget}
onChange={onLocalTargetChange}
- />;
+ />;
} else if (replicationTarget === Constants.REPLICATION_TARGET.EXISTING_LOCAL_DATABASE) {
input = <ExistingLocalTargetReplicationRow
onChange={onLocalTargetChange}
databases={databases}
value={localTarget}
- />;
+ />;
} else {
input = <RemoteTargetReplicationRow
onChange={onRemoteTargetChange}
value={remoteTarget}
newRemote={Constants.REPLICATION_TARGET.NEW_REMOTE_DATABASE === replicationTarget}
- />;
+ />;
}
let targetLabel = 'Target Name:';
diff --git a/app/addons/replication/controller.js b/app/addons/replication/controller.js
index 8de28db..dfefabc 100644
--- a/app/addons/replication/controller.js
+++ b/app/addons/replication/controller.js
@@ -38,7 +38,6 @@ export default class ReplicationController extends React.Component {
activityLoading: store.isActivityLoading(),
databases: store.getDatabases(),
authenticated: store.isAuthenticated(),
- password: store.getPassword(),
// source fields
replicationSource: store.getReplicationSource(),
@@ -171,11 +170,10 @@ export default class ReplicationController extends React.Component {
selectAllDocs={Actions.selectAllReplicates}
allDocsSelected={allReplicateSelected}
someDocsSelected={someReplicateSelected}
- deleteDocs={Actions.deleteDocs}
activitySort={activitySort}
changeActivitySort={Actions.changeActivitySort}
deleteDocs={Actions.deleteReplicates}
- />;
+ />;
}
if (activityLoading) {
@@ -188,13 +186,12 @@ export default class ReplicationController extends React.Component {
onFilterChange={Actions.filterDocs}
selectAllDocs={Actions.selectAllDocs}
selectDoc={Actions.selectDoc}
- selectAllDocs={Actions.selectAllDocs}
allDocsSelected={allDocsSelected}
someDocsSelected={someDocsSelected}
deleteDocs={Actions.deleteDocs}
activitySort={activitySort}
changeActivitySort={Actions.changeActivitySort}
- />;
+ />;
}
getHeaderComponents () {
@@ -214,10 +211,10 @@ export default class ReplicationController extends React.Component {
startValue={300}
stepSize={60}
onPoll={this.getAllActivity.bind(this)}
- />
+ />
<RefreshBtn
refresh={this.getAllActivity.bind(this)}
- />
+ />
</div>
);
}
@@ -254,11 +251,8 @@ export default class ReplicationController extends React.Component {
getCrumbs () {
if (this.state.tabSection === 'new replication') {
return [{'name': 'Job Configuration'}];
- } else {
- return [{'name': 'Replication'}];
}
-
- return [];
+ return [{'name': 'Replication'}];
}
getTabs () {
@@ -283,7 +277,7 @@ export default class ReplicationController extends React.Component {
return (
<OnePane>
<OnePaneHeader crumbs={this.getCrumbs()}>
- {this.getHeaderComponents()}
+ {this.getHeaderComponents()}
</OnePaneHeader>
<OnePaneContent>
<div className="template-content flex-body flex-layout flex-col">
diff --git a/app/addons/replication/route.js b/app/addons/replication/route.js
index 95719b4..187c5e0 100644
--- a/app/addons/replication/route.js
+++ b/app/addons/replication/route.js
@@ -47,7 +47,7 @@ const ReplicationRouteObject = FauxtonAPI.RouteObject.extend({
return <ReplicationController
localSource={localSource}
- />;
+ />;
},
fromId: function (replicationId) {
diff --git a/app/addons/replication/stores.js b/app/addons/replication/stores.js
index 19badc7..5286550 100644
--- a/app/addons/replication/stores.js
+++ b/app/addons/replication/stores.js
@@ -26,8 +26,7 @@ const validFieldMap = {
replicationDocName: '_replicationDocName',
replicationSource: '_replicationSource',
replicationTarget: '_replicationTarget',
- localSource: '_localSource',
- replicationDocName: '_replicationDocName'
+ localSource: '_localSource'
};
const ReplicationStore = FauxtonAPI.Store.extend({
@@ -92,9 +91,9 @@ const ReplicationStore = FauxtonAPI.Store.extend({
loadActivitySort () {
const defaultSort = {
- descending: false,
- column: 'statusTime'
- };
+ descending: false,
+ column: 'statusTime'
+ };
let sort = app.utils.localStorageGet('replication-activity-sort');
if (!sort) {
@@ -303,10 +302,6 @@ const ReplicationStore = FauxtonAPI.Store.extend({
return this._isConflictModalVisible;
},
- getPassword () {
- return this._password;
- },
-
setStateFromDoc (doc) {
Object.keys(doc).forEach(key => {
this.updateFormField(key, doc[key]);
@@ -331,129 +326,125 @@ const ReplicationStore = FauxtonAPI.Store.extend({
this._localTarget = '';
this._remoteTarget = '';
}
- break;
+ break;
case ActionTypes.REPLICATION_DATABASES_LOADED:
this.setDatabases(options.databases);
this._loading = false;
- break;
+ break;
case ActionTypes.REPLICATION_FETCHING_FORM_STATE:
this._loading = true;
- break;
+ break;
case ActionTypes.REPLICATION_UPDATE_FORM_FIELD:
this.changeAfterSubmit();
this.updateFormField(options.fieldName, options.value);
- break;
+ break;
case ActionTypes.REPLICATION_CLEAR_FORM:
this.clearReplicationForm();
- break;
+ break;
case ActionTypes.REPLICATION_STARTING:
this._submittedNoChange = true;
- break;
+ break;
case ActionTypes.REPLICATION_FETCHING_STATUS:
this._activityLoading = true;
- break;
+ break;
case ActionTypes.REPLICATION_STATUS:
this._activityLoading = false;
this.setReplicationStatus(options);
- break;
+ break;
case ActionTypes.REPLICATION_FILTER_DOCS:
this.setStatusFilter(options);
- break;
+ break;
case ActionTypes.REPLICATION_FILTER_REPLICATE:
this.setReplicateFilter(options);
- break;
+ break;
case ActionTypes.REPLICATION_TOGGLE_DOC:
this.selectDoc(options);
- break;
+ break;
case ActionTypes.REPLICATION_TOGGLE_ALL_DOCS:
this.selectAllDocs();
- break;
+ break;
case ActionTypes.REPLICATION_TOGGLE_REPLICATE:
this.selectReplicate(options);
- break;
+ break;
case ActionTypes.REPLICATION_TOGGLE_ALL_REPLICATE:
this.selectAllReplicate();
- break;
+ break;
case ActionTypes.REPLICATION_SET_STATE_FROM_DOC:
this._loading = false;
this.setStateFromDoc(options);
- break;
+ break;
case ActionTypes.REPLICATION_SHOW_CONFLICT_MODAL:
this._isConflictModalVisible = true;
- break;
+ break;
case ActionTypes.REPLICATION_HIDE_CONFLICT_MODAL:
this._isConflictModalVisible = false;
- break;
+ break;
case ActionTypes.REPLICATION_CHANGE_ACTIVITY_SORT:
this.setActivitySort(options);
- break;
+ break;
case ActionTypes.REPLICATION_CLEAR_SELECTED_DOCS:
this._allDocsSelected = false;
- break;
+ break;
case ActionTypes.REPLICATION_CHANGE_TAB_SECTION:
this._tabSection = options;
- break;
-
- case ActionTypes.REPLICATION_CLEAR_SELECTED_DOCS:
- this._allDocsSelected = false;
- break;
+ break;
case ActionTypes.REPLICATION_SUPPORT_NEW_API:
this._checkingAPI = false;
this._supportNewApi = options;
- break;
+ break;
case ActionTypes.REPLICATION_FETCHING_REPLICATE_STATUS:
this._fetchingReplicateInfo = true;
- break;
+ break;
case ActionTypes.REPLICATION_REPLICATE_STATUS:
this._fetchingReplicateInfo = false;
this.setReplicateInfo(options);
- break;
+ break;
case ActionTypes.REPLICATION_CLEAR_SELECTED_REPLICATES:
this._allReplicateSelected = false;
- break;
+ break;
case AccountActionTypes.AUTH_SHOW_PASSWORD_MODAL:
this._isPasswordModalVisible = true;
- break;
+ break;
case AccountActionTypes.AUTH_HIDE_PASSWORD_MODAL:
this._isPasswordModalVisible = false;
- break;
+ break;
case AccountActionTypes.AUTH_CREDS_VALID:
this._authenticated = true;
this.setCredentials(options.username, options.password);
- break;
+ break;
case AccountActionTypes.AUTH_CREDS_INVALID:
this._authenticated = false;
- break;
+ break;
default:
- return;
+ return;
}
this.triggerChange();
diff --git a/app/addons/replication/tests/nightwatch/replication.js b/app/addons/replication/tests/nightwatch/replication.js
index c523c8f..bd0c4a4 100644
--- a/app/addons/replication/tests/nightwatch/replication.js
+++ b/app/addons/replication/tests/nightwatch/replication.js
@@ -39,7 +39,6 @@ module.exports = {
const waitTime = client.globals.maxWaitTime;
const baseUrl = client.globals.test_settings.launch_url;
const password = client.globals.test_settings.password;
- console.log('PASSWORD', password);
client
.createDatabase(newDatabaseName1)
diff --git a/app/addons/replication/tests/nightwatch/replicationactivity.js b/app/addons/replication/tests/nightwatch/replicationactivity.js
index 3f1f49b..a29e363 100644
--- a/app/addons/replication/tests/nightwatch/replicationactivity.js
+++ b/app/addons/replication/tests/nightwatch/replicationactivity.js
@@ -96,42 +96,42 @@ module.exports = {
.end();
},
"Action click doesn't change doc's order": client =>{
- const waitTime = client.globals.maxWaitTime;
- const baseUrl = client.globals.test_settings.launch_url;
- const firstRowSelector = '.replication__table-row:nth-of-type(1)';
- let firstDoc;
+ const waitTime = client.globals.maxWaitTime;
+ const baseUrl = client.globals.test_settings.launch_url;
+ const firstRowSelector = '.replication__table-row:nth-of-type(1)';
+ let firstDoc;
- const replicatorDoc1 = {
- _id: 'existing-doc-id-filter1',
- source: "http://source-db.com",
- target: "http://target-db.com"
- };
+ const replicatorDoc1 = {
+ _id: 'existing-doc-id-filter1',
+ source: "http://source-db.com",
+ target: "http://target-db.com"
+ };
- const replicatorDoc2 = {
- _id: 'existing-doc-filter2',
- source: "http://source-db2.com",
- target: "http://target-db.com"
- };
- client
- .deleteDatabase('_replicator')
- .createDatabase('_replicator')
- .createDocument(replicatorDoc1._id, '_replicator', replicatorDoc1)
- .createDocument(replicatorDoc2._id, '_replicator', replicatorDoc2)
- .loginToGUI()
- .waitForElementNotPresent('.global-notification .fonticon-cancel', waitTime, false)
- .url(baseUrl + '/#replication')
- .waitForElementNotPresent('.load-lines', waitTime, true)
- .waitForElementVisible(firstRowSelector, waitTime, true)
- .getText(firstRowSelector + ' td:nth-of-type(2)', function(result) {
- firstDoc = result.value;
- })
- .clickWhenVisible(firstRowSelector + ' .replication__row-btn.icon-trash', waitTime, true)
- .clickWhenVisible('.replication_delete-doc-modal.modal-dialog .modal-footer .cancel-link', waitTime, true)
- .waitForElementVisible(firstRowSelector, waitTime, true)
- .getText(firstRowSelector + ' td:nth-of-type(2)', function(result) {
- this.verify.ok(result.value === firstDoc,
- 'Checking if the order was reserved if no documents were sorted');
- })
- .end();
+ const replicatorDoc2 = {
+ _id: 'existing-doc-filter2',
+ source: "http://source-db2.com",
+ target: "http://target-db.com"
+ };
+ client
+ .deleteDatabase('_replicator')
+ .createDatabase('_replicator')
+ .createDocument(replicatorDoc1._id, '_replicator', replicatorDoc1)
+ .createDocument(replicatorDoc2._id, '_replicator', replicatorDoc2)
+ .loginToGUI()
+ .waitForElementNotPresent('.global-notification .fonticon-cancel', waitTime, false)
+ .url(baseUrl + '/#replication')
+ .waitForElementNotPresent('.load-lines', waitTime, true)
+ .waitForElementVisible(firstRowSelector, waitTime, true)
+ .getText(firstRowSelector + ' td:nth-of-type(2)', function(result) {
+ firstDoc = result.value;
+ })
+ .clickWhenVisible(firstRowSelector + ' .replication__row-btn.icon-trash', waitTime, true)
+ .clickWhenVisible('.replication_delete-doc-modal.modal-dialog .modal-footer .cancel-link', waitTime, true)
+ .waitForElementVisible(firstRowSelector, waitTime, true)
+ .getText(firstRowSelector + ' td:nth-of-type(2)', function(result) {
+ this.verify.ok(result.value === firstDoc,
+ 'Checking if the order was reserved if no documents were sorted');
+ })
+ .end();
}
};
diff --git a/app/addons/setup/resources.js b/app/addons/setup/resources.js
index 609ca73..3f91a3e 100644
--- a/app/addons/setup/resources.js
+++ b/app/addons/setup/resources.js
@@ -23,9 +23,9 @@ Setup.Model = Backbone.Model.extend({
url: function (context) {
if (context === "apiurl") {
return window.location.origin + "/_cluster_setup";
- } else {
- return '/_cluster_setup';
}
+ return '/_cluster_setup';
+
},
validate: function (attrs) {
diff --git a/app/addons/setup/setup.actions.js b/app/addons/setup/setup.actions.js
index f46e681..9d5209a 100644
--- a/app/addons/setup/setup.actions.js
+++ b/app/addons/setup/setup.actions.js
@@ -41,8 +41,7 @@ export default {
data: JSON.stringify({
action: 'finish_cluster'
})
- })
- .success(function () {
+ }).success(function () {
FauxtonAPI.addNotification({
msg: message,
type: 'success',
@@ -50,8 +49,7 @@ export default {
clear: true
});
FauxtonAPI.navigate('#setup/finish');
- })
- .fail(function () {
+ }).fail(function () {
FauxtonAPI.addNotification({
msg: 'There was an error. Please check your setup and try again.',
type: 'error',
diff --git a/app/addons/setup/setup.js b/app/addons/setup/setup.js
index d48d29a..fe1a59c 100644
--- a/app/addons/setup/setup.js
+++ b/app/addons/setup/setup.js
@@ -45,9 +45,9 @@ class ClusterConfiguredScreen extends React.Component {
return 'clustered';
} else if (this.state.clusterState === 'single_node_enabled') {
return 'single';
- } else {
- return 'unknown state';
}
+ return 'unknown state';
+
};
state = this.getStoreState();
@@ -250,7 +250,7 @@ class SetupMultipleNodesController extends React.Component {
onAlterBindAddress={this.alterBindAddressSetupNode} />
<SetupNodeCountSetting
onAlterNodeCount={this.alterNodeCount} />
- </div>
+ </div>
<hr/>
<div className="setup-add-nodes-section">
<h2>Add Nodes to the Cluster</h2>
diff --git a/app/addons/setup/setup.stores.js b/app/addons/setup/setup.stores.js
index 1ba83f7..2092ab9 100644
--- a/app/addons/setup/setup.stores.js
+++ b/app/addons/setup/setup.stores.js
@@ -130,50 +130,50 @@ var SetupStore = FauxtonAPI.Store.extend({
switch (action.type) {
case ActionTypes.SETUP_SET_CLUSTERSTATUS:
this.setClusterState(action.options);
- break;
+ break;
case ActionTypes.SETUP_SET_USERNAME:
this.setUsername(action.options);
- break;
+ break;
case ActionTypes.SETUP_SET_PASSWORD:
this.setPassword(action.options);
- break;
+ break;
case ActionTypes.SETUP_BIND_ADDRESS_FOR_SINGLE_NODE:
this.setBindAdressForSetupNode(action.options);
- break;
+ break;
case ActionTypes.SETUP_PORT_FOR_SINGLE_NODE:
this.setPortForSetupNode(action.options);
- break;
+ break;
case ActionTypes.SETUP_PORT_ADDITIONAL_NODE:
this.setPortForAdditionalNode(action.options);
- break;
+ break;
case ActionTypes.SETUP_BIND_ADDRESS_ADDITIONAL_NODE:
this.setBindAdressForAdditionalNode(action.options);
- break;
+ break;
case ActionTypes.SETUP_REMOTE_ADDRESS_ADDITIONAL_NODE:
this.setRemoteAddressForAdditionalNode(action.options);
- break;
+ break;
case ActionTypes.SETUP_ADD_NODE_TO_LIST:
this.addNodeToList(action.options);
- break;
+ break;
case ActionTypes.SETUP_RESET_ADDITIONAL_NODE:
this.resetAddtionalNode();
- break;
+ break;
case ActionTypes.SETUP_NODE_COUNT:
this.setNodeCountForSetupNode(action.options);
- break;
+ break;
default:
- return;
+ return;
}
//This is a quick and somewhat messy fix
diff --git a/app/addons/verifyinstall/resources.js b/app/addons/verifyinstall/resources.js
index 2025245..af78fdd 100644
--- a/app/addons/verifyinstall/resources.js
+++ b/app/addons/verifyinstall/resources.js
@@ -53,18 +53,18 @@ Verifyinstall.testProcess = {
setupDB: function (db) {
var deferred = FauxtonAPI.Deferred();
db.fetch()
- .then(function () {
- return db.destroy();
- }, function () {
- deferred.resolve();
- })
- .then(function () {
- deferred.resolve();
- }, function (xhr, error, reason) {
- if (reason === 'Unauthorized') {
- deferred.reject(xhr, error, reason);
- }
- });
+ .then(function () {
+ return db.destroy();
+ }, function () {
+ deferred.resolve();
+ })
+ .then(function () {
+ deferred.resolve();
+ }, function (xhr, error, reason) {
+ if (reason === 'Unauthorized') {
+ deferred.reject(xhr, error, reason);
+ }
+ });
return deferred;
},
diff --git a/app/addons/verifyinstall/stores.js b/app/addons/verifyinstall/stores.js
index b9de784..3a3035e 100644
--- a/app/addons/verifyinstall/stores.js
+++ b/app/addons/verifyinstall/stores.js
@@ -61,25 +61,25 @@ var VerifyInstallStore = FauxtonAPI.Store.extend({
case ActionTypes.VERIFY_INSTALL_START:
this.startVerification();
this.triggerChange();
- break;
+ break;
case ActionTypes.VERIFY_INSTALL_RESET:
this.reset();
this.triggerChange();
- break;
+ break;
case ActionTypes.VERIFY_INSTALL_SINGLE_TEST_COMPLETE:
this.updateTestStatus(action.test, action.success);
this.triggerChange();
- break;
+ break;
case ActionTypes.VERIFY_INSTALL_ALL_TESTS_COMPLETE:
this.stopVerification();
this.triggerChange();
- break;
+ break;
default:
- return;
+ return;
}
}
});
diff --git a/app/core/__tests__/ajax.test.js b/app/core/__tests__/ajax.test.js
index e63eb4e..5ffc82e 100644
--- a/app/core/__tests__/ajax.test.js
+++ b/app/core/__tests__/ajax.test.js
@@ -94,8 +94,7 @@ describe('Fauxton Ajax', () => {
}
});
- return get('/testing')
- .then(resp =>{
+ return get('/testing').then(resp =>{
assert.ok(resp.ok);
});
});
@@ -109,9 +108,9 @@ describe('Fauxton Ajax', () => {
});
return put('/testing')
- .then(resp =>{
- assert.ok(resp.ok);
- });
+ .then(resp =>{
+ assert.ok(resp.ok);
+ });
});
it('can do a POST', () => {
@@ -123,9 +122,9 @@ describe('Fauxton Ajax', () => {
});
return post('/testing')
- .then(resp =>{
- assert.ok(resp.ok);
- });
+ .then(resp =>{
+ assert.ok(resp.ok);
+ });
});
it('can do a DELETE', () => {
@@ -137,8 +136,8 @@ describe('Fauxton Ajax', () => {
});
return deleteRequest('/testing')
- .then(resp =>{
- assert.ok(resp.ok);
- });
+ .then(resp =>{
+ assert.ok(resp.ok);
+ });
});
});
diff --git a/app/core/__tests__/utils.test.js b/app/core/__tests__/utils.test.js
index ddf4f02..d24362b 100644
--- a/app/core/__tests__/utils.test.js
+++ b/app/core/__tests__/utils.test.js
@@ -82,10 +82,10 @@ describe('Utils', () => {
it('Set and retrieve complex object', () => {
const key = 'key2',
- obj = {
- one: 1,
- two: ['1', 'string', 3]
- };
+ obj = {
+ one: 1,
+ two: ['1', 'string', 3]
+ };
utils.localStorageSet(key, obj);
assert.deepEqual(utils.localStorageGet(key), obj);
});
diff --git a/app/core/api.js b/app/core/api.js
index d176576..7927397 100644
--- a/app/core/api.js
+++ b/app/core/api.js
@@ -24,8 +24,8 @@ import Promise from "bluebird";
Backbone.$ = $;
Backbone.ajax = function () {
- return Backbone.$.ajax.apply(Backbone.$, arguments);
- };
+ return Backbone.$.ajax.apply(Backbone.$, arguments);
+};
Object.assign(FauxtonAPI, {
Router,
diff --git a/app/core/routeObject.js b/app/core/routeObject.js
index 96382df..5532934 100644
--- a/app/core/routeObject.js
+++ b/app/core/routeObject.js
@@ -65,8 +65,8 @@ _.extend(RouteObject.prototype, {
routeCallback: function (route, args) {
var routes = this.get('routes'),
- routeObj = routes[route],
- routeCallback;
+ routeObj = routes[route],
+ routeCallback;
if (typeof routeObj === 'object') {
routeCallback = this[routeObj.route];
diff --git a/app/core/utils.js b/app/core/utils.js
index 11a0ada..d743107 100644
--- a/app/core/utils.js
+++ b/app/core/utils.js
@@ -36,10 +36,10 @@ const utils = {
const hash = window.location.hash.split('?')[1];
queryString = queryString || hash || window.location.search.substring(1);
const urlParams = {},
- pl = /\+/g, // Regex for replacing addition symbol with a space
- search = /([^&=]+)=?([^&]*)/g,
- decode = function (s) { return decodeURIComponent(s.replace(pl, ' ')); },
- query = queryString;
+ pl = /\+/g, // Regex for replacing addition symbol with a space
+ search = /([^&=]+)=?([^&]*)/g,
+ decode = function (s) { return decodeURIComponent(s.replace(pl, ' ')); },
+ query = queryString;
if (queryString) {
let match;
diff --git a/app/helpers.js b/app/helpers.js
index 93c750c..2e65228 100644
--- a/app/helpers.js
+++ b/app/helpers.js
@@ -39,16 +39,16 @@ Helpers.getDocUrl = function (key) {
// File size pretty printing, taken from futon.format.js
Helpers.formatSize = function (size, decimals = 1) {
- var jump = 512;
- if (size < jump) return size + " bytes";
- var units = ["KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
- var i = 0;
- while (size >= jump && i < units.length) {
- i += 1;
- size /= 1024;
- }
- return size.toFixed(decimals) + ' ' + units[i - 1];
- };
+ var jump = 512;
+ if (size < jump) return size + " bytes";
+ var units = ["KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
+ var i = 0;
+ while (size >= jump && i < units.length) {
+ i += 1;
+ size /= 1024;
+ }
+ return size.toFixed(decimals) + ' ' + units[i - 1];
+};
Helpers.formatDate = function (timestamp) {
return moment(timestamp, 'X').format('MMM Do, h:mm:ss a');
@@ -58,7 +58,7 @@ Helpers.getDateFromNow = function (timestamp) {
};
Helpers.escapeJQuerySelector = function (selector) {
- return selector && selector.replace(/[!"#$%&'()*+,.\/:;<=>?@[\\\]^`{|}~]/g, "\\$&");
+ return selector && selector.replace(/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g, "\\$&");
};
/**
@@ -66,7 +66,7 @@ Helpers.escapeJQuerySelector = function (selector) {
* @returns {boolean} True if on IE10 or IE11. Otherwise false.
*/
Helpers.isIE1X = function() {
- return document.documentMode == 11 || document.documentMode == 10;
+ return document.documentMode == 11 || document.documentMode == 10;
};
export default Helpers;
diff --git a/app/initialize.js.underscore b/app/initialize.js.underscore
index 3a0b8e0..9b2014d 100644
--- a/app/initialize.js.underscore
+++ b/app/initialize.js.underscore
@@ -1,3 +1,5 @@
+/* eslint-disable */
+
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
// use this file except in compliance with the License. You may obtain a copy of
// the License at
diff --git a/bin/remove-test-dbs.js b/bin/remove-test-dbs.js
index ac7a8dc..0307560 100755
--- a/bin/remove-test-dbs.js
+++ b/bin/remove-test-dbs.js
@@ -23,14 +23,14 @@ const nano = require('nano')(dbUrl);
nano.db.list((err, body) => {
if (err) {
- console.log('ERR', err);
+ console.error('ERR', err);
return;
}
const list = body.filter(db => {
return /fauxton-selenium-tests/.test(db);
}).map(db => {
return (cb) => {
- console.log('removing', db);
+ console.info('Removing db', db);
nano.db.destroy(db, (err) => {
if (err) {
cb(err);
diff --git a/devserver.js b/devserver.js
index 691d6ee..d3aadcb 100644
--- a/devserver.js
+++ b/devserver.js
@@ -26,7 +26,7 @@ const loadSettings = function () {
const settings = loadSettings();
const devSetup = function (cb) {
- console.log('setup dev environment');
+ console.info('setup dev environment');
let cmd = 'devSetupWithClean';
if (settings.noClean) {
cmd = 'devSetup';
@@ -36,15 +36,15 @@ const devSetup = function (cb) {
const grunt = spawn(gruntCmd, [cmd]);
grunt.stdout.on('data', (data) => {
- console.log(data.toString());
+ console.info(data.toString());
});
grunt.stderr.on('error', (data) => {
- console.log('Setup error:', data.toString());
+ console.info('Setup error:', data.toString());
});
grunt.on('close', (code) => {
- console.log('dev setup finished with code', code);
+ console.info('dev setup finished with code', code);
if (code === 0) {
cb();
}
@@ -63,7 +63,7 @@ function getCspHeaders () {
return {
'Content-Security-Policy': cspHeader
};
-};
+}
const runWebpackServer = function () {
const proxy = httpProxy.createServer({
@@ -113,11 +113,11 @@ const runWebpackServer = function () {
server.listen(options.port, '0.0.0.0', function (err) {
if (err) {
- console.log(err);
+ console.error(err);
return;
}
- console.log('listening on', options.host, options.port);
- console.log('Starting first compile. This will take about 10 seconds...');
+ console.info('listening on', options.host, options.port);
+ console.info('Starting first compile. This will take about 10 seconds...');
});
};
diff --git a/index.js b/index.js
index a17d629..ae40b4f 100644
--- a/index.js
+++ b/index.js
@@ -14,18 +14,18 @@ module.exports = function (options) {
function sendFile (req, res, filePath) {
return send(req, filePath)
- .on('error', function (err) {
- if (err.status === 404) {
- console.log('Could not locate', filePath);
- } else {
- console.log('ERROR', filePath, err);
- }
-
- res.setHeader("Content-Type", "text/javascript");
- res.statusCode = 404;
- res.end(JSON.stringify({error: err.message}));
- })
- .pipe(res);
+ .on('error', function (err) {
+ if (err.status === 404) {
+ console.error('Could not locate', filePath);
+ } else {
+ console.error('ERROR', filePath, err);
+ }
+
+ res.setHeader("Content-Type", "text/javascript");
+ res.statusCode = 404;
+ res.end(JSON.stringify({error: err.message}));
+ })
+ .pipe(res);
}
var fileTypes = ['.js', '.css', '.png', '.swf', '.eot', '.woff', '.svg', '.ttf', '.swf'];
@@ -46,7 +46,7 @@ module.exports = function (options) {
var url = req.url.split(/\?v=|\?noCache/)[0].replace('_utils', '');
var accept = [];
if (req.headers.accept) {
- var accept = req.headers.accept.split(',');
+ accept = req.headers.accept.split(',');
}
if (setContentSecurityPolicy) {
var headerValue = "default-src 'self'; child-src 'self' data: blob:; img-src 'self' data:; font-src 'self'; " +
@@ -93,9 +93,10 @@ module.exports = function (options) {
];
_.each(logo, function (line) {
+ // eslint-disable-next-line no-console
console.log(line.toString());
});
-
+ // eslint-disable-next-line no-console
console.log('Listening on ' + port);
this.close = () => {
diff --git a/package.json b/package.json
index 9571531..4bb3cce 100644
--- a/package.json
+++ b/package.json
@@ -37,7 +37,7 @@
"babel": "^6.3.26",
"babel-cli": "^6.22.2",
"babel-core": "^6.22.1",
- "babel-eslint": "~8.0.1",
+ "babel-eslint": "~8.1.2",
"babel-loader": "^6.2.9",
"babel-plugin-array-includes": "^2.0.3",
"babel-plugin-transform-class-properties": "^6.24.1",
@@ -58,9 +58,9 @@
"couchapp": "~0.11.0",
"css-loader": "^0.26.1",
"d3": "^3.4.11",
- "eslint": "^3.14.1",
+ "eslint": "^4.14.0",
"eslint-loader": "^1.3.0",
- "eslint-plugin-react": "^6.7.1",
+ "eslint-plugin-react": "^7.5.1",
"exports-loader": "^0.6.2",
"expose-loader": "0.7.1",
"express": "^4.14.1",
diff --git a/tasks/fauxton.js b/tasks/fauxton.js
index b93f838..69c257e 100644
--- a/tasks/fauxton.js
+++ b/tasks/fauxton.js
@@ -19,9 +19,9 @@ module.exports = function (grunt) {
grunt.log.writeln('Fetching external dependencies');
const data = this.data,
- target = data.target || 'app/addons/',
- settingsFile = fs.existsSync(data.src) ? data.src : 'settings.json.default.json',
- settings = grunt.file.readJSON(settingsFile);
+ target = data.target || 'app/addons/',
+ settingsFile = fs.existsSync(data.src) ? data.src : 'settings.json.default.json',
+ settings = grunt.file.readJSON(settingsFile);
const fetch = deps => {
var fs = require('fs-extra');
@@ -84,7 +84,7 @@ module.exports = function (grunt) {
var result = _getNightwatchTests(this.data.settings);
var addonsWithTests = result.addonFolders;
var excludeTests = result.excludeTests;
- console.log('addons and excluded', addonsWithTests, excludeTests);
+ console.info('addons and excluded', addonsWithTests, excludeTests);
// if the user passed a --file="X" on the command line, filter out
var singleTestToRun = grunt.option('file');
diff --git a/webpack.config.dev.js b/webpack.config.dev.js
index 2ba72f9..44b344b 100644
--- a/webpack.config.dev.js
+++ b/webpack.config.dev.js
@@ -13,10 +13,10 @@ const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const path = require('path');
const settings = require('./tasks/helper')
- .init()
- .readSettingsFile()
- .template
- .development;
+ .init()
+ .readSettingsFile()
+ .template
+ .development;
module.exports = {
entry: {
@@ -40,73 +40,73 @@ module.exports = {
],
module: {
rules: [
- {
- test: /\.jsx?$/,
- enforce: "pre",
- use: ['eslint-loader'],
- exclude: /node_modules/
- },
- {
- test: /\.jsx?$/,
- exclude: /node_modules/,
- use: 'babel-loader'
- },
- {
- test: require.resolve('jquery'),
- use: [{
- loader: 'expose-loader',
- options: 'jQuery'
+ {
+ test: /\.jsx?$/,
+ enforce: "pre",
+ use: ['eslint-loader'],
+ exclude: /node_modules/
},
{
+ test: /\.jsx?$/,
+ exclude: /node_modules/,
+ use: 'babel-loader'
+ },
+ {
+ test: require.resolve('jquery'),
+ use: [{
+ loader: 'expose-loader',
+ options: 'jQuery'
+ },
+ {
loader: 'expose-loader',
options: '$'
- }]
- },
- {
- test: require.resolve("backbone"),
- use: [{
+ }]
+ },
+ {
+ test: require.resolve("backbone"),
+ use: [{
loader: 'expose-loader',
options: 'Backbone'
- }]
- },
- {
- test: /\.less$/,
- use: [
- "style-loader",
- "css-loader",
- {
- loader: "less-loader",
- options: {
- modifyVars: {
- largeLogoPath: "\'" + settings.variables.largeLogoPath + "\'",
- smallLogoPath: "\'" + settings.variables.smallLogoPath + "\'"
+ }]
+ },
+ {
+ test: /\.less$/,
+ use: [
+ "style-loader",
+ "css-loader",
+ {
+ loader: "less-loader",
+ options: {
+ modifyVars: {
+ largeLogoPath: "'" + settings.variables.largeLogoPath + "'",
+ smallLogoPath: "'" + settings.variables.smallLogoPath + "'"
+ }
}
}
- }
- ]
- },
- {
- test: /\.css$/,
- use: [
- "style-loader",
- "css-loader"
- ]
- },
- {
- test: /\.woff(\?v=\d+\.\d+\.\d+)?$/,
- loader: 'url-loader?limit=10000&mimetype=application/font-woff&name=dashboard.assets/fonts/[name].[ext]'
- },
- {
- test: /\.woff2(\?\S*)?$/, loader: 'url-loader?limit=10000&mimetype=application/font-woff2&name=dashboard.assets/fonts/[name].[ext]'
- },
- {
- test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/font-tff&name=dashboard.assets/fonts/[name].[ext]'
- },
- { test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: 'file-loader?name=dashboard.assets/fonts/[name].[ext]' },
- { test: /\.png(\?v=\d+\.\d+\.\d+)?$/, loader: 'file-loader?name=dashboard.assets/img/[name].[ext]' },
- { test: /\.gif(\?v=\d+\.\d+\.\d+)?$/, loader: 'file-loader?name=dashboard.assets/img/[name].[ext]' },
- { test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=image/svg+xml&name=dashboard.assets/img/[name].[ext]' }
- ]
+ ]
+ },
+ {
+ test: /\.css$/,
+ use: [
+ "style-loader",
+ "css-loader"
+ ]
+ },
+ {
+ test: /\.woff(\?v=\d+\.\d+\.\d+)?$/,
+ loader: 'url-loader?limit=10000&mimetype=application/font-woff&name=dashboard.assets/fonts/[name].[ext]'
+ },
+ {
+ test: /\.woff2(\?\S*)?$/, loader: 'url-loader?limit=10000&mimetype=application/font-woff2&name=dashboard.assets/fonts/[name].[ext]'
+ },
+ {
+ test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/font-tff&name=dashboard.assets/fonts/[name].[ext]'
+ },
+ { test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: 'file-loader?name=dashboard.assets/fonts/[name].[ext]' },
+ { test: /\.png(\?v=\d+\.\d+\.\d+)?$/, loader: 'file-loader?name=dashboard.assets/img/[name].[ext]' },
+ { test: /\.gif(\?v=\d+\.\d+\.\d+)?$/, loader: 'file-loader?name=dashboard.assets/img/[name].[ext]' },
+ { test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=image/svg+xml&name=dashboard.assets/img/[name].[ext]' }
+ ]
},
resolve: {
extensions: ['*', '.js', '.jsx'], //We can use .js and React's .jsx files using Babel
diff --git a/webpack.config.release.js b/webpack.config.release.js
index 4490598..76fb905 100644
--- a/webpack.config.release.js
+++ b/webpack.config.release.js
@@ -14,15 +14,15 @@ var ExtractTextPlugin = require("extract-text-webpack-plugin");
var HtmlWebpackPlugin = require('html-webpack-plugin');
var path = require('path');
const settings = require('./tasks/helper')
- .init()
- .readSettingsFile()
- .template
- .release;
+ .init()
+ .readSettingsFile()
+ .template
+ .release;
module.exports = {
// Entry point for static analyzer:
entry: {
- bundle: ['core-js/fn/array', 'core-js/fn/symbol', 'core-js/fn/promise', './app/main.js']
+ bundle: ['core-js/fn/array', 'core-js/fn/symbol', 'core-js/fn/promise', './app/main.js']
},
output: {
@@ -68,13 +68,14 @@ module.exports = {
],
resolve: {
- // Allow to omit extensions when requiring these files
- extensions: ['', '.js', '.jsx']
+ extensions: ['*', '.js', '.jsx'],
+ alias: {
+ "underscore": "lodash"
+ }
},
module: {
- loaders: [
- {
+ loaders: [{
test: /\.jsx?$/,
enforce: "pre",
use: ['eslint-loader'],
@@ -88,19 +89,19 @@ module.exports = {
{
test: require.resolve('jquery'),
use: [{
- loader: 'expose-loader',
- options: 'jQuery'
+ loader: 'expose-loader',
+ options: 'jQuery'
},
{
- loader: 'expose-loader',
- options: '$'
+ loader: 'expose-loader',
+ options: '$'
}]
- },
- {
+ },
+ {
test: require.resolve("backbone"),
use: [{
- loader: 'expose-loader',
- options: 'Backbone'
+ loader: 'expose-loader',
+ options: 'Backbone'
}]
},
{
@@ -113,8 +114,8 @@ module.exports = {
loader: "less-loader",
options: {
modifyVars: {
- largeLogoPath: "\'" + settings.variables.largeLogoPath + "\'",
- smallLogoPath: "\'" + settings.variables.smallLogoPath + "\'"
+ largeLogoPath: "'" + settings.variables.largeLogoPath + "'",
+ smallLogoPath: "'" + settings.variables.smallLogoPath + "'"
}
}
}
@@ -126,7 +127,7 @@ module.exports = {
test: /\.css$/, use: [
'style-loader',
'css-loader'
- ]
+ ]
},
{
test: /\.woff(\?v=\d+\.\d+\.\d+)?$/,
@@ -143,11 +144,5 @@ module.exports = {
{ test: /\.gif(\?v=\d+\.\d+\.\d+)?$/, loader: 'file-loader?name=dashboard.assets/img/[name].[ext]' },
{ test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=image/svg+xml&name=dashboard.assets/img/[name].[ext]' }
]
- },
- resolve: {
- extensions: ['*', '.js', '.jsx'],
- alias: {
- "underscore": "lodash"
- }
}
};
--
To stop receiving notification emails like this one, please contact
['"commits@couchdb.apache.org" <co...@couchdb.apache.org>'].