fixes
Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/37789ebd Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/37789ebd Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/37789ebd Branch: refs/heads/new-replication Commit: 37789ebd9b5c1aec2b4878d6571a7936c20ec7d2 Parents: 98e7363 Author: Garren Smith <garren.sm...@gmail.com> Authored: Mon Sep 12 16:57:52 2016 +0200 Committer: Garren Smith <garren.sm...@gmail.com> Committed: Wed Sep 14 17:22:30 2016 +0200 ---------------------------------------------------------------------- Gruntfile.js | 8 +-- app/addons/auth/components.react.jsx | 12 +++-- .../replication/assets/less/replication.less | 4 +- app/addons/replication/components/options.js | 9 +++- app/addons/replication/components/source.js | 11 ++-- app/addons/replication/components/submit.js | 8 ++- app/addons/replication/components/target.js | 9 +++- app/addons/replication/controller.js | 5 +- app/addons/replication/tests/controller.js | 46 ----------------- app/addons/replication/tests/controllerSpec.js | 54 ++++++++++++++++++++ 10 files changed, 100 insertions(+), 66 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/37789ebd/Gruntfile.js ---------------------------------------------------------------------- diff --git a/Gruntfile.js b/Gruntfile.js index a68c20c..bbd8103 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -215,10 +215,10 @@ module.exports = function (grunt) { default: { files: { src: initHelper.getFileList(['[Ss]pec.js'], [ - './app/core/**/*[Ss]pec.js', - './app/addons/**/*[Ss]pec.js', - './app/addons/**/*[Ss]pec.react.jsx', - './app/addons/**/*[Ss]pec.jsx' + // './app/core/**/*[Ss]pec.js', + './app/addons/replication/**/*[Ss]pec.js', + // './app/addons/**/*[Ss]pec.react.jsx', + //'./app/addons/**/*[Ss]pec.jsx' ]) }, template: 'test/test.config.underscore' http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/37789ebd/app/addons/auth/components.react.jsx ---------------------------------------------------------------------- diff --git a/app/addons/auth/components.react.jsx b/app/addons/auth/components.react.jsx index ddbfd8c..631f7cf 100644 --- a/app/addons/auth/components.react.jsx +++ b/app/addons/auth/components.react.jsx @@ -17,10 +17,12 @@ import ReactDOM from "react-dom"; import AuthStores from "./stores"; import AuthActions from "./actions"; import { Modal } from 'react-bootstrap'; +import Components from '../components/react-components.react'; var changePasswordStore = AuthStores.changePasswordStore; var createAdminStore = AuthStores.createAdminStore; var createAdminSidebarStore = AuthStores.createAdminSidebarStore; +const {ConfirmButton} = Components; var LoginForm = React.createClass({ @@ -331,7 +333,7 @@ class PasswordModal extends React.Component { return ( <Modal dialogClassName="enter-password-modal" show={this.props.visible} onHide={() => this.props.onClose()}> <Modal.Header closeButton={true}> - <Modal.Title>Enter Password</Modal.Title> + <Modal.Title>{this.props.headerTitle}</Modal.Title> </Modal.Header> <Modal.Body> {this.props.modalMessage} @@ -340,9 +342,10 @@ class PasswordModal extends React.Component { </Modal.Body> <Modal.Footer> <a className="cancel-link" onClick={() => this.props.onClose()}>Cancel</a> - <button onClick={this.authenticate} className="btn btn-success save"> - Continue Replication - </button> + <ConfirmButton + text={this.props.submitBtnLabel} + onClick={this.authenticate} + /> </Modal.Footer> </Modal> ); @@ -356,6 +359,7 @@ PasswordModal.propTypes = { submitBtnLabel: React.PropTypes.string }; PasswordModal.defaultProps = { + headerTitle: "Enter Password", visible: false, modalMessage: '', onClose: AuthActions.hidePasswordModal, http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/37789ebd/app/addons/replication/assets/less/replication.less ---------------------------------------------------------------------- diff --git a/app/addons/replication/assets/less/replication.less b/app/addons/replication/assets/less/replication.less index ab17e67..92f728e 100644 --- a/app/addons/replication/assets/less/replication.less +++ b/app/addons/replication/assets/less/replication.less @@ -115,7 +115,8 @@ div.replication-page { color: #333333; } -.replication-doc-name-input { +//use attribute selector to strengthen this to override bootstraps default font size for inputs +.replication-doc-name-input[type="text"] { padding-right: 32px; font-size: 14px; width: 248px; @@ -131,4 +132,3 @@ div.replication-page { .replication-clear-link { padding: 12px; } - http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/37789ebd/app/addons/replication/components/options.js ---------------------------------------------------------------------- diff --git a/app/addons/replication/components/options.js b/app/addons/replication/components/options.js index 02c5b98..fb6fb9f 100644 --- a/app/addons/replication/components/options.js +++ b/app/addons/replication/components/options.js @@ -53,8 +53,13 @@ const ReplicationDoc = ({value, onChange}) => <div className="replication-doc-name"> <span className="fonticon fonticon-cancel replication-doc-name-icon" title="Clear field" onClick={(e) => onChange('')} /> - <input type="text" className="replication-doc-name-input" placeholder="Custom, new ID (optional)" value={value} - onChange={(e) => onChange(e.target.value)}/> + <input + type="text" + className="replication-doc-name-input" + placeholder="Custom ID (optional)" + value={value} + onChange={(e) => onChange(e.target.value)} + /> </div> </div>; http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/37789ebd/app/addons/replication/components/source.js ---------------------------------------------------------------------- diff --git a/app/addons/replication/components/source.js b/app/addons/replication/components/source.js index d2153cf..13f864b 100644 --- a/app/addons/replication/components/source.js +++ b/app/addons/replication/components/source.js @@ -20,9 +20,14 @@ const RemoteSourceInput = ({onChange, value}) => <div className="replication-section"> <div className="replication-input-label">Database URL:</div> <div className=""> - <input type="text" className="replication-remote-connection-url" placeholder="https://" value={value} - onChange={(e) => onChange(e.target.value)} /> - <div className="replication-remote-connection-url-text">e.g. https://$REMOTE_USERNAME:$REMOTE_PASSWORD@$REMOTE_SERVER/$DATABASE</div> + <input + type="text" + className="replication-remote-connection-url" + placeholder="https://" + value={value} + onChange={(e) => onChange(e.target.value)} + /> + <div className="replication-remote-connection-url-text">Example: https://$REMOTE_USERNAME:$REMOTE_PASSWORD@$REMOTE_SERVER/$DATABASE</div> </div> </div>; http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/37789ebd/app/addons/replication/components/submit.js ---------------------------------------------------------------------- diff --git a/app/addons/replication/components/submit.js b/app/addons/replication/components/submit.js index 521f8d7..d2f0276 100644 --- a/app/addons/replication/components/submit.js +++ b/app/addons/replication/components/submit.js @@ -23,7 +23,13 @@ export const ReplicationSubmit = ({onClear, disabled, onClick}) => onClick={onClick} disabled={disabled} /> - <a className="replication-clear-link" href="#" data-bypass="true" onClick={onClear}>Clear</a> + <a + className="replication-clear-link" + href="#" + data-bypass="true" + onClick={onClear}> + Clear + </a> </div>; http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/37789ebd/app/addons/replication/components/target.js ---------------------------------------------------------------------- diff --git a/app/addons/replication/components/target.js b/app/addons/replication/components/target.js index 86ed5fd..9364d7a 100644 --- a/app/addons/replication/components/target.js +++ b/app/addons/replication/components/target.js @@ -55,8 +55,13 @@ ReplicationTargetSelect.propTypes = { const RemoteTargetReplicationRow = ({onChange, value}) => { return ( <div> - <input type="text" className="replication-remote-connection-url" placeholder="https://" value={value} - onChange={(e) => onChange(e.target.value)} /> + <input + type="text" + className="replication-remote-connection-url" + placeholder="https://" + value={value} + onChange={(e) => onChange(e.target.value)} + /> <div className="replication-remote-connection-url-text">e.g. https://$REMOTE_USERNAME:$REMOTE_PASSWORD@$REMOTE_SERVER/$DATABASE</div> </div> ); http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/37789ebd/app/addons/replication/controller.js ---------------------------------------------------------------------- diff --git a/app/addons/replication/controller.js b/app/addons/replication/controller.js index 2420085..ac69326 100644 --- a/app/addons/replication/controller.js +++ b/app/addons/replication/controller.js @@ -229,8 +229,9 @@ export default class ReplicationController extends React.Component { /> <PasswordModal visible={passwordModalVisible} - modalMessage={<p>Replication requires authentication.</p>} - submitBtnLabel="Continue Replication" + modalMessage={<p>Replication requires authentication on your local account.</p>} + submitBtnLabel="Start Replication" + headerTitle="Enter Account Password." onSuccess={this.submit} /> </div> ); http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/37789ebd/app/addons/replication/tests/controller.js ---------------------------------------------------------------------- diff --git a/app/addons/replication/tests/controller.js b/app/addons/replication/tests/controller.js deleted file mode 100644 index 51ded6c..0000000 --- a/app/addons/replication/tests/controller.js +++ /dev/null @@ -1,46 +0,0 @@ -// 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 React from "react"; -import TestUtils from "react-addons-test-utils"; -import utils from "../../../../test/mocha/testUtils"; -import { mount } from 'enzyme'; -import sinon from "sinon"; -import Stores from '../stores'; -import Controller from '../controller'; -import Constants from '../constants'; - -const store = Stores.replicationStore; - -var assert = utils.assert; - -describe('Replication Controller', () => { - - describe('validation', () => { - - beforeEach(() => { - store.reset(); - }); - - it('returns true for source and target selected', () => { - const controller = mount(<Controller />); - controller.setState({ - replicationTarget: Constants.REPLICATION_TARGET.NEW_LOCAL_DATABASE, - targetDatabase: 'new-database', - - }); - - assert.ok(controller.validate()); - }); - - }); - -}); http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/37789ebd/app/addons/replication/tests/controllerSpec.js ---------------------------------------------------------------------- diff --git a/app/addons/replication/tests/controllerSpec.js b/app/addons/replication/tests/controllerSpec.js new file mode 100644 index 0000000..77558f5 --- /dev/null +++ b/app/addons/replication/tests/controllerSpec.js @@ -0,0 +1,54 @@ +// 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 React from "react"; +import TestUtils from "react-addons-test-utils"; +import utils from "../../../../test/mocha/testUtils"; +import { mount } from 'enzyme'; +import sinon from "sinon"; +import Stores from '../stores'; +import Controller from '../controller'; +import Constants from '../constants'; + +const store = Stores.replicationStore; + +var assert = utils.assert; + +describe('Replication Controller', () => { + + describe('validation', () => { + + beforeEach(() => { + store.reset(); + }); + + it('returns true for source and target selected', () => { + const controller = mount(<Controller />); + controller.setState({ + replicationTarget: Constants.REPLICATION_TARGET.NEW_LOCAL_DATABASE, + targetDatabase: 'new-database', + }); + + console.log(controller); + assert.ok(controller.validate()); + }); + + }); + + describe('confirmButtonEnabled', () => { + + it('returns false if remote database has no text', () => { + + }); + + }); + +});