Github user robertkowalski commented on a diff in the pull request:

    https://github.com/apache/couchdb-fauxton/pull/483#discussion_r35204292
  
    --- Diff: app/addons/documents/queryoptions/queryoptions.react.jsx ---
    @@ -0,0 +1,490 @@
    +// 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.
    +
    +define([
    +  'app',
    +  'api',
    +  'react',
    +  'addons/documents/queryoptions/stores',
    +  'addons/documents/queryoptions/actions',
    +  'addons/components/react-components.react',
    +],
    +
    +function (app, FauxtonAPI, React, Stores, Actions, Components) {
    +  var store = Stores.queryOptionsStore;
    +  var LoadLines = Components.LoadLines;
    +  var ReactCSSTransitionGroup = React.addons.CSSTransitionGroup;
    +
    +  var MainFieldsView = React.createClass({
    +
    +    toggleIncludeDocs: function (e) {
    +      this.props.toggleIncludeDocs();
    +    },
    +
    +    groupLevelChange: function (e) {
    +      this.props.updateGroupLevel(e.target.value);
    +    },
    +
    +    groupLevel: function () {
    +      if (!this.props.reduce) {
    +        return null;
    +      }
    +
    +      return (
    +        <label className="drop-down inline" id="qoGroupLevelGroup">
    +          Group Level
    +          <select onChange={this.groupLevelChange} id="qoGroupLevel" 
value={this.props.groupLevel} name="group_level" className="input-small">
    +            <option value="0">None</option>
    +            <option value="1">1</option>
    +            <option value="2">2</option>
    +            <option value="3">3</option>
    +            <option value="4">4</option>
    +            <option value="5">5</option>
    +            <option value="6">6</option>
    +            <option value="7">7</option>
    +            <option value="8">8</option>
    +            <option value="9">9</option>
    +            <option value="exact">Exact</option>
    +          </select>
    +        </label>
    +      );
    +    },
    +
    +    reduce: function () {
    +      if (!this.props.showReduce) {
    +        return null;
    +      }
    +
    +      return (
    +        <span>
    +          <div className="checkbox inline">
    +            <input id="qoReduce" name="reduce" 
onChange={this.props.toggleReduce} type="checkbox" checked={this.props.reduce} 
/>
    +            <label htmlFor="qoReduce">Reduce</label>
    +          </div>
    +          {this.groupLevel()}
    +        </span>
    +      );
    +    },
    +
    +    render: function () {
    +      var includeDocs = this.props.includeDocs;
    +      return (
    +        <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">
    +              <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} 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()}
    +            </div>
    +          </div>
    +        </div>
    +      );
    +    }
    +
    +  });
    +
    +  var KeySearchFields = React.createClass({
    +    toggleByKeys: function () {
    +      this.props.toggleByKeys();
    +    },
    +
    +    toggleBetweenKeys: function () {
    +      this.props.toggleBetweenKeys();
    +    },
    +
    +    updateBetweenKeys: function () {
    +      this.props.updateBetweenKeys({
    +        startkey: this.refs.startkey.getDOMNode().value,
    +        endkey: this.refs.endkey.getDOMNode().value,
    +        inclusive_end: this.refs.inclusive_end.getDOMNode().value
    +      });
    +    },
    +
    +    updateByKeys: function (e) {
    +      this.props.updateByKeys(e.target.value);
    +    },
    +
    +    render: function () {
    +      var keysGroupClass = 'controls-group well js-query-keys-wrapper ';
    +      var byKeysClass = 'row-fluid js-keys-section ';
    +      var betweenKeysClass = byKeysClass;
    +      var byKeysButtonClass = 'drop-down btn ';
    +      var betweenKeysButtonClass = byKeysButtonClass;
    +
    +      if (!this.props.showByKeys && !this.props.showBetweenKeys) {
    +        keysGroupClass += 'hide';
    +      }
    +
    +      if (!this.props.showByKeys) {
    +        byKeysClass += 'hide';
    +      } else {
    +        byKeysButtonClass += 'active';
    +      }
    +
    +      if (!this.props.showBetweenKeys) {
    +        betweenKeysClass += 'hide';
    +      } else {
    +        betweenKeysButtonClass += 'active';
    +      }
    +
    +      return (
    +        <div className="query-group" id="query-options-key-search">
    +          <div className="add-on">Keys</div>
    +          <div className="btn-group toggle-btns row-fluid">
    +            <label onClick={this.toggleByKeys} 
className={byKeysButtonClass}>By Key(s)</label>
    +            <label onClick={this.toggleBetweenKeys} 
className={betweenKeysButtonClass}>Between Keys</label>
    +          </div>
    +
    +          <div className={keysGroupClass}>
    +            <div className={byKeysClass} id="js-showKeys">
    +              <div className="controls controls-row">
    +                <label htmlFor="keys-input" className="drop-down">A key, 
or an array of keys.</label>
    +                <textarea value={this.props.byKeys} 
onChange={this.updateByKeys} id="keys-input" className="input-xxlarge" rows="5" 
type="text"
    +                  placeholder='Enter valid JSON; e.g., ["1234"] or 
["1234","2345"]'></textarea>
    +                <div id="keys-error" className="inline-block 
js-keys-error"></div>
    +              </div>
    +            </div>
    +
    +            <div className={betweenKeysClass} id="js-showStartEnd">
    +              <div className="controls controls-row">
    +                <div>
    +                  <label htmlFor="startkey" className="drop-down">Start 
key</label>
    +                  <input id="startkey" ref="startkey" type="text" 
onChange={this.updateBetweenKeys} value={this.props.betweenKeys.startkey} 
placeholder='e.g., "1234"' />
    +                </div>
    +                <div>
    +                  <label htmlFor="endkey" className="drop-down">End 
key</label>
    +                  <input id="endkey" ref="endkey" 
onChange={this.updateBetweenKeys} value={this.props.betweenKeys.end} 
type="text" placeholder='e.g., "1234"'/>
    +                  <div className="controls include-end-key-row checkbox 
controls-row inline">
    +                    <input id="qoIncludeEndKeyInResults" 
ref="inclusive_end" type="checkbox" onChange={this.updateBetweenKeys} 
checked={this.props.betweenKeys.include}/>
    +                    <label htmlFor="qoIncludeEndKeyInResults">Include End 
Key in results</label>
    +                  </div>
    +                </div>
    +              </div>
    +            </div>
    +          </div>
    +
    +        </div>
    +      );
    +    }
    +  });
    +
    +  var AdditionalParams = React.createClass({
    +    showStale: function () {
    +      if (!this.props.showStale) {
    +        return null;
    +      }
    +
    +      return (
    +        <div className="checkbox inline">
    +          <input id="qoStale" name="stale" type="checkbox" 
defaultValue="ok" />
    +          <label htmlFor="qoStale">Stale</label>
    +        </div>
    +      );
    +    },
    +
    +    updateSkip: function (e) {
    +      e.preventDefault();
    +      var val = e.target.value;
    +
    +      //check skip is only numbers
    +      if (_.isNull(val.match(/^\d*$/))) {
    +        val = this.props.skip;
    +        FauxtonAPI.addNotification({
    +          msg: 'Skip can only be a number',
    +          type: 'error'
    +        });
    +        val = this.props.skip;
    --- End diff --
    
    duplicate to line 208 without functionality?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to