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 c4d4aec
Date Thu, 02 Jun 2016 12:02:20 GMT
Repository: couchdb-fauxton
Updated Branches:
  refs/heads/master 1ff9e0dbd -> c4d4aeca2


Convert right header to all react


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

Branch: refs/heads/master
Commit: c4d4aeca2a36af33432ac1997d19ceb7d8493ad5
Parents: 1ff9e0d
Author: Garren Smith <garren.smith@gmail.com>
Authored: Thu May 26 16:58:08 2016 +0200
Committer: Garren Smith <garren.smith@gmail.com>
Committed: Thu Jun 2 13:59:20 2016 +0200

----------------------------------------------------------------------
 app/addons/documents/header/header.react.jsx    |  44 ++++----
 app/addons/documents/index-results/stores.js    |   8 +-
 app/addons/documents/jumptodoc.react.jsx        |  19 ++--
 app/addons/documents/queryoptions/actions.js    |  15 ++-
 .../documents/queryoptions/actiontypes.js       |   4 +-
 .../queryoptions/queryoptions.react.jsx         | 111 ++++++++++++-------
 app/addons/documents/queryoptions/stores.js     |  72 +++++++-----
 .../documents/rightalldocsheader.react.jsx      |  72 ++++++++++++
 app/addons/documents/routes-documents.js        |  55 ++++-----
 app/addons/documents/routes-index-editor.js     |  11 +-
 app/addons/documents/routes-mango.js            |   6 +-
 app/addons/documents/routes.js                  |   3 +-
 app/addons/documents/shared-routes.js           |   5 +-
 app/addons/documents/sidebar/sidebar.react.jsx  |   3 -
 app/addons/documents/views.js                   |  95 ----------------
 assets/less/fauxton.less                        |   3 +-
 16 files changed, 279 insertions(+), 247 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c4d4aeca/app/addons/documents/header/header.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/documents/header/header.react.jsx b/app/addons/documents/header/header.react.jsx
index 165bc0d..caff6d4 100644
--- a/app/addons/documents/header/header.react.jsx
+++ b/app/addons/documents/header/header.react.jsx
@@ -10,24 +10,24 @@
 // 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 Actions from "./header.actions";
-import ReactComponents from "../../components/react-components.react";
-import IndexResultsStore from "../index-results/stores";
-import IndexResultsActions from "../index-results/actions";
-import { ButtonGroup, Button } from "react-bootstrap";
-import QueryOptionsStore from "../queryoptions/stores";
-import ReactCSSTransitionGroup from "react-addons-css-transition-group";
+import app from '../../../app';
 
-var indexResultsStore = IndexResultsStore.indexResultsStore;
-var queryOptionsStore = QueryOptionsStore.queryOptionsStore;
+import FauxtonAPI from '../../../core/api';
+import React from 'react';
+import Actions from './header.actions';
+import Components from '../../components/react-components.react';
+import IndexResultStores from '../index-results/stores';
+import IndexResultsActions from '../index-results/actions';
+import QueryOptionsStore from '../queryoptions/stores';
+import ReactCSSTransitionGroup from 'react-addons-css-transition-group';
+import { Button, ButtonGroup } from 'react-bootstrap';
 
