Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id A6C4B200ACA for ; Thu, 9 Jun 2016 12:57:38 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id A569A160A58; Thu, 9 Jun 2016 10:57:38 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id A29B5160A2B for ; Thu, 9 Jun 2016 12:57:37 +0200 (CEST) Received: (qmail 51091 invoked by uid 500); 9 Jun 2016 10:57:36 -0000 Mailing-List: contact commits-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list commits@couchdb.apache.org Received: (qmail 51081 invoked by uid 99); 9 Jun 2016 10:57:36 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 Jun 2016 10:57:36 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 671D1DFD43; Thu, 9 Jun 2016 10:57:36 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: garren@apache.org To: commits@couchdb.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: fauxton commit: updated refs/heads/master to 39cba49 Date: Thu, 9 Jun 2016 10:57:36 +0000 (UTC) archived-at: Thu, 09 Jun 2016 10:57:38 -0000 Repository: couchdb-fauxton Updated Branches: refs/heads/master a9d5d259a -> 39cba4997 Jump to docs fetches from the server Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/39cba499 Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/39cba499 Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/39cba499 Branch: refs/heads/master Commit: 39cba4997f56d81373f66752a143048570265cf1 Parents: a9d5d25 Author: Garren Smith Authored: Thu Jun 9 11:38:38 2016 +0200 Committer: Garren Smith Committed: Thu Jun 9 12:29:32 2016 +0200 ---------------------------------------------------------------------- app/addons/documents/components/actions.js | 39 +++++++++++ .../documents/components/jumptodoc.react.jsx | 43 ++++++++++++ .../components/rightalldocsheader.react.jsx | 43 ++++++++++++ app/addons/documents/jumptodoc.react.jsx | 51 -------------- .../documents/rightalldocsheader.react.jsx | 72 -------------------- app/addons/documents/routes-documents.js | 2 +- app/addons/documents/routes-index-editor.js | 2 +- app/addons/documents/routes-mango.js | 2 +- 8 files changed, 128 insertions(+), 126 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/39cba499/app/addons/documents/components/actions.js ---------------------------------------------------------------------- diff --git a/app/addons/documents/components/actions.js b/app/addons/documents/components/actions.js new file mode 100644 index 0000000..3a2e4b9 --- /dev/null +++ b/app/addons/documents/components/actions.js @@ -0,0 +1,39 @@ +// 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 $ from 'jquery'; +import FauxtonAPI from "../../../core/api"; + +export default { + fetchAllDocsWithKey: (database) => { + return (id, callback) => { + const query = '?' + $.param({ + startkey: JSON.stringify(id), + endkey: JSON.stringify(id + "\u9999"), + limit: 100 + }); + + const url = FauxtonAPI.urls('allDocs', 'server', database.safeID(), query); + $.ajax({ + cache: false, + url: url, + dataType: 'json' + }).then(({rows}) => { + const options = rows.map(row => { + return { value: row.id, label: row.id}; + }); + callback(null, { + options: options + }); + }); + }; + } +}; http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/39cba499/app/addons/documents/components/jumptodoc.react.jsx ---------------------------------------------------------------------- diff --git a/app/addons/documents/components/jumptodoc.react.jsx b/app/addons/documents/components/jumptodoc.react.jsx new file mode 100644 index 0000000..c40b697 --- /dev/null +++ b/app/addons/documents/components/jumptodoc.react.jsx @@ -0,0 +1,43 @@ +// 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 app from "../../../app"; +import FauxtonAPI from "../../../core/api"; +import React from "react"; +import ReactDOM from "react-dom"; +import ReactSelect from "react-select"; + +const JumpToDoc = ({database, loadOptions}) => { + return ( +
+ { + const url = FauxtonAPI.urls('document', 'app', app.utils.safeURLName(database.id), app.utils.safeURLName(docId) ); + // We navigating away from the page. So we need to take that navigation out of the loop otherwise + // it causes an issue where the react-select state is changed after its unmounted + setTimeout(() => FauxtonAPI.navigate(url, {trigger: true})); + }} + /> +
+ ); +}; + +JumpToDoc.propTypes = { + database: React.PropTypes.object.isRequired, +}; + +export default JumpToDoc; http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/39cba499/app/addons/documents/components/rightalldocsheader.react.jsx ---------------------------------------------------------------------- diff --git a/app/addons/documents/components/rightalldocsheader.react.jsx b/app/addons/documents/components/rightalldocsheader.react.jsx new file mode 100644 index 0000000..f0377fd --- /dev/null +++ b/app/addons/documents/components/rightalldocsheader.react.jsx @@ -0,0 +1,43 @@ +// 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 app from '../../../app'; +import FauxtonAPI from '../../../core/api'; +import Components from '../../fauxton/components'; +import Documents from '../resources'; +import Databases from '../../databases/resources'; +import React from 'react'; +import QueryOptions from '../queryoptions/queryoptions.react'; +import QueryActions from '../queryoptions/actions'; +import JumpToDoc from './jumptodoc.react'; +import IndexResultStores from '../index-results/stores'; +import Actions from './actions'; + +const { indexResultsStore } = IndexResultStores; + +const { QueryOptionsController } = QueryOptions; + +const RightAllDocsHeader = ({database}) => +
+
+ +
+ +
; + +RightAllDocsHeader.propTypes = { + database: React.PropTypes.object.isRequired +}; + +export default RightAllDocsHeader; http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/39cba499/app/addons/documents/jumptodoc.react.jsx ---------------------------------------------------------------------- diff --git a/app/addons/documents/jumptodoc.react.jsx b/app/addons/documents/jumptodoc.react.jsx deleted file mode 100644 index 53a8e9d..0000000 --- a/app/addons/documents/jumptodoc.react.jsx +++ /dev/null @@ -1,51 +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 app from "../../app"; -import FauxtonAPI from "../../core/api"; -import React from "react"; -import ReactDOM from "react-dom"; -import ReactSelect from "react-select"; - -const JumpToDoc = ({database, allDocs}) => { - const options = allDocs.map(doc => { - return { - value: doc._id, - label: doc._id - }; - }); - - return ( -
- { - const url = FauxtonAPI.urls('document', 'app', app.utils.safeURLName(database.id), app.utils.safeURLName(docId) ); - // We navigating away from the page. So we need to take that navigation out of the loop otherwise - // it causes an issue where the react-select state is changed after its unmounted - setTimeout(() => FauxtonAPI.navigate(url, {trigger: true})); - }} - /> -
- ); -}; - -JumpToDoc.propTypes = { - database: React.PropTypes.object.isRequired, - allDocs: React.PropTypes.array.isRequired, -}; - -export default JumpToDoc; http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/39cba499/app/addons/documents/rightalldocsheader.react.jsx ---------------------------------------------------------------------- diff --git a/app/addons/documents/rightalldocsheader.react.jsx b/app/addons/documents/rightalldocsheader.react.jsx deleted file mode 100644 index 48f0006..0000000 --- a/app/addons/documents/rightalldocsheader.react.jsx +++ /dev/null @@ -1,72 +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 app from '../../app'; -import FauxtonAPI from '../../core/api'; -import Components from '../fauxton/components'; -import Documents from './resources'; -import Databases from '../databases/resources'; -import React from 'react'; -import QueryOptions from './queryoptions/queryoptions.react'; -import QueryActions from './queryoptions/actions'; -import JumpToDoc from './jumptodoc.react'; -import IndexResultStores from './index-results/stores'; - -const { indexResultsStore } = IndexResultStores; - -const { QueryOptionsController } = QueryOptions; - -class RightAllDocsHeader extends React.Component { - - constructor (props) { - super(props); - - this.state = this.getStoreState(); - } - - getStoreState () { - return { - allDocs: indexResultsStore.getCollection().toJSON() - }; - } - - componentDidMount () { - indexResultsStore.on('change', this.onChange, this); - } - - componentWillUnmount () { - indexResultsStore.off('change', this.onChange); - } - - onChange () { - this.setState(this.getStoreState()); - } - - render () { - const {database} = this.props; - const {allDocs} = this.state; - - return ( -
-
- -
- -
- ); - } -}; - - -export default RightAllDocsHeader; http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/39cba499/app/addons/documents/routes-documents.js ---------------------------------------------------------------------- diff --git a/app/addons/documents/routes-documents.js b/app/addons/documents/routes-documents.js index a38a481..3ada09e 100644 --- a/app/addons/documents/routes-documents.js +++ b/app/addons/documents/routes-documents.js @@ -15,7 +15,7 @@ import app from '../../app'; import FauxtonAPI from '../../core/api'; import BaseRoute from './shared-routes'; import Documents from './resources'; -import RightAllDocsHeader from './rightalldocsheader.react'; +import RightAllDocsHeader from './components/rightalldocsheader.react'; import Changes from './changes/components.react'; import ChangesActions from './changes/actions'; import Databases from '../databases/base'; http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/39cba499/app/addons/documents/routes-index-editor.js ---------------------------------------------------------------------- diff --git a/app/addons/documents/routes-index-editor.js b/app/addons/documents/routes-index-editor.js index 2275c99..deb6eeb 100644 --- a/app/addons/documents/routes-index-editor.js +++ b/app/addons/documents/routes-index-editor.js @@ -26,7 +26,7 @@ import ReactPagination from "./pagination/pagination.react"; import ReactHeader from "./header/header.react"; import ReactHeaderActions from "./header/header.actions"; import SidebarActions from "./sidebar/actions"; -import RightAllDocsHeader from './rightalldocsheader.react'; +import RightAllDocsHeader from './components/rightalldocsheader.react'; var IndexEditorAndResults = BaseRoute.extend({ http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/39cba499/app/addons/documents/routes-mango.js ---------------------------------------------------------------------- diff --git a/app/addons/documents/routes-mango.js b/app/addons/documents/routes-mango.js index fb5eea6..f29402a 100644 --- a/app/addons/documents/routes-mango.js +++ b/app/addons/documents/routes-mango.js @@ -27,7 +27,7 @@ import MangoActions from "./mango/mango.actions"; import MangoStores from "./mango/mango.stores"; import IndexResultsComponents from "./index-results/index-results.components.react"; import SidebarActions from "./sidebar/actions"; -import RightAllDocsHeader from './rightalldocsheader.react'; +import RightAllDocsHeader from './components/rightalldocsheader.react'; var MangoIndexEditorAndQueryEditor = BaseRoute.extend({ layout: 'two_pane',