You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by be...@apache.org on 2016/01/18 23:50:02 UTC
fauxton commit: updated refs/heads/master to 6f88c3e
Repository: couchdb-fauxton
Updated Branches:
refs/heads/master 9f44223c7 -> 6f88c3eb7
Minor extensibility tweaks
This PR contains a bunch of really small unrelated changes
for general extensibility.
- optional top-level class added to Tray component
- QueryOptions component now exposed for use elsewhere
- MainFieldsView query options component now accepts the doc URL
via a prop.
- Improvement for Up arrow on the query options tray placement
Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/6f88c3eb
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/6f88c3eb
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/6f88c3eb
Branch: refs/heads/master
Commit: 6f88c3eb752655bd502f69fe64d0b4714b3874f7
Parents: 9f44223
Author: Ben Keen <be...@gmail.com>
Authored: Mon Jan 18 08:19:20 2016 -0800
Committer: Ben Keen <be...@gmail.com>
Committed: Mon Jan 18 12:24:34 2016 -0800
----------------------------------------------------------------------
.../components/react-components.react.jsx | 8 +++++++-
.../documents/assets/less/query-options.less | 6 +++---
app/addons/documents/header/header.react.jsx | 2 +-
.../queryoptions/queryoptions.react.jsx | 21 +++++++++++++++++---
.../tests/queryoptions.componentsSpec.react.jsx | 10 +++++++++-
5 files changed, 38 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/6f88c3eb/app/addons/components/react-components.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/components/react-components.react.jsx b/app/addons/components/react-components.react.jsx
index ee52ae2..a011b54 100644
--- a/app/addons/components/react-components.react.jsx
+++ b/app/addons/components/react-components.react.jsx
@@ -1113,6 +1113,12 @@ function (app, FauxtonAPI, React, Stores, FauxtonComponents, ace, beautifyHelper
id: React.PropTypes.string.isRequired
},
+ getDefaultProps: function () {
+ return {
+ className: ''
+ };
+ },
+
componentDidMount: function () {
$('body').on('click.' + this.props.id, _.bind(this.closeIfOpen, this));
FauxtonAPI.Events.on(FauxtonAPI.constants.EVENTS.TRAY_HIDE, this.closeIfOpen, this);
@@ -1150,7 +1156,7 @@ function (app, FauxtonAPI, React, Stores, FauxtonComponents, ace, beautifyHelper
render: function () {
return (
- <div>
+ <div className={this.props.className}>
{this.renderChildren()}
</div>
);
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/6f88c3eb/app/addons/documents/assets/less/query-options.less
----------------------------------------------------------------------
diff --git a/app/addons/documents/assets/less/query-options.less b/app/addons/documents/assets/less/query-options.less
index 3ddeecc..94421cd 100644
--- a/app/addons/documents/assets/less/query-options.less
+++ b/app/addons/documents/assets/less/query-options.less
@@ -57,7 +57,7 @@
}
#query-options-tray:before {
- right: 230px;
+ right: 175px;
}
#query-options-tray {
@@ -65,8 +65,8 @@
padding-top: 6px;
.query-group:first-child {
- margin-top: 0px;
- padding-top: 0px;
+ margin-top: 0;
+ padding-top: 0;
}
.icon-question-sign {
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/6f88c3eb/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 340f583..5c2f291 100644
--- a/app/addons/documents/header/header.react.jsx
+++ b/app/addons/documents/header/header.react.jsx
@@ -43,7 +43,7 @@ function (app, FauxtonAPI, React, Actions, ReactComponents,
selectedView: indexResultsStore.getCurrentViewType(),
isTableView: indexResultsStore.getIsTableView(),
includeDocs: queryOptionsStore.getIncludeDocsEnabled(),
- bulkDocCollection: indexResultsStore.getBulkDocCollection(),
+ bulkDocCollection: indexResultsStore.getBulkDocCollection()
};
},
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/6f88c3eb/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 b04e533..977edba 100644
--- a/app/addons/documents/queryoptions/queryoptions.react.jsx
+++ b/app/addons/documents/queryoptions/queryoptions.react.jsx
@@ -21,12 +21,25 @@ define([
function (app, FauxtonAPI, React, Stores, Actions, Components) {
var store = Stores.queryOptionsStore;
- var LoadLines = Components.LoadLines;
var Tray = Components.Tray;
var TrayContents = Components.TrayContents;
var ToggleHeaderButton = Components.ToggleHeaderButton;
var MainFieldsView = React.createClass({
+ propTypes: {
+ toggleIncludeDocs: React.PropTypes.func.isRequired,
+ includeDocs: React.PropTypes.bool.isRequired,
+ reduce: React.PropTypes.bool.isRequired,
+ toggleReduce: React.PropTypes.func,
+ updateGroupLevel: React.PropTypes.func,
+ docURL: React.PropTypes.string
+ },
+
+ getDefaultProps: function () {
+ return {
+ docURL: FauxtonAPI.constants.DOC_URLS.GENERAL
+ };
+ },
toggleIncludeDocs: function (e) {
this.props.toggleIncludeDocs();
@@ -83,14 +96,15 @@ function (app, FauxtonAPI, React, Stores, Actions, Components) {
<div className="query-group" id="query-options-main-fields">
<span className="add-on">
Query Options
- <a className="help-link" href={FauxtonAPI.constants.DOC_URLS.GENERAL} target="_blank" data-bypass="true">
+ <a className="help-link" href={this.props.docURL} target="_blank" data-bypass="true">
<i className="icon-question-sign" />
</a>
</span>
<div className="controls-group qo-main-fields-row">
<div className="row-fluid fieldsets">
<div className="checkbox inline">
- <input disabled={this.props.reduce} onChange={this.toggleIncludeDocs} className="boom" id="qoIncludeDocs" name="include_docs" type="checkbox" checked={includeDocs} />
+ <input disabled={this.props.reduce} onChange={this.toggleIncludeDocs} id="qoIncludeDocs"
+ name="include_docs" type="checkbox" checked={includeDocs} />
<label className={this.props.reduce ? 'disabled' : ''} htmlFor="qoIncludeDocs" id="qoIncludeDocsLabel">Include Docs</label>
</div>
{this.reduce()}
@@ -371,6 +385,7 @@ A key value is the first parameter emitted in a map function. For example emit("
return {
QueryOptionsController: QueryOptionsController,
+ QueryButtons: QueryButtons,
MainFieldsView: MainFieldsView,
KeySearchFields: KeySearchFields,
AdditionalParams: AdditionalParams,
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/6f88c3eb/app/addons/documents/queryoptions/tests/queryoptions.componentsSpec.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/documents/queryoptions/tests/queryoptions.componentsSpec.react.jsx b/app/addons/documents/queryoptions/tests/queryoptions.componentsSpec.react.jsx
index 57ad66c..b782d48 100644
--- a/app/addons/documents/queryoptions/tests/queryoptions.componentsSpec.react.jsx
+++ b/app/addons/documents/queryoptions/tests/queryoptions.componentsSpec.react.jsx
@@ -39,7 +39,6 @@ define([
var mainFieldsEl;
it('returns null no reduce', function () {
-
mainFieldsEl = TestUtils.renderIntoDocument(<Views.MainFieldsView reduce={false} includeDocs={false} showReduce={false}/>, container);
assert.ok(_.isNull(mainFieldsEl.reduce()));
});
@@ -67,6 +66,15 @@ define([
assert.ok(spy.calledOnce);
});
+
+ it('uses overridden URL prop if defined', function () {
+ var customDocURL = 'http://whatever.com';
+ mainFieldsEl = TestUtils.renderIntoDocument(
+ <Views.MainFieldsView reduce={false} includeDocs={false} showReduce={false} docURL={customDocURL} />,
+ container);
+ assert.equal($(React.findDOMNode(mainFieldsEl)).find('.help-link').attr('href'), customDocURL);
+ });
+
});
describe('KeySearchFields', function () {