summaryrefslogtreecommitdiff
path: root/share/www
diff options
context:
space:
mode:
authorChristopher Lenz <cmlenz@apache.org>2008-04-10 10:27:56 +0000
committerChristopher Lenz <cmlenz@apache.org>2008-04-10 10:27:56 +0000
commitd7e0687f4ecd82af8f2cf25d6a0ba676ee051e23 (patch)
treee3fbbb221d880468b2de1acab30183409b9e57e9 /share/www
parenta95cb866043f25f09b40ec95140f16eb69d0adb1 (diff)
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
Diffstat (limited to 'share/www')
-rw-r--r--share/www/browse/_compact_database.html28
-rw-r--r--share/www/browse/database.html2
-rw-r--r--share/www/image/compact.gifbin0 -> 13522 bytes
-rw-r--r--share/www/script/browse.js8
-rw-r--r--share/www/script/jquery.dialog.js2
-rw-r--r--share/www/style/layout.css1
6 files changed, 40 insertions, 1 deletions
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 @@
+<!--
+
+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>Compact Database</h2>
+ <fieldset>
+ <p class="help">
+ Compacting a database removes deleted documents and previous revisions.
+ It is an <strong>irreversible operation</strong> and my take
+ a while to complete for large databases.
+ </p>
+ </fieldset>
+ <div class="buttons">
+ <button type="submit">Compact</button>
+ <button type="button" class="cancel">Cancel</button>
+ </div>
+</form>
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);
});
</script>
@@ -98,6 +99,7 @@ specific language governing permissions and limitations under the License.
</div>
<ul id="toolbar">
<li><button class="add">Create Document …</button></li>
+ <li><button class="compact">Compact Database</button></li>
<li><button class="delete">Delete Database</button></li>
</ul>
diff --git a/share/www/image/compact.gif b/share/www/image/compact.gif
new file mode 100644
index 00000000..21b5762d
--- /dev/null
+++ b/share/www/image/compact.gif
Binary files 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); }