couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cml...@apache.org
Subject svn commit: r662554 - in /incubator/couchdb/trunk/share/www: script/browse.js script/couch_tests.js style/layout.css
Date Mon, 02 Jun 2008 20:37:42 GMT
Author: cmlenz
Date: Mon Jun  2 13:37:41 2008
New Revision: 662554

URL: http://svn.apache.org/viewvc?rev=662554&view=rev
Log:
Display group reduce results in Futon by default.

Modified:
    incubator/couchdb/trunk/share/www/script/browse.js
    incubator/couchdb/trunk/share/www/script/couch_tests.js
    incubator/couchdb/trunk/share/www/style/layout.css

Modified: incubator/couchdb/trunk/share/www/script/browse.js
URL: http://svn.apache.org/viewvc/incubator/couchdb/trunk/share/www/script/browse.js?rev=662554&r1=662553&r2=662554&view=diff
==============================================================================
--- incubator/couchdb/trunk/share/www/script/browse.js [utf-8] (original)
+++ incubator/couchdb/trunk/share/www/script/browse.js [utf-8] Mon Jun  2 13:37:41 2008
@@ -348,6 +348,9 @@
     if (options.count === undefined) {
       options.count = parseInt($("#perpage").val(), 10);
     }
+    if (options.group === undefined) {
+      options.group = true;
+    }
     if ($("#documents thead th.key").is(".desc")) {
       options.descending = true;
       $.cookies.set(dbName + ".desc", "1");
@@ -363,7 +366,7 @@
       if (resp.offset === undefined) {
         resp.offset = 0;
       }
-      if (resp.total_rows !== null && resp.offset > 0) {
+      if (resp.rows !== null && resp.offset > 0) {
         $("#paging a.prev").attr("href", "#" + (resp.offset - options.count)).click(function()
{
           var firstDoc = resp.rows[0];
           page.updateDocumentListing({
@@ -377,7 +380,7 @@
       } else {
         $("#paging a.prev").removeAttr("href");
       }
-      if (resp.total_rows !== null && resp.total_rows - resp.offset > options.count)
{
+      if (resp.rows !== null && resp.total_rows - resp.offset > options.count)
{
         $("#paging a.next").attr("href", "#" + (resp.offset + options.count)).click(function()
{
           var lastDoc = resp.rows[resp.rows.length - 1];
           page.updateDocumentListing({
@@ -392,39 +395,42 @@
         $("#paging a.next").removeAttr("href");
       }
 
-      if (resp.total_rows != null) {
-        for (var i = 0; i < resp.rows.length; i++) {
-          var row = resp.rows[i];
-          var tr = $("<tr></tr>");
-          var key = row.key;
+      for (var i = 0; i < resp.rows.length; i++) {
+        var row = resp.rows[i];
+        var tr = $("<tr></tr>");
+        var key = row.key;
+        if (row.id) {
           $("<td class='key'><a href='document.html?" + encodeURIComponent(db.name)
+
-            "/" + encodeURIComponent(row.id) + "'><em></em><br>" +
+            "/" + encodeURIComponent(row.id) + "'><strong></strong><br>"
+
             "<span class='docid'>ID:&nbsp;" + row.id + "</span></a></td>")
-            .find("em").text(key !== null ? prettyPrintJSON(key, 0, "") : "null").end()
+            .find("strong").text(key !== null ? prettyPrintJSON(key, 0, "") : "null").end()
+            .appendTo(tr);
+        } else {
+          $("<td class='key'><strong></strong></td>")
+            .find("strong").text(key !== null ? prettyPrintJSON(key, 0, "") : "null").end()
             .appendTo(tr);
-          var value = row.value;
-          $("<td class='value'></td>").text(
-            value !== null ? prettyPrintJSON(value, 0, "") : "null"
-          ).appendTo(tr).dblclick(function() {
-            location.href = this.previousSibling.firstChild.href;
-          });
-          tr.appendTo("#documents tbody.content");
         }
-        $("#documents tbody.footer td span").text(
-          "Showing " + Math.min(resp.total_rows, resp.offset + 1) + "-" +
-          (resp.offset + resp.rows.length) + " of " + resp.total_rows +
-          " document" + (resp.total_rows != 1 ? "s" : ""));
-        $("#documents").removeClass("reduced");
-      } else {
-        var tr = $("<tr></tr>");
-        $("<td class='key'></td>").appendTo(tr);
+        var value = row.value;
         $("<td class='value'></td>").text(
-          resp.result !== null ? prettyPrintJSON(resp.result) : "null"
-        ).appendTo(tr);
+          value !== null ? prettyPrintJSON(value, 0, "") : "null"
+        ).appendTo(tr).dblclick(function() {
+          location.href = this.previousSibling.firstChild.href;
+        });
         tr.appendTo("#documents tbody.content");
-        $("#documents tbody.footer td span").text("Showing reduce result");
-        $("#documents").addClass("reduced");
       }
+      var firstNum = 1;
+      var lastNum = totalNum = resp.rows.length;
+      if (resp.total_rows != null) {
+        firstNum = Math.min(resp.total_rows, resp.offset + 1);
+        lastNum = firstNum + resp.rows.length - 1;
+        totalNum = resp.total_rows;
+        $("#paging").show();
+      } else {
+        $("#paging").hide();
+      }
+      $("#documents tbody.footer td span").text(
+        "Showing " + firstNum + "-" + lastNum + " of " + totalNum +
+        " row" + (firstNum != lastNum ? "s" : ""));
       $("#documents tbody tr:odd").addClass("odd");
       $(document.body).removeClass("loading");
     }

Modified: incubator/couchdb/trunk/share/www/script/couch_tests.js
URL: http://svn.apache.org/viewvc/incubator/couchdb/trunk/share/www/script/couch_tests.js?rev=662554&r1=662553&r2=662554&view=diff
==============================================================================
--- incubator/couchdb/trunk/share/www/script/couch_tests.js [utf-8] (original)
+++ incubator/couchdb/trunk/share/www/script/couch_tests.js [utf-8] Mon Jun  2 13:37:41 2008
@@ -93,14 +93,14 @@
     T(db.info().doc_count == 6);
 
     var reduceFunction = function(keys, values){
-        return sum(values);
+      return sum(values);
     };
 
     results = db.query(mapFunction, reduceFunction);
 
     T(results.rows[0].value == 33);
 
-   // delete a document
+    // delete a document
     T(db.deleteDoc(existingDoc).ok);
 
     // make sure we can't open the doc

Modified: incubator/couchdb/trunk/share/www/style/layout.css
URL: http://svn.apache.org/viewvc/incubator/couchdb/trunk/share/www/style/layout.css?rev=662554&r1=662553&r2=662554&view=diff
==============================================================================
--- incubator/couchdb/trunk/share/www/style/layout.css (original)
+++ incubator/couchdb/trunk/share/www/style/layout.css Mon Jun  2 13:37:41 2008
@@ -304,18 +304,12 @@
 }
 #documents tbody.content td.key { color: #333; }
 #documents tbody.content td.key a { display: block; }
-#documents tbody.content td.key em { font-style: normal; }
+#documents tbody.content td.key a strong { font-weight: normal; }
 #documents tbody.content td.key span.docid { color: #999;
   font: normal 10px Arial,Helvetica,sans-serif;
 }
 #documents tbody.content td.value { font-size: 10px; }
 
-#documents.reduced th.key, #documents.reduced td.key,
-#documents.reduced #paging {
-  display: none;
-}
-#documents.reduced td.value { white-space: pre; }
-
 /* Document fields table */
 
 #fields { table-layout: fixed; }



Mime
View raw message