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 content moved to React
Date Wed, 04 Mar 2015 18:05:52 GMT
Github user benkeen commented on a diff in the pull request:

    https://github.com/apache/couchdb-fauxton/pull/303#discussion_r25797108
  
    --- Diff: app/addons/documents/changes/stores.js ---
    @@ -15,51 +15,58 @@ define([
       'addons/documents/changes/actiontypes'
     ], function (FauxtonAPI, ActionTypes) {
     
    -  var Stores = {};
    -
     
    -  // tracks the state of the header (open/closed)
    -  var ChangesHeaderStore = FauxtonAPI.Store.extend({
    +  var ChangesStore = FauxtonAPI.Store.extend({
         initialize: function () {
           this.reset();
         },
     
         reset: function () {
           this._tabVisible = false;
    +      this._filters = [];
    +      this._changes = [];
    +      this._databaseName = '';
    +      this._maxChangesListed = 1000;
    +      this._showingSubset = false;
         },
     
    -    toggleTabVisibility: function () {
    -      this._tabVisible = !this._tabVisible;
    +    setChanges: function (options) {
    +      this._filters = options.filters;
    +      this._databaseName = options.databaseName;
    +      this._changes = _.map(options.changes, function (change) {
    +        return {
    +          id: change.get('id'),
    +          seq: change.get('seq'),
    +          deleted: change.get('deleted') ? change.get('deleted') : false,
    +          changes: change.get('changes'),
    +          doc: change.get('doc') // only populated with ?include_docs=true
    +        };
    +      });
         },
     
    -    isTabVisible: function () {
    -      return this._tabVisible;
    +    getChanges: function () {
    +      var matches = _.reduce(this._filters, function (elements, filter) {
    +        return _.filter(elements, function (element) {
    +          var match = false;
    +          _.each(element, function (value) {
    +            if (!_.isUndefined(value) && new RegExp(filter, 'i').test(value.toString()))
{
    +              match = true;
    +            }
    +          });
    +          return match;
    +        });
    +      }, this._changes, this);
    +
    +      this._showingSubset = matches.length > this._maxChangesListed;
    +      return matches.slice(0, this._maxChangesListed);
         },
    --- End diff --
    
    True!


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