incubator-couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Benoit Chesneau <bchesn...@gmail.com>
Subject Re: svn commit: r961052 - /couchdb/trunk/share/www/script/futon.browse.js
Date Wed, 07 Jul 2010 06:39:40 GMT
On Wed, Jul 7, 2010 at 3:05 AM,  <jchris@apache.org> wrote:
> Author: jchris
> Date: Wed Jul  7 01:05:01 2010
> New Revision: 961052
>
> URL: http://svn.apache.org/viewvc?rev=961052&view=rev
> Log:
> avoid Futon popup when listing databases that cant be accessed
>
> Modified:
>    couchdb/trunk/share/www/script/futon.browse.js
>
> Modified: couchdb/trunk/share/www/script/futon.browse.js
> URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/script/futon.browse.js?rev=961052&r1=961051&r2=961052&view=diff
> ==============================================================================
> --- couchdb/trunk/share/www/script/futon.browse.js [utf-8] (original)
> +++ couchdb/trunk/share/www/script/futon.browse.js [utf-8] Wed Jul  7 01:05:01 2010
> @@ -62,7 +62,8 @@
>                     .find("td.size").text($.futon.formatSize(info.disk_size)).end()
>                     .find("td.count").text(info.doc_count).end()
>                     .find("td.seq").text(info.update_seq);
> -                }
> +                },
> +                error : function() {}
>               });
>             });
>             $("#databases tbody tr:odd").addClass("odd");
>
>
>

I've done a patch that solve this differently in my replicator_db
branch. Instread of ignoring all errors it only ignore 401, also it
doesn't list these databases. What do you think about this diff ? :

diff --git a/share/www/script/futon.browse.js b/share/www/script/futon.browse.js
index 354a6a6..70632f9 100644
--- a/share/www/script/futon.browse.js
+++ b/share/www/script/futon.browse.js
@@ -51,17 +51,25 @@
             var dbsOnPage = dbs.slice(offset, offset + maxPerPage);

             $.each(dbsOnPage, function(idx, dbName) {
-              $("#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='seq'></td></tr>");
+
               $.couch.db(dbName).info({
                 success: function(info) {
-                  $("#databases tbody.content tr:eq(" + idx + ")")
-
.find("td.size").text($.futon.formatSize(info.disk_size)).end()
-                    .find("td.count").text(info.doc_count).end()
-                    .find("td.seq").text(info.update_seq);
+
+                  var tr = $("<tr><th><a href='database.html?" +
encodeURIComponent(dbName) + "'>" +
+                    dbName + "</a></th>" +
+                  "<td class='size'></td><td class='count'></td>"
+
+                  "<td class='seq'></td></tr>")
+
.find("td.size").text($.futon.formatSize(info.disk_size)).end()
+                  .find("td.count").text(info.doc_count).end()
+                  .find("td.seq").text(info.update_seq).end()
+
+                  tr.appendTo("#databases tbody.content");
+
+                },
+                error: function(status, error, reason) {
+                  if (status != 401) {
+                    alert("Error: " + error + "\n\n" + reason);
+                  }
                 }
               });
             });

Mime
View raw message