-var ToggleHeaderButton = ReactComponents.ToggleHeaderButton;
+const { indexResultsStore } = IndexResultStores;
+const { queryOptionsStore } = QueryOptionsStore;
+const { ToggleHeaderButton } = Components;
 
 var BulkDocumentHeaderController = React.createClass({
-  getStoreState: function () {
+  getStoreState () {
     return {
       selectedView: indexResultsStore.getCurrentViewType(),
       isTableView: indexResultsStore.getIsTableView(),
@@ -36,26 +36,26 @@ var BulkDocumentHeaderController = React.createClass({
     };
   },
 
-  getInitialState: function () {
+  getInitialState () {
     return this.getStoreState();
   },
 
-  componentDidMount: function () {
+  componentDidMount () {
     indexResultsStore.on('change', this.onChange, this);
     queryOptionsStore.on('change', this.onChange, this);
 
   },
 
-  componentWillUnmount: function () {
+  componentWillUnmount () {
     indexResultsStore.off('change', this.onChange);
     queryOptionsStore.off('change', this.onChange);
   },
 
-  onChange: function () {
+  onChange () {
     this.setState(this.getStoreState());
   },
 
-  render: function () {
+  render () {
     var isTableViewSelected = this.state.isTableView;
 
     return (
@@ -85,7 +85,7 @@ var BulkDocumentHeaderController = React.createClass({
     );
   },
 
-  toggleIncludeDocs: function () {
+  toggleIncludeDocs () {
     Actions.toggleIncludeDocs(this.state.includeDocs, this.state.bulkDocCollection);
   },
 
@@ -94,8 +94,6 @@ var BulkDocumentHeaderController = React.createClass({
   }
 });
 
-var Views = {
+export default {
   BulkDocumentHeaderController: BulkDocumentHeaderController
 };
-
-export default Views;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c4d4aeca/app/addons/documents/index-results/stores.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/index-results/stores.js b/app/addons/documents/index-results/stores.js
index 282df98..d36605a 100644
--- a/app/addons/documents/index-results/stores.js
+++ b/app/addons/documents/index-results/stores.js
@@ -31,9 +31,9 @@ Stores.IndexResultsStore = FauxtonAPI.Store.extend({
   },
 
   reset: function () {
-    this._collection = new Backbone.Collection.extend({
+    this._collection = new (FauxtonAPI.Collection.extend({
       url: ''
-    });
+    }))();
 
     this._filteredCollection = [];
     this._bulkDeleteDocCollection = new Resources.BulkDeleteDocCollection([], {});
@@ -72,10 +72,6 @@ Stores.IndexResultsStore = FauxtonAPI.Store.extend({
     this.initPerPage();
   },
 
-  getCollection: function () {
-    return this._collection;
-  },
-
   canShowPrevious: function () {
     if (!this._enabled) { return false; }
     if (!this._collection || !this._collection.hasPrevious) { return false; }

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c4d4aeca/app/addons/documents/jumptodoc.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/documents/jumptodoc.react.jsx b/app/addons/documents/jumptodoc.react.jsx
index d0ef5e4..53a8e9d 100644
--- a/app/addons/documents/jumptodoc.react.jsx
+++ b/app/addons/documents/jumptodoc.react.jsx
@@ -15,15 +15,15 @@ import FauxtonAPI from "../../core/api";
 import React from "react";
 import ReactDOM from "react-dom";
 import ReactSelect from "react-select";
-import "lodash";
 
 const JumpToDoc = ({database, allDocs}) => {
   const options = allDocs.map(doc => {
     return {
-      value: doc.get('_id'),
-      label: doc.get('_id')
+      value: doc._id,
+      label: doc._id
     };
   });
+
   return (
     <div id="jump-to-doc" class="input-append">
       <ReactSelect
@@ -34,7 +34,9 @@ const JumpToDoc = ({database, allDocs}) => {
         clearable={false}
         onChange={({value: docId}) => {
           const url = FauxtonAPI.urls('document', 'app', app.utils.safeURLName(database.id),
app.utils.safeURLName(docId) );
-          FauxtonAPI.navigate(url, {trigger: true});
+          // 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>
@@ -43,12 +45,7 @@ const JumpToDoc = ({database, allDocs}) => {
 
 JumpToDoc.propTypes = {
   database: React.PropTypes.object.isRequired,
-  allDocs: React.PropTypes.object.isRequired,
+  allDocs: React.PropTypes.array.isRequired,
 };
 
-export default {
-  JumpToDoc,
-  render: (el, database, allDocs) => {
-    ReactDOM.render(<JumpToDoc database={database} allDocs={allDocs} />, $(el)[0]);
-  }
-};
+export default JumpToDoc;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c4d4aeca/app/addons/documents/queryoptions/actions.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/queryoptions/actions.js b/app/addons/documents/queryoptions/actions.js
index 89e84cc..e89f6e5 100644
--- a/app/addons/documents/queryoptions/actions.js
+++ b/app/addons/documents/queryoptions/actions.js
@@ -14,7 +14,7 @@ import app from "../../../app";
 import FauxtonAPI from "../../../core/api";
 import ActionTypes from "./actiontypes";
 import Stores from "./stores";
-var store = Stores.queryOptionsStore;
+const store = Stores.queryOptionsStore;
 
 export default {
 
@@ -106,6 +106,17 @@ export default {
         type: ActionTypes.QUERY_SHOW_REDUCE
       });
     }
-  }
+  },
 
+  showQueryOptions: function () {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.QUERY_SHOW
+    });
+  },
+
+  hideQueryOptions: function () {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.QUERY_HIDE
+    });
+  }
 };

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c4d4aeca/app/addons/documents/queryoptions/actiontypes.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/queryoptions/actiontypes.js b/app/addons/documents/queryoptions/actiontypes.js
index 225f38b..52e5295 100644
--- a/app/addons/documents/queryoptions/actiontypes.js
+++ b/app/addons/documents/queryoptions/actiontypes.js
@@ -23,5 +23,7 @@ export default {
   QUERY_RESET: 'QUERY_RESET',
   QUERY_SHOW_REDUCE: 'QUERY_SHOW_REDUCE',
   QUERY_UPDATE_GROUP_LEVEL: 'QUERY_UPDATE_GROUP_LEVEL',
-  QUERY_UPDATE_VISIBILITY: 'QUERY_UPDATE_VISIBILITY'
+  QUERY_UPDATE_VISIBILITY: 'QUERY_UPDATE_VISIBILITY',
+  QUERY_SHOW: 'QUERY_SHOW',
+  QUERY_HIDE: 'QUERY_HIDE'
 };

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c4d4aeca/app/addons/documents/queryoptions/queryoptions.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/documents/queryoptions/queryoptions.react.jsx b/app/addons/documents/queryoptions/queryoptions.react.jsx
index a24b8cf..420d233 100644
--- a/app/addons/documents/queryoptions/queryoptions.react.jsx
+++ b/app/addons/documents/queryoptions/queryoptions.react.jsx
@@ -10,19 +10,18 @@
 // 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 Stores from "./stores";
-import Actions from "./actions";
-import Components from "../../components/react-components.react";
-var store = Stores.queryOptionsStore;
-var TrayContents = Components.TrayContents;
-var ToggleHeaderButton = Components.ToggleHeaderButton;
-
-var TrayWrapper = Components.TrayWrapper;
-var connectToStores = Components.connectToStores;
+import app from '../../../app';
+
+import FauxtonAPI from '../../../core/api';
+import React from 'react';
+import ReactDOM from 'react-dom';
+import QueryOptionsStores from './stores';
+import Actions from './actions';
+import Components from '../../components/react-components.react';
+
+const { connectToStores, TrayWrapper, ToggleHeaderButton, TrayContents } = Components;
+
+const {queryOptionsStore: store} = QueryOptionsStores;
 
 var MainFieldsView = React.createClass({
   propTypes: {
@@ -294,34 +293,64 @@ var QueryButtons = React.createClass({
 });
 
 var QueryOptionsController = React.createClass({
+  getStoreState () {
+    return {
+      isVisible: store.isVisible()
+    };
+  },
+
+  getInitialState () {
+    return this.getStoreState();
+  },
+
+  onChange () {
+    this.setState(this.getStoreState());
+  },
+
+  componentDidMount: function () {
+    store.on('change', this.onChange, this);
+  },
+
+  componentWillUnmount: function () {
+    store.off('change', this.onChange);
+  },
 
   getWrap: function () {
-    return connectToStores(TrayWrapper, [store], function () {
-
-      return {
-        includeDocs: store.includeDocs(),
-        showBetweenKeys: store.showBetweenKeys(),
-        showByKeys: store.showByKeys(),
-        betweenKeys: store.betweenKeys(),
-        byKeys: store.byKeys(),
-        descending: store.descending(),
-        skip: store.skip(),
-        limit: store.limit(),
-        showReduce: store.showReduce(),
-        reduce: store.reduce(),
-        groupLevel: store.groupLevel(),
-        contentVisible: store.getTrayVisible(),
-        queryParams: store.getQueryParams()
-      };
-    });
+    if (!this.TrayWrapper) {
+      this.TrayWrapper = connectToStores(TrayWrapper, [store], function () {
+
+        return {
+          includeDocs: store.includeDocs(),
+          showBetweenKeys: store.showBetweenKeys(),
+          showByKeys: store.showByKeys(),
+          betweenKeys: store.betweenKeys(),
+          byKeys: store.byKeys(),
+          descending: store.descending(),
+          skip: store.skip(),
+          limit: store.limit(),
+          showReduce: store.showReduce(),
+          reduce: store.reduce(),
+          groupLevel: store.groupLevel(),
+          contentVisible: store.getTrayVisible(),
+          queryParams: store.getQueryParams()
+        };
+      });
+    }
+
+    return this.TrayWrapper;
   },
 
   render: function () {
-    var TrayWrapper = this.getWrap();
+    if (!this.state.isVisible) { return null;}
+    const TrayWrapper = this.getWrap();
     return (
-      <TrayWrapper>
-        <QueryTray contentVisible={false} />
-      </TrayWrapper>
+      <div id="header-query-options">
+        <div id="query-options">
+          <TrayWrapper>
+            <QueryTray contentVisible={false} />
+          </TrayWrapper>
+        </div>
+      </div>
     );
   }
 });
@@ -370,7 +399,7 @@ var QueryTray = React.createClass({
     }
 
     return (
-      <TrayContents
+      <TrayContents contentVisible={this.props.contentVisible}
         className="query-options"
         id="query-options-tray">
 
@@ -424,11 +453,11 @@ var QueryTray = React.createClass({
 });
 
 export default {
-  QueryOptionsController: QueryOptionsController,
-  QueryButtons: QueryButtons,
-  MainFieldsView: MainFieldsView,
-  KeySearchFields: KeySearchFields,
-  AdditionalParams: AdditionalParams,
+  QueryOptionsController,
+  QueryButtons,
+  MainFieldsView,
+  KeySearchFields,
+  AdditionalParams,
   render: function (el) {
     ReactDOM.render(<QueryOptionsController />, $(el)[0]);
   }

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c4d4aeca/app/addons/documents/queryoptions/stores.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/queryoptions/stores.js b/app/addons/documents/queryoptions/stores.js
index 1516c7e..42e9ef2 100644
--- a/app/addons/documents/queryoptions/stores.js
+++ b/app/addons/documents/queryoptions/stores.js
@@ -10,18 +10,20 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-import app from "../../../app";
-import FauxtonAPI from "../../../core/api";
-import ActionTypes from "./actiontypes";
-var Stores = {};
+import app from '../../../app';
+
+import FauxtonAPI from '../../../core/api';
+import ActionTypes from './actiontypes';
+const Stores = {};
 
 Stores.QueryOptionsStore = FauxtonAPI.Store.extend({
 
-  initialize: function () {
+  initialize () {
     this.reset();
   },
 
-  reset: function () {
+  reset () {
+    this._isVisible = true;
     this._loading = true;
     this._showByKeys = false;
     this._showBetweenKeys = false;
@@ -42,27 +44,39 @@ Stores.QueryOptionsStore = FauxtonAPI.Store.extend({
     this._showReduce = false;
   },
 
-  isLoading: function () {
+  isLoading () {
     return this._loading;
   },
 
+  isVisible () {
+    return this._isVisible;
+  },
+
+  hideQueryOptions () {
+    this._isVisible = false;
+  },
+
+  showQueryOptions () {
+    this._isVisible = true;
+  },
+
   setTrayVisible: function (trayVisible) {
     this._trayVisible = trayVisible;
   },
 
-  getTrayVisible: function () {
+  getTrayVisible () {
     return this._trayVisible;
   },
 
-  showReduce: function () {
+  showReduce () {
     return this._showReduce;
   },
 
-  reduce: function () {
+  reduce () {
     return this._reduce;
   },
 
-  betweenKeys: function () {
+  betweenKeys () {
     return this._betweenKeys;
   },
 
@@ -74,11 +88,11 @@ Stores.QueryOptionsStore = FauxtonAPI.Store.extend({
     this._skip = skip;
   },
 
-  skip: function () {
+  skip () {
     return this._skip;
   },
 
-  limit: function () {
+  limit () {
     return this._limit;
   },
 
@@ -86,7 +100,7 @@ Stores.QueryOptionsStore = FauxtonAPI.Store.extend({
     this._limit = limit;
   },
 
-  byKeys: function () {
+  byKeys () {
     return this._byKeys;
   },
 
@@ -94,19 +108,19 @@ Stores.QueryOptionsStore = FauxtonAPI.Store.extend({
     this._byKeys = keys;
   },
 
-  includeDocs: function () {
+  includeDocs () {
     return this._includeDocs;
   },
 
-  descending: function () {
+  descending () {
     return this._descending;
   },
 
-  groupLevel: function () {
+  groupLevel () {
     return this._groupLevel;
   },
 
-  toggleByKeys: function () {
+  toggleByKeys () {
     this._showByKeys = !this._showByKeys;
 
     if (this._showByKeys) {
@@ -114,7 +128,7 @@ Stores.QueryOptionsStore = FauxtonAPI.Store.extend({
     }
   },
 
-  toggleBetweenKeys: function () {
+  toggleBetweenKeys () {
     this._showBetweenKeys = !this._showBetweenKeys;
 
     if (this._showBetweenKeys) {
@@ -122,11 +136,11 @@ Stores.QueryOptionsStore = FauxtonAPI.Store.extend({
     }
   },
 
-  showByKeys: function () {
+  showByKeys () {
     return this._showByKeys;
   },
 
-  showBetweenKeys: function () {
+  showBetweenKeys () {
     return this._showBetweenKeys;
   },
 
@@ -141,7 +155,7 @@ Stores.QueryOptionsStore = FauxtonAPI.Store.extend({
     }
 
     if (params.start_key || params.end_key) {
-      var include = true;
+      let include = true;
 
       if (params.inclusive_end) {
         include = params.inclusive_end === 'true';
@@ -182,15 +196,15 @@ Stores.QueryOptionsStore = FauxtonAPI.Store.extend({
     }
   },
 
-  getQueryParams: function () {
-    var params = {};
+  getQueryParams () {
+    const params = {};
 
     if (this._includeDocs) {
       params.include_docs = this._includeDocs;
     }
 
     if (this._showBetweenKeys) {
-      var betweenKeys = this._betweenKeys;
+      const betweenKeys = this._betweenKeys;
       params.inclusive_end = betweenKeys.include;
       if (betweenKeys.startkey && betweenKeys.startkey !== '') {
         params.start_key = betweenKeys.startkey;
@@ -227,7 +241,7 @@ Stores.QueryOptionsStore = FauxtonAPI.Store.extend({
     return params;
   },
 
-  getIncludeDocsEnabled: function () {
+  getIncludeDocsEnabled () {
     return this._includeDocs;
   },
 
@@ -272,6 +286,12 @@ Stores.QueryOptionsStore = FauxtonAPI.Store.extend({
       case ActionTypes.QUERY_UPDATE_VISIBILITY:
         this.setTrayVisible(action.options);
       break;
+      case ActionTypes.QUERY_HIDE:
+        this.hideQueryOptions();
+      break;
+      case ActionTypes.QUERY_SHOW:
+        this.showQueryOptions();
+      break;
       default:
       return;
       // do nothing

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c4d4aeca/app/addons/documents/rightalldocsheader.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/documents/rightalldocsheader.react.jsx b/app/addons/documents/rightalldocsheader.react.jsx
new file mode 100644
index 0000000..48f0006
--- /dev/null
+++ b/app/addons/documents/rightalldocsheader.react.jsx
@@ -0,0 +1,72 @@
+// 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/c4d4aeca/app/addons/documents/routes-documents.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/routes-documents.js b/app/addons/documents/routes-documents.js
index 964744e..a38a481 100644
--- a/app/addons/documents/routes-documents.js
+++ b/app/addons/documents/routes-documents.js
@@ -10,25 +10,28 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-import app from "../../app";
-import FauxtonAPI from "../../core/api";
-import BaseRoute from "./shared-routes";
-import Documents from "./views";
-import Changes from "./changes/components.react";
-import ChangesActions from "./changes/actions";
-import Databases from "../databases/base";
-import Resources from "./resources";
-import Components from "../fauxton/components";
-import IndexResultStores from "./index-results/stores";
-import IndexResultsActions from "./index-results/actions";
-import IndexResultsComponents from "./index-results/index-results.components.react";
-import ReactPagination from "./pagination/pagination.react";
-import ReactHeader from "./header/header.react";
-import ReactActions from "./header/header.actions";
-import SidebarActions from "./sidebar/actions";
-import DesignDocInfoActions from "./designdocinfo/actions";
-import DesignDocInfoComponents from "./designdocinfo/components.react";
-import ComponentsActions from "../components/actions";
+import app from '../../app';
+
+import FauxtonAPI from '../../core/api';
+import BaseRoute from './shared-routes';
+import Documents from './resources';
+import RightAllDocsHeader from './rightalldocsheader.react';
+import Changes from './changes/components.react';
+import ChangesActions from './changes/actions';
+import Databases from '../databases/base';
+import Resources from './resources';
+import Components from '../fauxton/components';
+import IndexResultStores from './index-results/stores';
+import IndexResultsActions from './index-results/actions';
+import IndexResultsComponents from './index-results/index-results.components.react';
+import ReactPagination from './pagination/pagination.react';
+import ReactHeader from './header/header.react';
+import ReactActions from './header/header.actions';
+import SidebarActions from './sidebar/actions';
+import DesignDocInfoActions from './designdocinfo/actions';
+import DesignDocInfoComponents from './designdocinfo/components.react';
+import ComponentsActions from '../components/actions';
+import QueryOptionsActions from './queryoptions/actions';
 
 var DocumentsRouteObject = BaseRoute.extend({
   layout: "with_tabs_sidebar",
@@ -67,9 +70,9 @@ var DocumentsRouteObject = BaseRoute.extend({
 
     this.createDesignDocsCollection();
 
-    this.rightHeader = this.setView("#right-header", new Documents.Views.RightAllDocsHeader({
+    this.setComponent("#right-header", RightAllDocsHeader, {
       database: this.database
-    }));
+    });
 
     this.addLeftHeader();
     this.addSidebar();
@@ -93,7 +96,7 @@ var DocumentsRouteObject = BaseRoute.extend({
     });
 
     this.leftheader.updateCrumbs(this.getCrumbs(this.database));
-    this.rightHeader.hideQueryOptions();
+    QueryOptionsActions.hideQueryOptions();
 
     this.apiUrl = [designDocInfo.url('apiurl'), designDocInfo.documentation()];
   },
@@ -157,9 +160,9 @@ var DocumentsRouteObject = BaseRoute.extend({
     // the initial this.database object which can change
     this.apiUrl = [this.database.allDocs.urlRef("apiurl", urlParams), this.database.allDocs.documentation()];
 
-    // update the rightHeader with the latest & greatest info
-    this.rightHeader.resetQueryOptions({ queryParams: urlParams });
-    this.rightHeader.showQueryOptions();
+    // update the query options with the latest & greatest info
+    QueryOptionsActions.reset({queryParams: urlParams});
+    QueryOptionsActions.showQueryOptions();
   },
 
   reloadDesignDocs: function (event) {
@@ -183,7 +186,7 @@ var DocumentsRouteObject = BaseRoute.extend({
 
     SidebarActions.selectNavItem('changes');
     this.leftheader.updateCrumbs(this.getCrumbs(this.database));
-    this.rightHeader.hideQueryOptions();
+    QueryOptionsActions.hideQueryOptions();
 
     this.apiUrl = function () {
       return [FauxtonAPI.urls('changes', 'apiurl', this.database.id, ''), this.database.documentation()];

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c4d4aeca/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 d371433..2275c99 100644
--- a/app/addons/documents/routes-index-editor.js
+++ b/app/addons/documents/routes-index-editor.js
@@ -14,7 +14,7 @@ import app from "../../app";
 import FauxtonAPI from "../../core/api";
 import Helpers from "./helpers";
 import BaseRoute from "./shared-routes";
-import Documents from "./views";
+import Documents from "./resources";
 import IndexEditorComponents from "./index-editor/components.react";
 import ActionsIndexEditor from "./index-editor/actions";
 import Databases from "../databases/base";
@@ -26,6 +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';
 
 
 var IndexEditorAndResults = BaseRoute.extend({
@@ -57,6 +58,10 @@ var IndexEditorAndResults = BaseRoute.extend({
     this.createDesignDocsCollection();
     this.addLeftHeader();
     this.addSidebar();
+
+    this.setComponent("#right-header", RightAllDocsHeader, {
+      database: this.database
+    });
   },
 
   establish: function () {
@@ -72,10 +77,6 @@ var IndexEditorAndResults = BaseRoute.extend({
         docParams = params.docParams,
         decodeDdoc = decodeURIComponent(ddoc);
 
-    this.rightHeader = this.setView('#right-header', new Documents.Views.RightAllDocsHeader({
-      database: this.database
-    }));
-
     viewName = viewName.replace(/\?.*$/, '');
     this.setComponent('#footer', ReactPagination.Footer);
 

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c4d4aeca/app/addons/documents/routes-mango.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/routes-mango.js b/app/addons/documents/routes-mango.js
index b76f799..fb5eea6 100644
--- a/app/addons/documents/routes-mango.js
+++ b/app/addons/documents/routes-mango.js
@@ -17,7 +17,6 @@ import BaseRoute from "./shared-routes";
 import Databases from "../databases/resources";
 import Components from "../fauxton/components";
 import Resources from "./resources";
-import Documents from "./views";
 import IndexResultsActions from "./index-results/actions";
 import IndexResultStores from "./index-results/stores";
 import ReactHeader from "./header/header.react";
@@ -28,6 +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';
 
 var MangoIndexEditorAndQueryEditor = BaseRoute.extend({
   layout: 'two_pane',
@@ -81,7 +81,7 @@ var MangoIndexEditorAndQueryEditor = BaseRoute.extend({
     IndexResultsActions.newMangoResultsList({
       collection: mangoResultCollection,
       textEmptyIndex: 'No Results',
-      bulkCollection: new Documents.BulkDeleteDocCollection([], { databaseId: this.database.safeID()
}),
+      bulkCollection: new Resources.BulkDeleteDocCollection([], { databaseId: this.database.safeID()
}),
     });
 
     MangoActions.getIndexList({
@@ -122,7 +122,7 @@ var MangoIndexEditorAndQueryEditor = BaseRoute.extend({
 
     IndexResultsActions.newResultsList({
       collection: mangoIndexCollection,
-      bulkCollection: new Documents.MangoBulkDeleteDocCollection([], { databaseId: this.database.safeID()
}),
+      bulkCollection: new Resources.MangoBulkDeleteDocCollection([], { databaseId: this.database.safeID()
}),
       typeOfIndex: 'mango'
     });
 

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c4d4aeca/app/addons/documents/routes.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/routes.js b/app/addons/documents/routes.js
index 3d09471..c08a347 100644
--- a/app/addons/documents/routes.js
+++ b/app/addons/documents/routes.js
@@ -10,11 +10,12 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-import Documents from "./views";
+import Documents from './shared-resources';
 import DocumentsRouteObject from "./routes-documents";
 import docEditor from "./routes-doc-editor";
 import IndexEditorRouteObject from "./routes-index-editor";
 import Mango from "./routes-mango";
+
 Documents.RouteObjects = [
   docEditor.DocEditorRouteObject,
   docEditor.RevBrowserRouteObject,

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c4d4aeca/app/addons/documents/shared-routes.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/shared-routes.js b/app/addons/documents/shared-routes.js
index 7a2c620..5a29b97 100644
--- a/app/addons/documents/shared-routes.js
+++ b/app/addons/documents/shared-routes.js
@@ -19,6 +19,7 @@ import PaginationActions from "./pagination/actions";
 import IndexResultStores from "./index-results/stores";
 import SidebarComponents from "./sidebar/sidebar.react";
 import SidebarActions from "./sidebar/actions";
+import QueryActions from './queryoptions/actions';
 
 
 // The Documents section is built up a lot of different route object which share code. This
contains
@@ -74,8 +75,8 @@ var BaseRoute = FauxtonAPI.RouteObject.extend({
       var design = _.findWhere(that.designDocs.models, {id: '_design/' + ddoc});
       !_.isUndefined(hasReduceFunction = design.attributes.doc.views[viewName].reduce);
 
-      that.rightHeader.showQueryOptions();
-      that.rightHeader.resetQueryOptions({
+      QueryActions.showQueryOptions();
+      QueryActions.reset({
         queryParams: urlParams,
         hasReduce: hasReduceFunction,
         showReduce: !_.isUndefined(hasReduceFunction),

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c4d4aeca/app/addons/documents/sidebar/sidebar.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/documents/sidebar/sidebar.react.jsx b/app/addons/documents/sidebar/sidebar.react.jsx
index 66f21c0..700f035 100644
--- a/app/addons/documents/sidebar/sidebar.react.jsx
+++ b/app/addons/documents/sidebar/sidebar.react.jsx
@@ -22,13 +22,10 @@ import ComponentsActions from "../../components/actions";
 import IndexEditorActions from "../index-editor/actions";
 import IndexEditorComponents from "../index-editor/components.react";
 import GeneralComponents from "../../fauxton/components.react";
-import DocumentViews from "../../documents/views";
 import DocumentHelper from "../../documents/helpers";
 import { OverlayTrigger, Popover, Modal } from "react-bootstrap";
 import "../../../../assets/js/plugins/prettify";
 
-var DeleteDBModal = DocumentViews.Views.DeleteDBModal;
-
 var store = Stores.sidebarStore;
 var LoadLines = Components.LoadLines;
 var DesignDocSelector = IndexEditorComponents.DesignDocSelector;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c4d4aeca/app/addons/documents/views.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/views.js b/app/addons/documents/views.js
deleted file mode 100644
index 3b1ff67..0000000
--- a/app/addons/documents/views.js
+++ /dev/null
@@ -1,95 +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 QueryOptions from "./queryoptions/queryoptions.react";
-import QueryActions from "./queryoptions/actions";
-import JumpToDoc from "./jumptodoc.react";
-import "../../../assets/js/plugins/prettify";
-
-var Views = {};
-
-function showError (msg) {
-  FauxtonAPI.addNotification({
-    msg: msg,
-    type: 'error',
-    clear:  true
-  });
-}
-
-Views.RightAllDocsHeader = FauxtonAPI.View.extend({
-  className: "header-right right-db-header flex-layout flex-row",
-  template: "addons/documents/templates/all_docs_header",
-  events: {
-    'click .toggle-select-menu': 'selectAllMenu'
-  },
-
-  initialize: function (options) {
-    this.database = options.database;
-    this.params = options.params;
-
-    _.bindAll(this);
-    this.selectVisible = false;
-    FauxtonAPI.Events.on('success:bulkDelete', this.selectAllMenu);
-  },
-
-  afterRender: function () {
-    QueryOptions.render('#query-options');
-    JumpToDoc.render('#header-search', this.database, this.database.allDocs);
-    this.toggleQueryOptionsHeader(this.isHidden);
-  },
-
-  cleanup: function () {
-    FauxtonAPI.Events.unbind('success:bulkDelete');
-  },
-
-  selectAllMenu: function (e) {
-    FauxtonAPI.triggerRouteEvent("toggleSelectHeader");
-    FauxtonAPI.Events.trigger("documents:showSelectAll", this.selectVisible);
-  },
-
-  resetQueryOptions: function (options) {
-    QueryActions.reset(options);
-  },
-
-  hideQueryOptions: function () {
-    this.isHidden = true;
-    if (this.hasRendered) {
-      this.toggleQueryOptionsHeader(this.isHidden);
-    }
-  },
-
-  showQueryOptions: function () {
-    this.isHidden = false;
-    if (this.hasRendered) {
-      this.toggleQueryOptionsHeader(this.isHidden);
-    }
-  },
-
-  toggleQueryOptionsHeader: function (hide) {
-    $("#header-query-options").toggleClass("hide", hide);
-  },
-
-  serialize: function () {
-    return {
-      database: this.database.get('id')
-    };
-  }
-});
-
-Documents.Views = Views;
-
-export default Documents;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c4d4aeca/assets/less/fauxton.less
----------------------------------------------------------------------
diff --git a/assets/less/fauxton.less b/assets/less/fauxton.less
index 63cf183..701e6c5 100644
--- a/assets/less/fauxton.less
+++ b/assets/less/fauxton.less
@@ -511,8 +511,7 @@ body #dashboard .flex-body#breadcrumbs {
 }
 
 .Select .is-focused {
-  color: #fff;
-  background-color: #333333;
+  background-color: #E33F3B;
 }
 
 .Select-option:hover {


Mime
View raw message