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 2010/01/02 20:01:31 UTC

svn commit: r895262 - in /couchdb/trunk: THANKS share/www/database.html share/www/dialog/_view_cleanup.html share/www/script/couch.js share/www/script/futon.browse.js share/www/script/jquery.couch.js share/www/style/layout.css

Author: jchris
Date: Sat Jan  2 19:01:25 2010
New Revision: 895262

URL: http://svn.apache.org/viewvc?rev=895262&view=rev
Log:
add button to cleanup old view files. closes COUCHDB-610. thanks Ilia Cheishvili

Added:
    couchdb/trunk/share/www/dialog/_view_cleanup.html
Modified:
    couchdb/trunk/THANKS
    couchdb/trunk/share/www/database.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/THANKS
URL: http://svn.apache.org/viewvc/couchdb/trunk/THANKS?rev=895262&r1=895261&r2=895262&view=diff
==============================================================================
--- couchdb/trunk/THANKS (original)
+++ couchdb/trunk/THANKS Sat Jan  2 19:01:25 2010
@@ -41,5 +41,6 @@
  * Kostis Sagonas <ko...@cs.ntua.gr>
  * Matthew Hooker <mw...@gmail.com>
  * Filipe Manana <fd...@gmail.com>
+ * Ilia Cheishvili <il...@gmail.com>
 
 For a list of authors see the `AUTHORS` file.

Modified: couchdb/trunk/share/www/database.html
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/database.html?rev=895262&r1=895261&r2=895262&view=diff
==============================================================================
--- couchdb/trunk/share/www/database.html [utf-8] (original)
+++ couchdb/trunk/share/www/database.html [utf-8] Sat Jan  2 19:01:25 2010
@@ -115,6 +115,7 @@
         });
         $("#toolbar button.add").click(page.newDocument);
         $("#toolbar button.compact").click(page.compactDatabase);
+        $("#toolbar button.viewcleanup").click(page.viewCleanup);
         $("#toolbar button.delete").click(page.deleteDatabase);
         $("#toolbar button.compactview").click(page.compactView);
 
@@ -162,6 +163,7 @@
       <ul id="toolbar">
         <li><button class="add">New Document</button></li>
         <li><button class="compact">Compact Database…</button></li>
+        <li><button class="viewcleanup">View Cleanup…</button></li>
         <li><button class="delete">Delete Database…</button></li>
         <li><button class="compactview" style="display: none">Compact View…</button></li>
       </ul>

Added: couchdb/trunk/share/www/dialog/_view_cleanup.html
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/dialog/_view_cleanup.html?rev=895262&view=auto
==============================================================================
--- couchdb/trunk/share/www/dialog/_view_cleanup.html (added)
+++ couchdb/trunk/share/www/dialog/_view_cleanup.html Sat Jan  2 19:01:25 2010
@@ -0,0 +1,28 @@
+<!--
+
+Licensed under the Apache License, Version 2.0 (the "License"); you may not use
+this file except in compliance with the License. You may obtain a copy of the
+License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software distributed
+under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
+CONDITIONS OF ANY KIND, either express or implied. See the License for the
+specific language governing permissions and limitations under the License.
+
+-->
+<form action="" method="post">
+  <h2>View Cleanup</h2>
+  <fieldset>
+    <p class="help">
+			Cleaning up views in a database removes old view files still stored
+			on the filesystem.  It is an <strong>irreversible operation</strong>.
+    </p>
+  </fieldset>
+  <div class="buttons">
+    <button type="submit">Cleanup</button>
+    <button type="button" class="cancel">Cancel</button>
+  </div>
+</form>
+

Modified: couchdb/trunk/share/www/script/couch.js
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/script/couch.js?rev=895262&r1=895261&r2=895262&view=diff
==============================================================================
--- couchdb/trunk/share/www/script/couch.js [utf-8] (original)
+++ couchdb/trunk/share/www/script/couch.js [utf-8] Sat Jan  2 19:01:25 2010
@@ -243,6 +243,12 @@
     return JSON.parse(this.last_req.responseText);
   }
 
+  this.viewCleanup = function() {
+    this.last_req = this.request("POST", this.uri + "_view_cleanup");
+    CouchDB.maybeThrowError(this.last_req);
+    return JSON.parse(this.last_req.responseText);
+  }
+
   this.setDbProperty = function(propId, propValue) {
     this.last_req = this.request("PUT", this.uri + propId,{
       body:JSON.stringify(propValue)

Modified: couchdb/trunk/share/www/script/futon.browse.js
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/script/futon.browse.js?rev=895262&r1=895261&r2=895262&view=diff
==============================================================================
--- couchdb/trunk/share/www/script/futon.browse.js [utf-8] (original)
+++ couchdb/trunk/share/www/script/futon.browse.js [utf-8] Sat Jan  2 19:01:25 2010
@@ -152,6 +152,18 @@
         });
       }
 
+      this.viewCleanup = function() {
+        $.showDialog("dialog/_view_cleanup.html", {
+          submit: function(data, callback) {
+            db.viewCleanup({
+              success: function(resp) {
+                callback();
+              }
+            });
+          }
+        });
+      }
+
       this.compactView = function() {
         var groupname = page.viewName.substring(8,
             page.viewName.indexOf('/_view'));

Modified: couchdb/trunk/share/www/script/jquery.couch.js
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/script/jquery.couch.js?rev=895262&r1=895261&r2=895262&view=diff
==============================================================================
--- couchdb/trunk/share/www/script/jquery.couch.js [utf-8] (original)
+++ couchdb/trunk/share/www/script/jquery.couch.js [utf-8] Sat Jan  2 19:01:25 2010
@@ -111,6 +111,16 @@
             "The database could not be compacted"
           );
         },
+        viewCleanup: function(options) {
+          $.extend(options, {successStatus: 202});
+          ajax({
+              type: "POST", url: this.uri + "_view_cleanup",
+              data: "", processData: false
+            },
+            options,
+            "The views could not be cleaned up"
+          );
+        },
         compactView: function(groupname, options) {
           $.extend(options, {successStatus: 202});
           ajax({

Modified: couchdb/trunk/share/www/style/layout.css
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/style/layout.css?rev=895262&r1=895261&r2=895262&view=diff
==============================================================================
--- couchdb/trunk/share/www/style/layout.css (original)
+++ couchdb/trunk/share/www/style/layout.css Sat Jan  2 19:01:25 2010
@@ -235,6 +235,7 @@
 #toolbar button:active { background-position: 2px -62px; color: #000; }
 #toolbar button.add { background-image: url(../image/add.png); }
 #toolbar button.compact { background-image: url(../image/compact.png); }
+#toolbar button.viewcleanup { background-image: url(../image/compact.png); }
 #toolbar button.compactview { background-image: url(../image/compact.png); }
 #toolbar button.delete { background-image: url(../image/delete.png); }
 #toolbar button.load { background-image: url(../image/load.png); }