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

    https://github.com/apache/couchdb-fauxton/pull/713#discussion_r64248852
  
    --- Diff: app/addons/documents/changes/components.react.jsx ---
    @@ -21,171 +21,177 @@ define([
       '../../components/react-components.react',
     
       'react-addons-css-transition-group',
    -  '../../../../assets/js/plugins/prettify',
    +  '../../../../assets/js/plugins/prettify'
     ], function (app, FauxtonAPI, React, ReactDOM, Actions, Stores, 
Components, ReactComponents, ReactCSSTransitionGroup) {
     
    -  var changesStore = Stores.changesStore;
    -
    +  var store = Stores.changesStore;
       var BadgeList = ReactComponents.BadgeList;
     
    -  // the top-level component for the Changes Filter section. Handles 
hiding/showing of the filters form
    -  var ChangesHeaderController = React.createClass({
    -    getInitialState: function () {
    -      return this.getStoreState();
    -    },
     
    -    getStoreState: function () {
    +  class ChangesController extends React.Component {
    +    constructor (props) {
    +      super(props);
    +      this.state = this.getStoreState();
    +    }
    +
    +    getStoreState () {
           return {
    -        showTabContent: changesStore.isTabVisible()
    +        changes: store.getChanges(),
    +        loaded: store.isLoaded(),
    +        databaseName: store.getDatabaseName(),
    +        isShowingSubset: store.isShowingSubset()
           };
    -    },
    +    }
     
    -    onChange: function () {
    +    onChange () {
           this.setState(this.getStoreState());
    -    },
    -
    -    componentDidMount: function () {
    -      changesStore.on('change', this.onChange, this);
    -    },
    +    }
     
    -    componentWillUnmount: function () {
    -      changesStore.off('change', this.onChange);
    -    },
    +    componentDidMount () {
    +      store.on('change', this.onChange, this);
    +    }
     
    -    toggleFilterSection: function () {
    -      Actions.toggleTabVisibility();
    -    },
    +    componentWillUnmount () {
    +      store.off('change', this.onChange);
    +    }
     
    -    render: function () {
    -      var tabContent = '';
    -      if (this.state.showTabContent) {
    -        tabContent = <ChangesTabContent key="changesFilterSection" />;
    +    showingSubsetMsg () {
    +      const { isShowingSubset, changes } = this.state;
    +      var msg = '';
    +      if (isShowingSubset) {
    +        var numChanges = changes.length;
    +        msg = <p className="changes-result-limit">Limiting results to 
latest <b>{numChanges}</b> changes.</p>;
           }
    -
    -      return (
    -        <div className="changes-header-section">
    -          <ChangesHeaderTab onToggle={this.toggleFilterSection} />
    -          <ReactCSSTransitionGroup transitionName="toggle-changes-filter" 
component="div" className="changes-tab-content"
    -             transitionEnterTimeout={500} transitionLeaveTimeout={300}>
    -            {tabContent}
    -          </ReactCSSTransitionGroup>
    -        </div>
    -      );
    +      return msg;
         }
    -  });
     
    +    getRows () {
    +      const { changes, loaded, databaseName } = this.state;
    +      if (!changes.length && loaded) {
    +        return (
    +          <p className="no-doc-changes">
    +            There are no document changes to display.
    +          </p>
    +        );
    +      }
     
    -  var ChangesHeaderTab = React.createClass({
    -    propTypes: {
    -      onToggle: React.PropTypes.func.isRequired
    -    },
    +      return _.map(changes, function (change) {
    +        var key = change.id + '-' + change.seq;
    --- End diff --
    
    key can just be the index i a map provides, right?
    
    ```
    changes.map((change, i) => {
    
    })
    ```


---
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