diff options
-rw-r--r-- | share/www/replicator.html | 24 | ||||
-rw-r--r-- | share/www/script/jquery.couch.js | 9 |
2 files changed, 24 insertions, 9 deletions
diff --git a/share/www/replicator.html b/share/www/replicator.html index 9a53e0ea..70c0a86c 100644 --- a/share/www/replicator.html +++ b/share/www/replicator.html @@ -78,17 +78,28 @@ specific language governing permissions and limitations under the License. $("#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 and limitations under the License. </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> diff --git a/share/www/script/jquery.couch.js b/share/www/script/jquery.couch.js index efd646a4..11d11d0d 100644 --- a/share/www/script/jquery.couch.js +++ b/share/www/script/jquery.couch.js @@ -547,11 +547,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, |