couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From benkeen <...@git.apache.org>
Subject [GitHub] couchdb-fauxton pull request: Changes page Filters tab moved to Re...
Date Wed, 11 Feb 2015 17:45:53 GMT
Github user benkeen commented on a diff in the pull request:

    https://github.com/apache/couchdb-fauxton/pull/265#discussion_r24515498
  
    --- Diff: app/addons/fauxton/components.react.jsx ---
    @@ -150,12 +151,133 @@ function(FauxtonAPI, React, Stores, Actions) {
       });
     
     
    +  var FilterView = React.createClass({
    +    propTypes: {
    +      namespace: React.PropTypes.string.isRequired
    +    },
    +
    +    getStoreState: function () {
    +      if (!this.filterViewStore) {
    +        this.initFilterViewStore();
    +      }
    +      return {
    +        filters: this.filterViewStore.getFilters()
    +      };
    +    },
    +
    +    // each instance of FilterView has its own store
    +    initFilterViewStore: function () {
    +      this.filterViewStore = new Stores.FilterViewStore(this.props.namespace);
    +      this.filterViewStore.dispatchToken = FauxtonAPI.dispatcher.register(this.filterViewStore.dispatch);
    +    },
    +
    +    onChange: function () {
    +      this.setState(this.getStoreState());
    +    },
    +
    +    // props belong to the parent, so these aren't stored in the related store
    +    getDefaultProps: function () {
    +      return {
    +        addItemPlaceholder: 'Type a filter',
    +        helpText: 'e.g. debug or <1.4.1> or any regex',
    +        namespace: '',
    +        tooltip: ''
    +      };
    +    },
    +
    +    getInitialState: function () {
    +      return this.getStoreState();
    +    },
    +
    +    submitForm: function (e) {
    +      e.preventDefault();
    +      e.stopPropagation();
    +
    +      var filter = this.refs.addItem.getDOMNode().value.trim();
    +      if (!filter) {
    +        return;
    +      }
    +
    +      Actions.addFilterViewItem(this.props.namespace, filter);
    +      this.refs.addItem.getDOMNode().value = '';
    +    },
    +
    +    componentDidMount: function () {
    +      this.filterViewStore.on('change', this.onChange, this);
    +      if (this.props.tooltip) {
    +        $(this.refs.tooltip.getDOMNode()).tooltip();
    +      }
    +    },
    +
    +    componentWillUnmount: function() {
    +      this.filterViewStore.off('change', this.onChange);
    +    },
    +
    +    render: function () {
    +      var tooltip = '';
    +      if (this.props.tooltip) {
    +        tooltip = '<i ref="tooltip" className="icon icon-question-sign" data-toggle="tooltip"
data-original-title=' +
    +          this.props.tooltipText + '></i>';
    --- End diff --
    
    move to helper


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message