couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r957962 - in /couchdb/branches/0.11.x/share/www: replicator.html script/jquery.couch.js
Date Fri, 25 Jun 2010 14:14:02 GMT
Author: jan
Date: Fri Jun 25 14:14:01 2010
New Revision: 957962

URL: http://svn.apache.org/viewvc?rev=957962&view=rev
Log:
Merge r955290 from trunk:

add continuous replication support to Futon

Modified:
    couchdb/branches/0.11.x/share/www/replicator.html
    couchdb/branches/0.11.x/share/www/script/jquery.couch.js

Modified: couchdb/branches/0.11.x/share/www/replicator.html
URL: http://svn.apache.org/viewvc/couchdb/branches/0.11.x/share/www/replicator.html?rev=957962&r1=957961&r2=957962&view=diff
==============================================================================
--- couchdb/branches/0.11.x/share/www/replicator.html [utf-8] (original)
+++ couchdb/branches/0.11.x/share/www/replicator.html [utf-8] Fri Jun 25 14:14:01 2010
@@ -78,17 +78,28 @@ specific language governing permissions 
           $("#records tbody.content").empty();
           var source = $("#from_local")[0].checked ? $("#from_name").val() : $("#from_url").val();
           var target = $("#to_local")[0].checked ? $("#to_name").val() : $("#to_url").val();
+          var repOpts = {};
+          if ($("#continuous")[0].checked) {
+            repOpts.continuous = true;
+          }
           $.couch.replicate(source, target, {
             success: function(resp) {
-              $.each(resp.history, function(idx, record) {
+              if (resp._local_id) {
                 $("<tr><th></th></tr>")
-                  .find("th").text(JSON.stringify(record)).end()
+                  .find("th").text(JSON.stringify(resp)).end()
                   .appendTo("#records tbody.content");
-              });
-              $("#records tbody tr").removeClass("odd").filter(":odd").addClass("odd");
-              $("#records tbody.footer td").text("Replication session " + resp.session_id);
+                $("#records tbody tr").removeClass("odd").filter(":odd").addClass("odd");
+              } else {
+                $.each(resp.history, function(idx, record) {
+                  $("<tr><th></th></tr>")
+                    .find("th").text(JSON.stringify(record)).end()
+                    .appendTo("#records tbody.content");
+                });
+                $("#records tbody tr").removeClass("odd").filter(":odd").addClass("odd");
+                $("#records tbody.footer td").text("Replication session " + resp.session_id);
+              }
             }
-          });
+          }, repOpts);
         });
       });
     </script>
@@ -123,6 +134,7 @@ specific language governing permissions 
           </p>
         </fieldset>
         <p class="actions">
+          <label><input type="checkbox" name="continuous" value="continuous" id="continuous">
Continuous</label>
           <button id="replicate" type="button">Replicate</button>
         </p>
       </form>

Modified: couchdb/branches/0.11.x/share/www/script/jquery.couch.js
URL: http://svn.apache.org/viewvc/couchdb/branches/0.11.x/share/www/script/jquery.couch.js?rev=957962&r1=957961&r2=957962&view=diff
==============================================================================
--- couchdb/branches/0.11.x/share/www/script/jquery.couch.js [utf-8] (original)
+++ couchdb/branches/0.11.x/share/www/script/jquery.couch.js [utf-8] Fri Jun 25 14:14:01 2010
@@ -481,11 +481,14 @@
       );
     },
 
-    replicate: function(source, target, ajaxOptions, replicationOptions) {
-      replicationOptions = $.extend({source: source, target: target}, replicationOptions);
+    replicate: function(source, target, ajaxOptions, repOpts) {
+      $.extend(repOpts, {source: source, target: target});
+      if (repOpts.continuous) {
+        ajaxOptions.successStatus = 202;
+      }
       ajax({
           type: "POST", url: this.urlPrefix + "/_replicate",
-          data: JSON.stringify(replicationOptions),
+          data: JSON.stringify(repOpts),
           contentType: "application/json"
         },
         ajaxOptions,



Mime
View raw message