garrensmith commented on a change in pull request #986: Refactor map/reduce 
views to use Redux
URL: https://github.com/apache/couchdb-fauxton/pull/986#discussion_r142064985
 
 

 ##########
 File path: app/addons/documents/index-editor/components/DesignDocSelector.js
 ##########
 @@ -0,0 +1,116 @@
+// 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 React, { Component } from "react";
+import ReactDOM from "react-dom";
+import FauxtonAPI from "../../../../core/api";
+import ReactComponents from "../../../components/react-components";
+
+const StyledSelect = ReactComponents.StyledSelect;
+
+export default class DesignDocSelector extends Component {
+
+  constructor(props) {
+    super(props);
+  }
+
+  validate() {
+    if (this.props.selectedDesignDocName === 'new-doc' && 
this.props.newDesignDocName === '') {
+      FauxtonAPI.addNotification({
+        msg: 'Please name your design doc.',
+        type: 'error'
+      });
+      ReactDOM.findDOMNode(this.refs.newDesignDoc).focus();
+      return false;
+    }
+    return true;
+  }
+
+  getDocList() {
+    return _.map(this.props.designDocList, function (designDoc) {
+      return (<option key={designDoc} value={designDoc}>{designDoc}</option>);
+    });
+  }
+
+  selectDesignDoc(e) {
+    this.props.onSelectDesignDoc(e.target.value);
+  }
+
+  updateDesignDocName(e) {
+    this.props.onChangeNewDesignDocName(e.target.value);
+  }
+
+  getNewDDocField() {
+    if (this.props.selectedDesignDocName !== 'new-doc') {
+      return;
+    }
+    return (
+      <div id="new-ddoc-section" className="span5">
+        <label className="control-label" htmlFor="new-ddoc">_design/</label>
+        <div className="controls">
+          <input type="text" ref="newDesignDoc" id="new-ddoc" 
placeholder="newDesignDoc"
 
 Review comment:
   String refs are discouraged. Can you change this to a callback ref.
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to