You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by jc...@apache.org on 2009/02/22 08:31:27 UTC
svn commit: r746644 - in /couchdb/trunk/share/www: index.html
script/couch.js script/futon.browse.js script/jquery.couch.js
style/layout.css
Author: jchris
Date: Sun Feb 22 07:31:26 2009
New Revision: 746644
URL: http://svn.apache.org/viewvc?rev=746644&view=rev
Log:
Link to design docs that have ddoc.couchapp.index or index.html, from Futon database index.
Modified:
couchdb/trunk/share/www/index.html
couchdb/trunk/share/www/script/couch.js
couchdb/trunk/share/www/script/futon.browse.js
couchdb/trunk/share/www/script/jquery.couch.js
couchdb/trunk/share/www/style/layout.css
Modified: couchdb/trunk/share/www/index.html
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/index.html?rev=746644&r1=746643&r2=746644&view=diff
==============================================================================
--- couchdb/trunk/share/www/index.html [utf-8] (original)
+++ couchdb/trunk/share/www/index.html [utf-8] Sun Feb 22 07:31:26 2009
@@ -63,6 +63,7 @@
<tr>
<th>Name</th>
<th class="size">Size</th>
+ <th class="apps">Applications</th>
<th class="count">Number of Documents</th>
<th class="seq">Update Seq</th>
</tr>
@@ -71,7 +72,7 @@
</tbody>
<tbody class="footer">
<tr>
- <td colspan="4">
+ <td colspan="5">
<div id="paging">
<a class="prev">← Previous Page</a> |
<label>Rows per page: <select id="perpage">
Modified: couchdb/trunk/share/www/script/couch.js
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/script/couch.js?rev=746644&r1=746643&r2=746644&view=diff
==============================================================================
--- couchdb/trunk/share/www/script/couch.js [utf-8] (original)
+++ couchdb/trunk/share/www/script/couch.js [utf-8] Sun Feb 22 07:31:26 2009
@@ -177,6 +177,10 @@
CouchDB.maybeThrowError(this.last_req);
return JSON.parse(this.last_req.responseText);
}
+
+ this.designDocs = function() {
+ return this.allDocs({startkey:"_design", endkey:"_design0"});
+ };
this.allDocsBySeq = function(options,keys) {
var req = null;
@@ -263,6 +267,15 @@
return JSON.parse(CouchDB.last_req.responseText);
}
+CouchDB.allDesignDocs = function() {
+ var ddocs = {}, dbs = CouchDB.allDbs();
+ for (var i=0; i < dbs.length; i++) {
+ var db = new CouchDB(dbs[i]);
+ ddocs[dbs[i]] = db.designDocs();
+ };
+ return ddocs;
+};
+
CouchDB.getVersion = function() {
CouchDB.last_req = CouchDB.request("GET", "/");
CouchDB.maybeThrowError(CouchDB.last_req);
Modified: couchdb/trunk/share/www/script/futon.browse.js
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/script/futon.browse.js?rev=746644&r1=746643&r2=746644&view=diff
==============================================================================
--- couchdb/trunk/share/www/script/futon.browse.js [utf-8] (original)
+++ couchdb/trunk/share/www/script/futon.browse.js [utf-8] Sun Feb 22 07:31:26 2009
@@ -52,9 +52,16 @@
$("#databases tbody.content").append("<tr>" +
"<th><a href='database.html?" + encodeURIComponent(dbName) + "'>" +
dbName + "</a></th>" +
- "<td class='size'></td><td class='count'></td>" +
+ "<td class='size'></td><td class='apps'></td><td class='count'></td>" +
"<td class='seq'></td></tr>");
- $.couch.db(dbName).info({
+ var db = $.couch.db(dbName);
+ db.allApps({
+ eachApp : function(name, path) {
+ $("#databases tbody.content tr:eq(" + idx + ")")
+ .find("td.apps").append('<a href="'+path+'">'+name+'</a> ');
+ }
+ });
+ db.info({
success: function(info) {
$("#databases tbody.content tr:eq(" + idx + ")")
.find("td.size").text($.futon.formatSize(info.disk_size)).end()
Modified: couchdb/trunk/share/www/script/jquery.couch.js
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/script/jquery.couch.js?rev=746644&r1=746643&r2=746644&view=diff
==============================================================================
--- couchdb/trunk/share/www/script/jquery.couch.js [utf-8] (original)
+++ couchdb/trunk/share/www/script/jquery.couch.js [utf-8] Sun Feb 22 07:31:26 2009
@@ -173,6 +173,38 @@
}
});
},
+ allDesignDocs: function(options) {
+ options = options || {};
+ this.allDocs($.extend({startkey:"_design", endkey:"_design0"}, options));
+ },
+ allApps: function(options) {
+ options = options || {};
+ var self = this;
+ if (options.eachApp) {
+ this.allDesignDocs({
+ success: function(resp) {
+ $.each(resp.rows, function() {
+ self.openDoc(this.id, {
+ success: function(ddoc) {
+ var index, appPath, appName = ddoc._id.split('/');
+ appName.shift();
+ appName = appName.join('/');
+ index = ddoc.couchapp && ddoc.couchapp.index;
+ if (index) {
+ appPath = ['', name, index[0], appName, index[1]].join('/');
+ } else if (ddoc._attachments["index.html"]) {
+ appPath = ['', name, '_design', appName, "index.html"].join('/');
+ }
+ if (appPath) options.eachApp(appName, appPath, ddoc);
+ }
+ });
+ });
+ }
+ });
+ } else {
+ alert("please provide an eachApp function for allApps()");
+ }
+ },
openDoc: function(docId, options) {
options = options || {};
$.ajax({
Modified: couchdb/trunk/share/www/style/layout.css
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/style/layout.css?rev=746644&r1=746643&r2=746644&view=diff
==============================================================================
--- couchdb/trunk/share/www/style/layout.css (original)
+++ couchdb/trunk/share/www/style/layout.css Sun Feb 22 07:31:26 2009
@@ -336,8 +336,8 @@
/* Database table */
-#databases thead th.size, #databases thead th.count, #databases thead th.seq,
-#databases tbody td.size, #databases tbody td.count, #databases tbody td.seq {
+#databases thead th.apps, #databases thead th.size, #databases thead th.count, #databases thead th.seq,
+#databases thead th.apps, #databases tbody td.size, #databases tbody td.count, #databases tbody td.seq {
text-align: right;
}