couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From deathb...@apache.org
Subject couchdb commit: updated refs/heads/2189-ddoc-info-on-demand to 672198e
Date Mon, 10 Mar 2014 16:03:05 GMT
Repository: couchdb
Updated Branches:
  refs/heads/2189-ddoc-info-on-demand [created] 672198ebe


Set the triggering of the call to poll or stop polling ddoc metadata in the tab toggling


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

Branch: refs/heads/2189-ddoc-info-on-demand
Commit: 672198ebe4d714255fa88a37c73849a61ebac041
Parents: b63ff1b
Author: suelockwood <deathbear@apache.org>
Authored: Mon Mar 10 09:34:59 2014 -0400
Committer: suelockwood <deathbear@apache.org>
Committed: Mon Mar 10 12:02:53 2014 -0400

----------------------------------------------------------------------
 src/fauxton/app/addons/documents/views.js | 27 +++++++++++++++++++-------
 1 file changed, 20 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/672198eb/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 54ec261..1807bb8 100644
--- a/src/fauxton/app/addons/documents/views.js
+++ b/src/fauxton/app/addons/documents/views.js
@@ -1274,7 +1274,8 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb,
resizeColum
       "click #db-views-tabs-nav": 'toggleIndexNav',
       "click .beautify_map":  "beautifyCode",
       "click .beautify_reduce":  "beautifyCode",
-      "click #query-options-wrapper": 'toggleIndexNav'
+      "click #query-options-wrapper": 'toggleIndexNav',
+      "click #meta-nav" : "toggleDdocInfo"
     },
 
     langTemplates: {
@@ -1577,6 +1578,8 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb,
resizeColum
       if ($targetTab.attr('id') !== $previousTab.attr('id')) {
         $previousTab.removeAttr('style');
       }
+      //stop polling
+      this.ddocInfoView.stopRefreshInterval(); 
 
       if ($targetId === 'index-nav') {
         if (this.newView) { return; }
@@ -1585,6 +1588,11 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb,
resizeColum
         $targetTab.toggle('slow', function(){
            that.showEditors();
         });
+      } else if ($targetId === "meta-nav"){
+        if ($previousTab.attr('id') !== "metadata"){
+          this.ddocInfoView.startRefreshInterval();
+        } 
+        $targetTab.toggle('slow'); 
       } else {
         $targetTab.toggle('slow');
       }
@@ -1628,7 +1636,14 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb,
resizeColum
         $('.beautify-tooltip').tooltip();
       }
     },
+    renderDdocInfo: function(){
+      if(this.ddocInfoView){
+        this.ddocInfoView.remove();
+      } 
+      this.ddocInfoView = this.setView('#ddoc-info', new Views.DdocInfo({model: this.ddocInfo
}));
+      this.ddocInfoView.render();
 
+    },
     beforeRender: function () {
 
       if (this.newView) {
@@ -1643,7 +1658,7 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb,
resizeColum
         var ddocDecode = decodeURIComponent(this.ddocID);
         this.model = this.ddocs.get(ddocDecode).dDocModel();
         this.reduceFunStr = this.model.viewHasReduce(this.viewName);
-        this.setView('#ddoc-info', new Views.DdocInfo({model: this.ddocInfo }));
+        
       }
 
       this.designDocSelector = this.setView('.design-doc-group', new Views.DesignDocSelector({
@@ -1670,6 +1685,8 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb,
resizeColum
     },
 
     afterRender: function() {
+      this.renderDdocInfo();
+
       if (this.params && !this.newView) {
         this.advancedOptions.updateFromParams(this.params);
       }
@@ -1872,15 +1889,11 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb,
resizeColum
       };
     },
 
-    afterRender: function () {
-      this.startRefreshInterval();
-    },
-
     startRefreshInterval: function () {
       var model = this.model;
 
       // Interval already set
-      if (this.intervalId) { return ; }
+      if (this.intervalId) { this.stopRefreshInterval(); }
 
       this.intervalId = setInterval(function () {
         model.fetch();


Mime
View raw message