You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ga...@apache.org on 2014/07/02 10:07:17 UTC

[1/2] couchdb commit: updated refs/heads/master to 88e1bca

Repository: couchdb
Updated Branches:
  refs/heads/master fda86ae1c -> 88e1bca62


Fix missing stale query option


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/dc1b1484
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/dc1b1484
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/dc1b1484

Branch: refs/heads/master
Commit: dc1b1484918205570db34349c5875f7e050d31f9
Parents: fda86ae
Author: Garren Smith <ga...@gmail.com>
Authored: Mon Jun 30 12:27:18 2014 +0200
Committer: Garren Smith <ga...@gmail.com>
Committed: Mon Jun 30 12:27:18 2014 +0200

----------------------------------------------------------------------
 .../documents/templates/advanced_options.html   |  8 ++-----
 src/fauxton/app/addons/documents/views.js       | 22 +++++++-------------
 2 files changed, 9 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/dc1b1484/src/fauxton/app/addons/documents/templates/advanced_options.html
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/documents/templates/advanced_options.html b/src/fauxton/app/addons/documents/templates/advanced_options.html
index 439e864..c986d4e 100644
--- a/src/fauxton/app/addons/documents/templates/advanced_options.html
+++ b/src/fauxton/app/addons/documents/templates/advanced_options.html
@@ -101,10 +101,10 @@ the License.
       </div>
     </div>
     <div class="row-fluid">
-      <% if (showPreview) { %>
+      <% if (showStale) { %>
         <div class="span6">
           <div class="checkbox inline">
-            <input id="check7" name="stale" type="checkbox" value="true">
+            <input id="check7" name="stale" type="checkbox" value="ok">
             <label for="check7">Stale</label>
           </div>
         </div>
@@ -147,10 +147,6 @@ the License.
   <% } %>
   </div>
 
-
-
-
-
   <div class="controls-group">
     <div id="button-options" class="controls controls-row">
       <button type="submit" class="btn btn-success">Query</button>

http://git-wip-us.apache.org/repos/asf/couchdb/blob/dc1b1484/src/fauxton/app/addons/documents/views.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/documents/views.js b/src/fauxton/app/addons/documents/views.js
index 97f82b4..4e7459a 100644
--- a/src/fauxton/app/addons/documents/views.js
+++ b/src/fauxton/app/addons/documents/views.js
@@ -592,7 +592,7 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb,
     toggleTrash: function () {
       var $bulkdDeleteButton = this.$('.js-bulk-delete');
 
-      if (this.bulkDeleteDocsCollection.length > 0) {
+      if (this.bulkDeleteDocsCollection && this.bulkDeleteDocsCollection.length > 0) {
         $bulkdDeleteButton.removeClass('disabled');
       } else {
         $bulkdDeleteButton.addClass('disabled');
@@ -1016,18 +1016,8 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb,
       this.viewName = options.viewName;
       this.updateViewFn = options.updateViewFn;
       this.previewFn = options.previewFn;
-
-      if (typeof(options.hasReduce) === 'undefined') {
-        this.hasReduce = true;
-      } else {
-        this.hasReduce = options.hasReduce;
-      }
-
-      /*if (typeof(options.showPreview) === 'undefined') {
-        this.showPreview = true;
-      } else {
-        this.showPreview = options.showPreview;
-      }*/
+      this.showStale = _.isUndefined(options.showStale) ? false : options.showStale;
+      this.hasReduce = _.isUndefined(options.hasReduce) ? true : options.hasReduce;
     },
 
     events: {
@@ -1253,7 +1243,8 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb,
     serialize: function () {
       return {
         hasReduce: this.hasReduce,
-        showPreview: false
+        showPreview: false,
+        showStale: this.showStale
       };
     }
   });
@@ -1735,7 +1726,8 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb,
           viewName: this.viewName,
           ddocName: this.model.id,
           hasReduce: this.hasReduce(),
-          eventer: this.eventer
+          eventer: this.eventer,
+          showStale: true
         }));
       }
 


[2/2] couchdb commit: updated refs/heads/master to 88e1bca

Posted by ga...@apache.org.
Fauxton: Add view filter

This allows a module to register an extension to filter out what views
should be displayed in the side bar.
An example of usage is to only display views that have
"language:javascript"


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/88e1bca6
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/88e1bca6
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/88e1bca6

Branch: refs/heads/master
Commit: 88e1bca621bec214e2d297e765457b3e9f10654a
Parents: dc1b148
Author: Garren Smith <ga...@gmail.com>
Authored: Tue Jul 1 14:31:12 2014 +0200
Committer: Garren Smith <ga...@gmail.com>
Committed: Wed Jul 2 10:06:45 2014 +0200

----------------------------------------------------------------------
 src/fauxton/app/addons/documents/resources.js |  8 +++++++
 src/fauxton/app/addons/documents/views.js     | 26 +++++++++++++++++++---
 2 files changed, 31 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/88e1bca6/src/fauxton/app/addons/documents/resources.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/documents/resources.js b/src/fauxton/app/addons/documents/resources.js
index 21cdfdd..dc71153 100644
--- a/src/fauxton/app/addons/documents/resources.js
+++ b/src/fauxton/app/addons/documents/resources.js
@@ -482,6 +482,14 @@ function(app, FauxtonAPI, PagingCollection) {
       });
 
       return PagingCollection.prototype.parse.call(this, resp);
+    },
+
+    clone: function () {
+      return new this.constructor(this.models, {
+        database: this.database,
+        params: this.params,
+        paging: this.paging
+      });
     }
   });
 

http://git-wip-us.apache.org/repos/asf/couchdb/blob/88e1bca6/src/fauxton/app/addons/documents/views.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/documents/views.js b/src/fauxton/app/addons/documents/views.js
index 4e7459a..6ccb733 100644
--- a/src/fauxton/app/addons/documents/views.js
+++ b/src/fauxton/app/addons/documents/views.js
@@ -26,7 +26,7 @@ define([
        // Plugins
        "plugins/beautify",
        "plugins/prettify",
-       // this should be never global available:
+       // this should never be global available:
        // https://github.com/zeroclipboard/zeroclipboard/blob/master/docs/security.md
        "plugins/zeroclipboard/ZeroClipboard"
 ],
@@ -1710,8 +1710,19 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb,
         this.reduceFunStr = this.model.viewHasReduce(this.viewName);
       }
 
+      var viewFilters = FauxtonAPI.getExtensions('sidebar:viewFilters'),
+          filteredModels = this.ddocs.models,
+          designDocs = this.ddocs.clone();
+
+      if (!_.isEmpty(viewFilters)) {
+        _.each(viewFilters, function (filter) {
+          filteredModels = _.filter(filteredModels, filter);
+        });
+        designDocs.reset(filteredModels, {silent: true});
+      }
+
       this.designDocSelector = this.setView('.design-doc-group', new Views.DesignDocSelector({
-        collection: this.ddocs,
+        collection: designDocs,
         ddocName: this.model.id,
         database: this.database
       }));
@@ -1874,7 +1885,16 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb,
         extension.render();
       }, this);
 
-      this.collection.each(function(design) {
+      var viewFilters = FauxtonAPI.getExtensions('sidebar:viewFilters'),
+          collection = this.collection.models;
+
+      if (!_.isEmpty(viewFilters)) {
+        _.each(viewFilters, function (filter) {
+          collection = _.filter(collection, filter);
+        });
+      }
+
+      _.each(collection, function(design) {
         if (design.has('doc')){
           var ddoc = design.id.replace(/^_design\//,"");
           if (design.get('doc').views){