From d7e0687f4ecd82af8f2cf25d6a0ba676ee051e23 Mon Sep 17 00:00:00 2001 From: Christopher Lenz Date: Thu, 10 Apr 2008 10:27:56 +0000 Subject: Add DB compaction button to Futon. Closes COUCHDB-38. Thanks to Jim Lindley for the patch! git-svn-id: https://svn.apache.org/repos/asf/incubator/couchdb/trunk@646734 13f79535-47bb-0310-9956-ffa450edef68 --- THANKS | 1 + share/Makefile.am | 2 ++ share/www/browse/_compact_database.html | 28 ++++++++++++++++++++++++++++ share/www/browse/database.html | 2 ++ share/www/image/compact.gif | Bin 0 -> 13522 bytes share/www/script/browse.js | 8 ++++++++ share/www/script/jquery.dialog.js | 2 +- share/www/style/layout.css | 1 + 8 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 share/www/browse/_compact_database.html create mode 100644 share/www/image/compact.gif diff --git a/THANKS b/THANKS index dbb5f4e8..27d4e5e5 100644 --- a/THANKS +++ b/THANKS @@ -10,6 +10,7 @@ changes. A list of these people is included below. * Benoit Chesneau * Till Klampaeckel * Roger Leigh + * Jim Lindley * Sam Ruby * Dirk Schalge * Carlos Valiente diff --git a/share/Makefile.am b/share/Makefile.am index d8af5b3e..fd4eff0e 100644 --- a/share/Makefile.am +++ b/share/Makefile.am @@ -14,6 +14,7 @@ datarootdir = @prefix@/share nobase_dist_pkgdata_DATA = \ server/main.js \ + www/browse/_compact_database.html \ www/browse/_create_database.html \ www/browse/_create_document.html \ www/browse/_delete_database.html \ @@ -28,6 +29,7 @@ nobase_dist_pkgdata_DATA = \ www/image/apply.gif \ www/image/bg.png \ www/image/cancel.gif \ + www/image/compact.gif \ www/image/delete-mini.gif \ www/image/delete.gif \ www/image/grippie.gif \ diff --git a/share/www/browse/_compact_database.html b/share/www/browse/_compact_database.html new file mode 100644 index 00000000..efa5d345 --- /dev/null +++ b/share/www/browse/_compact_database.html @@ -0,0 +1,28 @@ + +
+

Compact Database

+
+

+ Compacting a database removes deleted documents and previous revisions. + It is an irreversible operation and my take + a while to complete for large databases. +

+
+
+ + +
+
diff --git a/share/www/browse/database.html b/share/www/browse/database.html index 33041bd7..e52c3b8a 100644 --- a/share/www/browse/database.html +++ b/share/www/browse/database.html @@ -78,6 +78,7 @@ specific language governing permissions and limitations under the License. $.cookies.set(page.dbName + ".perpage", this.value); }); $("#toolbar button.add").click(page.addDocument); + $("#toolbar button.compact").click(page.compactDatabase); $("#toolbar button.delete").click(page.deleteDatabase); }); @@ -98,6 +99,7 @@ specific language governing permissions and limitations under the License.
  • +
diff --git a/share/www/image/compact.gif b/share/www/image/compact.gif new file mode 100644 index 00000000..21b5762d Binary files /dev/null and b/share/www/image/compact.gif differ diff --git a/share/www/script/browse.js b/share/www/script/browse.js index cd9b8bd9..7fafc252 100644 --- a/share/www/script/browse.js +++ b/share/www/script/browse.js @@ -84,6 +84,14 @@ function CouchDatabasePage() { }); } + this.compactDatabase = function() { + $.showDialog("_compact_database.html", { + submit: function() { + db.compact(); + } + }); + } + this.deleteDatabase = function() { $.showDialog("_delete_database.html", { submit: function() { diff --git a/share/www/script/jquery.dialog.js b/share/www/script/jquery.dialog.js index dc8f9c5c..09902758 100644 --- a/share/www/script/jquery.dialog.js +++ b/share/www/script/jquery.dialog.js @@ -76,7 +76,7 @@ data[field.name] = field.value; }); var errors = options.submit(data); - if (errors == {}) { + if (errors == null || errors == {}) { dismiss(); } else { for (var name in errors) { diff --git a/share/www/style/layout.css b/share/www/style/layout.css index 75ae2660..32bbb7e8 100644 --- a/share/www/style/layout.css +++ b/share/www/style/layout.css @@ -179,6 +179,7 @@ ul.suggest-dropdown li.selected { cursor: pointer; background: Highlight; #toolbar button:hover { background-position: 2px -30px; color: #000; } #toolbar button:active { background-position: 2px -62px; color: #000; } #toolbar button.add { background-image: url(../image/add.gif); } +#toolbar button.compact { background-image: url(../image/compact.gif); } #toolbar button.delete { background-image: url(../image/delete.gif); } #toolbar button.edit { background-image: url(../image/edit.gif); } #toolbar button.load { background-image: url(../image/load.gif); } -- cgit v1.2.3