Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
Merged futon-async branch back into trunk.
git-svn-id: https://svn.apache.org/repos/asf/incubator/couchdb/trunk@648074 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
cmlenz committed Apr 15, 2008
1 parent 8a733a5 commit eb0d5a0c9f4b1f09e779f46fd21b00987020a71a
Show file tree
Hide file tree
Showing 12 changed files with 728 additions and 333 deletions.
@@ -21,20 +21,21 @@
<script src="../script/json2.js"></script>
<script src="../script/jquery.js"></script>
<script src="../script/jquery.cookies.js"></script>
<script src="../script/jquery.couch.js"></script>
<script src="../script/jquery.dialog.js"></script>
<script src="../script/jquery.resizer.js"></script>
<script src="../script/jquery.suggest.js"></script>
<script src="../script/couch.js"></script>
<script src="../script/browse.js"></script>
<script src="../script/pprint.js"></script>
<script>
var page = new CouchDatabasePage();
if (window != parent) {
parent.updateNavigation(location.pathname, location.search.split("/", 2)[0]);
parent.updateNavigation(location.pathname,
encodeURIComponent(location.search.split("/", 2)[0]));
}

$(document).ready(function() {
$("h1 strong").text(page.dbName);
$("h1 strong").text(page.db.name);
$("#viewcode label").click(function() {
$("#viewcode").toggleClass("expanded");
});
@@ -53,11 +54,11 @@
$("#viewcode textarea").resizable({grippie: $("#viewcode .bottom")});

// Restore preferences/state from cookies
var query = $.cookies.get(page.dbName + ".query");
var query = $.cookies.get(page.db.name + ".query");
if (query) $("#viewcode textarea").val(query);
var desc = $.cookies.get(page.dbName + ".desc");
var desc = $.cookies.get(page.db.name + ".desc");
if (desc) $("#documents thead th.key").addClass("desc");
var rowsPerPage = $.cookies.get(page.dbName + ".perpage");
var rowsPerPage = $.cookies.get(page.db.name + ".perpage");
if (rowsPerPage) $("#perpage").val(rowsPerPage);

page.populateViewsMenu();
@@ -66,16 +67,17 @@

$("#switch select").change(function() {
var viewName = $(this).val();
if (!viewName) $.cookies.remove(page.dbName + ".view");
location.href = "?" + page.dbName + (viewName ? "/" + viewName : "");
if (!viewName) $.cookies.remove(page.db.name + ".view");
location.href = "?" + encodeURIComponent(page.db.name) +
(viewName ? "/" + encodeURIComponent(viewName) : "");
});
$("#documents thead th.key").click(function() {
$(this).toggleClass("desc");
page.updateDocumentListing();
});
$("#perpage").change(function() {
page.updateDocumentListing();
$.cookies.set(page.dbName + ".perpage", this.value);
$.cookies.set(page.db.name + ".perpage", this.value);
});
$("#toolbar button.add").click(page.addDocument);
$("#toolbar button.compact").click(page.compactDatabase);
@@ -91,7 +93,7 @@ <h1>
</h1>
<div id="wrap">
<div id="switch">
<label>Select view: <select>
<label>Select view: <select autocomplete="false">
<option value="">All documents</option>
<option value="_design_docs">Design documents</option>
<option value="_temp_view">Custom query…</option>
@@ -21,9 +21,9 @@
<script src="../script/json2.js"></script>
<script src="../script/jquery.js"></script>
<script src="../script/jquery.cookies.js"></script>
<script src="../script/jquery.couch.js"></script>
<script src="../script/jquery.dialog.js"></script>
<script src="../script/jquery.resizer.js"></script>
<script src="../script/couch.js"></script>
<script src="../script/browse.js"></script>
<script src="../script/pprint.js"></script>
<script>
@@ -32,13 +32,14 @@
var dbLink = $("h1 a.dbname").get(0);
parent.updateNavigation(
location.pathname.replace(/document\.html/, "database.html"),
location.search.split("/")[0]
encodeURIComponent(location.search.split("/")[0])
);
}

$(function() {
$("h1 a.dbname").text(page.dbName).attr("href", "database.html?" + page.dbName);
$("h1 strong").text(page.doc._id);
$("h1 a.dbname").text(page.dbName)
.attr("href", "database.html?" + encodeURIComponent(page.db.name));
$("h1 strong").text(page.docId);
page.updateFieldListing();
$("#toolbar button.save").click(page.saveDocument);
$("#toolbar button.add").click(page.addField);
@@ -21,8 +21,8 @@
<script src="../script/json2.js"></script>
<script src="../script/jquery.js"></script>
<script src="../script/jquery.cookies.js"></script>
<script src="../script/jquery.couch.js"></script>
<script src="../script/jquery.dialog.js"></script>
<script src="../script/couch.js"></script>
<script src="../script/browse.js"></script>
<script src="../script/pprint.js"></script>
<script>
@@ -48,6 +48,12 @@ <h1>
<li><button class="run">Run All</button></li>
<li><button class="load">Reload</button></li>
</ul>
<p class="help">
<strong>Note:</strong> Each of the tests will block the browser. If the
connection to your CouchDB server is slow, running the tests will take
some time, and you'll not be able to do much with your browser while
a test is being executed.
</p>
<table class="listing" id="tests" cellspacing="0">
<caption>Tests</caption>
<thead>
BIN +10.6 KB image/progress.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN -8.76 KB (17%) image/spinner.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -28,16 +28,20 @@
</style>
<script src="script/json2.js"></script>
<script src="script/jquery.js"></script>
<script src="script/couch.js"></script>
<script src="script/jquery.couch.js"></script>
<script>
function updateDatabaseList() {
var dbs = CouchDB.allDbs();
$("#dbs").empty();
for (var i = 0; i < dbs.length; i++) {
var dbname = dbs[i];
$("#dbs").append("<li><a href='browse/database.html?" + dbname +
"' target='content'>" + dbname + "</a></li>");
}
var list = $("#dbs").empty();
var dbs = $.couch.allDbs({
success: function(dbs, status) {
for (var i = 0; i < dbs.length; i++) {
var dbName = dbs[i];
list.append("<li><a href='browse/database.html?" +
encodeURIComponent(dbName) + "' target='content'>" + dbName +
"</a></li>");
}
}
});
}
function updateNavigation(path, queryString) {
function fixupPath(path) { // hack for IE/Win
@@ -67,7 +71,11 @@
});
}
$(function() {
$("#version").text(CouchDB.getVersion());
$.couch.info({
success: function(info, status) {
$("#version").text(info.version);
}
});
updateDatabaseList();
});
</script>
@@ -20,7 +20,7 @@
<link rel="stylesheet" href="style/layout.css" type="text/css">
<script src="script/json2.js"></script>
<script src="script/jquery.js"></script>
<script src="script/couch.js"></script>
<script src="script/jquery.couch.js"></script>
<script src="script/pprint.js"></script>
<script>
$(document).ready(function() {
@@ -39,12 +39,17 @@
});
});

