summaryrefslogtreecommitdiff
path: root/rel/overlay/share/www/replicator.html
diff options
context:
space:
mode:
authorRobert Newson <robert.newson@cloudant.com>2011-06-13 14:59:55 +0100
committerRobert Newson <robert.newson@cloudant.com>2011-06-13 14:59:55 +0100
commite9a5a6f90a021db1db8a7e55ec797a4c86edcad6 (patch)
tree06d0c28969cfcf54b2f137e7407b097f73aa0f21 /rel/overlay/share/www/replicator.html
parent266ba88ac6ded40087e0211ad9e75e4ce64e66cb (diff)
parent3c1a0d7e2c9adef4f8b20c9df205a86e5c0feefb (diff)
Merge CouchDB 1.1
Diffstat (limited to 'rel/overlay/share/www/replicator.html')
-rw-r--r--rel/overlay/share/www/replicator.html51
1 files changed, 40 insertions, 11 deletions
diff --git a/rel/overlay/share/www/replicator.html b/rel/overlay/share/www/replicator.html
index 70c0a86c..dced6f9c 100644
--- a/rel/overlay/share/www/replicator.html
+++ b/rel/overlay/share/www/replicator.html
@@ -18,14 +18,18 @@ specific language governing permissions and limitations under the License.
<title>Replicator</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<link rel="stylesheet" href="style/layout.css?0.11.0" type="text/css">
+ <link rel="stylesheet" href="style/jquery-ui-1.8.11.custom.css" type="text/css">
<script src="script/json2.js"></script>
<script src="script/sha1.js"></script>
<script src="script/jquery.js?1.4.2"></script>
<script src="script/jquery.couch.js?0.11.0"></script>
<script src="script/jquery.dialog.js?0.11.0"></script>
<script src="script/futon.js?0.11.0"></script>
+ <script src="script/jquery-ui-1.8.11.custom.min.js"></script>
<script>
$(document).ready(function() {
+ var allDatabases;
+
$("fieldset input[type=radio]").click(function() {
var radio = this;
var fieldset = $(this).parents("fieldset").get(0);
@@ -33,15 +37,17 @@ specific language governing permissions and limitations under the License.
this.disabled = radio.value == "local";
if (!this.disabled) this.focus();
});
- $("select", fieldset).each(function() {
+ $('.local', fieldset).each(function() {
this.disabled = radio.value == "remote";
if (!this.disabled) this.focus();
});
});
+ var getDatabases = function() {
$.couch.allDbs({
success: function(dbs) {
- dbs.sort();
+ allDatabases = dbs.sort();
+
$("fieldset select").each(function() {
var select = this;
$.each(dbs, function(idx, dbName) {
@@ -49,8 +55,12 @@ specific language governing permissions and limitations under the License.
});
select.selectedIndex = 0;
});
+
+ $('#to_name').autocomplete({ source: dbs });
}
});
+ };
+ getDatabases();
$("button#swap").click(function() {
var fromName = $("#source select").val();
@@ -76,9 +86,20 @@ specific language governing permissions and limitations under the License.
$("button#replicate").click(function() {
$("#records tbody.content").empty();
+ var targetIsLocal = $('#to_local:checked').length > 0;
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 target = targetIsLocal ? $("#to_name").val() : $("#to_url").val();
var repOpts = {};
+
+ if (targetIsLocal && $.inArray(target, allDatabases) < 0) {
+ if(!confirm('This will create a database named '+target+'. Ok?')) {
+ return;
+ }
+ else {
+ repOpts.create_target = true;
+ }
+ }
+
if ($("#continuous")[0].checked) {
repOpts.continuous = true;
}
@@ -97,6 +118,10 @@ specific language governing permissions and limitations under the License.
});
$("#records tbody tr").removeClass("odd").filter(":odd").addClass("odd");
$("#records tbody.footer td").text("Replication session " + resp.session_id);
+
+ if (repOpts.create_target) {
+ getDatabases();
+ }
}
}
}, repOpts);
@@ -115,22 +140,26 @@ specific language governing permissions and limitations under the License.
<fieldset id="source">
<legend>Replicate changes from:</legend>
<p>
- <label><input type="radio" id="from_local" name="from_type" value="local" checked> Local</label>
- <label>database: <select id="from_name" name="from_name"></select></label>
+ <input type="radio" id="from_local" name="from_type" value="local" checked>
+ <label for="from_local">Local Database: </label>
+ <select id="from_name" name="from_name" class="local"></select>
</p><p>
- <label><input type="radio" id="from_to_remote" name="from_type" value="remote"> Remote</label>
- <label>database: <input type="text" id="from_url" name="from_url" size="30" value="http://" disabled></label>
+ <input type="radio" id="from_to_remote" name="from_type" value="remote">
+ <label for="from_to_remote">Remote database: </label>
+ <input type="text" id="from_url" name="from_url" size="30" value="http://" disabled>
</p>
</fieldset>
<p class="swap"><button id="swap" tabindex="99">⇄</button></p>
<fieldset id="target">
<legend>to:</legend>
<p>
- <label><input type="radio" id="to_local" name="to_type" value="local" checked> Local</label>
- <label>database: <select id="to_name" name="to_name"></select></label>
+ <input type="radio" id="to_local" name="to_type" value="local" checked>
+ <label for="to_local">Local database: </label>
+ <input type="text" id="to_name" name="to_name" class="local"></select>
</p><p>
- <label><input type="radio" id="to_remote" name="to_type" value="remote"> Remote</label>
- <label>database: <input type="text" id="to_url" name="to_url" size="30" value="http://" disabled></label>
+ <input type="radio" id="to_remote" name="to_type" value="remote">
+ <label for="to_remote">Remote database: </label>
+ <input type="text" id="to_url" name="to_url" size="30" value="http://" disabled>
</p>
</fieldset>
<p class="actions">