couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gar...@apache.org
Subject fauxton commit: updated refs/heads/master to 39cba49
Date Thu, 09 Jun 2016 10:57:36 GMT
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 <garren.smith@gmail.com>
Authored: Thu Jun 9 11:38:38 2016 +0200
Committer: Garren Smith <garren.smith@gmail.com>
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 (
+    <div id="jump-to-doc" class="input-append">
+      <ReactSelect.Async
+        name="jump-to-doc"
+        placeholder="Document ID"
+        className="jump-to-doc"
+        loadOptions={loadOptions}
+        clearable={false}
+        onChange={({value: docId}) => {
+          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}));
+        }}
+      />
+    </div>
+  );
+};
+
+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}) =>
+  <div className="header-right right-db-header flex-layout flex-row">
+    <div className="searchbox-wrapper">
+        <div id="header-search" className="searchbox-container">
+          <JumpToDoc loadOptions={Actions.fetchAllDocsWithKey(database)} database={database}
/>
+        </div>
+    </div>
+    <QueryOptionsController />
+  </div>;
+
+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 (
-    <div id="jump-to-doc" class="input-append">
-      <ReactSelect
-        name="jump-to-doc"
-        placeholder="Document ID"
-        className="jump-to-doc"
-        options={options}
-        clearable={false}
-        onChange={({value: docId}) => {
-          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}));
-        }}
-      />
-    </div>
-  );
-};
-
-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  (
-      <div className="header-right right-db-header flex-layout flex-row">
-        <div className="searchbox-wrapper">
-            <div id="header-search" className="searchbox-container">
-              <JumpToDoc database={database} allDocs={allDocs} />
-            </div>
-        </div>
-        <QueryOptionsController />
-      </div>
-    );
-  }
-};
-
-
-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',


Mime
View raw message