var allDbs = CouchDB.allDbs();
$("fieldset select").each(function() {
for (var i = 0; i < allDbs.length; i++) {
$("<option></option>").text(allDbs[i]).appendTo(this);

$.couch.allDbs({
success: function(dbs) {
$("fieldset select").each(function() {
var select = this;
$.each(dbs, function(idx, dbName) {
$("<option></option>").text(dbName).appendTo(select);
});
select.selectedIndex = 0;
});
}
this.selectedIndex = 0;
});

$("button#swap").click(function() {
@@ -73,24 +78,23 @@
$("#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();
try {
var results = CouchDB.replicate(source, target);
} catch (e) {
alert(e.reason);
return;
}
for (var i = 0; i < results.history.length; i++) {
var record = results.history[i];
$("<tr><th></th><td class='seq'></td>" +
"<td class='read'></td><td class='copied'></td></tr>")
.find("th").text(record.start_time).end()
.find("td.seq").text(record.start_last_seq + "–" + record.end_last_seq).end()
.find("td.read").text(record.docs_read + " (" + record.read_errors + " errors)").end()
.find("td.copied").text(record.docs_copied + " (" + record.copy_errors + " errors)").end()
.appendTo("#records tbody.content");
}
$("#records tbody tr").removeClass("odd").filter(":odd").addClass("odd");
$("#records tbody.footer td").text("Replication session " + results.session_id);
$(document.body).addClass("loading");
$.couch.replicate(source, target, {
success: function(resp) {
$.each(resp.history, function(idx, record) {
$("<tr><th></th><td class='seq'></td>" +
"<td class='read'></td><td class='copied'></td></tr>")
.find("th").text(record.start_time).end()
.find("td.seq").text(record.start_last_seq + "–" + record.end_last_seq).end()
.find("td.read").text(record.docs_read + " (" + record.read_errors + " errors)").end()
.find("td.copied").text(record.docs_copied + " (" + record.copy_errors + " errors)").end()
.appendTo("#records tbody.content");
});
$("#records tbody tr").removeClass("odd").filter(":odd").addClass("odd");
$("#records tbody.footer td").text("Replication session " + resp.session_id);
$(document.body).removeClass("loading");
}
});
});
});
</script>

0 comments on commit eb0d5a0

Please sign in to comment.