garrensmith commented on a change in pull request #950: Simplify Mango/Query
panel layout
URL: https://github.com/apache/couchdb-fauxton/pull/950#discussion_r132200379
##########
File path: app/addons/documents/mango/mango.components.js
##########
@@ -268,16 +250,39 @@ var MangoIndexEditorController = React.createClass({
return;
}
- Actions.saveQuery({
+ Actions.saveIndex({
database: this.state.database,
queryCode: this.getMangoEditor().getEditorValue()
});
}
});
+var ExplainPage = React.createClass({
+ propTypes: {
+ explainPlan: React.PropTypes.object.isRequired
+ },
+
+ componentDidMount: function () {
+ prettyPrint();
+ },
+
+ componentDidUpdate: function () {
+ prettyPrint();
+ },
+
+ render: function () {
+ return (
+ <div>
+ <pre className="prettyprint">{JSON.stringify(this.props.explainPlan,
null, ' ')}</pre>
+ </div>
+ );
+ }
+});
+
var Views = {
Review comment:
You can rewrite this as
```
export default {
MangoIndexEditorController,
MangoQueryEditorController,
ExplainPage
};
```
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services