summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Lenz <cmlenz@apache.org>2010-01-19 23:23:43 +0000
committerChristopher Lenz <cmlenz@apache.org>2010-01-19 23:23:43 +0000
commit08bac9b0be9b90b0b93593be87a8ca82736aa17a (patch)
treec4b4931c419cbd742fedc9c33ce83223a5d45ddc
parentf5c66809addd233b1ba579a76fc30ab0e6fa4e08 (diff)
Futon: Merge the different compaction/cleanup buttons into a single button on the database page, which will bring up a dialog allowing you to choose which type of compaction/cleanup to perform.
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@900999 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--share/Makefile.am4
-rw-r--r--share/www/database.html8
-rw-r--r--share/www/dialog/_compact_cleanup.html (renamed from share/www/dialog/_compact_database.html)29
-rw-r--r--share/www/dialog/_compact_view.html28
-rw-r--r--share/www/dialog/_view_cleanup.html28
-rw-r--r--share/www/script/futon.browse.js48
-rw-r--r--share/www/style/layout.css7
7 files changed, 49 insertions, 103 deletions
diff --git a/share/Makefile.am b/share/Makefile.am
index dafbc786..39ae06e4 100644
--- a/share/Makefile.am
+++ b/share/Makefile.am
@@ -40,9 +40,7 @@ nobase_dist_localdata_DATA = \
www/custom_test.html \
www/database.html \
www/dialog/_admin_party.html \
- www/dialog/_compact_database.html \
- www/dialog/_compact_view.html \
- www/dialog/_view_cleanup.html \
+ www/dialog/_compact_cleanup.html \
www/dialog/_create_admin.html \
www/dialog/_login.html \
www/dialog/_signup.html \
diff --git a/share/www/database.html b/share/www/database.html
index a3a02a52..ea15a66f 100644
--- a/share/www/database.html
+++ b/share/www/database.html
@@ -115,10 +115,8 @@ specific language governing permissions and limitations under the License.
$.futon.storage.set("per_page", this.value);
});
$("#toolbar button.add").click(page.newDocument);
- $("#toolbar button.compact").click(page.compactDatabase);
- $("#toolbar button.viewcleanup").click(page.viewCleanup);
+ $("#toolbar button.compact").click(page.compactAndCleanup);
$("#toolbar button.delete").click(page.deleteDatabase);
- $("#toolbar button.compactview").click(page.compactView);
$('#jumpto input').suggest(function(text, callback) {
page.db.allDocs({
@@ -163,10 +161,8 @@ specific language governing permissions and limitations under the License.
</div>
<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="compact">Compact &amp; Cleanup…</button></li>
<li><button class="delete">Delete Database…</button></li>
- <li><button class="compactview" style="display: none">Compact View…</button></li>
</ul>
<div id="viewcode" class="collapsed" style="display: none">
diff --git a/share/www/dialog/_compact_database.html b/share/www/dialog/_compact_cleanup.html
index 5c898a3c..506417f4 100644
--- a/share/www/dialog/_compact_database.html
+++ b/share/www/dialog/_compact_cleanup.html
@@ -13,16 +13,39 @@ specific language governing permissions and limitations under the License.
-->
<form action="" method="post">
- <h2>Compact Database</h2>
- <fieldset>
+ <h2>Compact &amp; Cleanup</h2>
+ <fieldset class="radiogroup">
+ <label>
+ <input type="radio" name="action" value="compact_database" checked>
+ Compact Database
+ </label>
<p class="help">
Compacting a database removes deleted documents and previous revisions.
It is an <strong>irreversible operation</strong> and may take
a while to complete for large databases.
</p>
+ <hr>
+ <label>
+ <input type="radio" name="action" value="compact_views">
+ Compact Views
+ </label>
+ <p class="help">
+ View compaction will affect all views in this design document. This
+ operation may take some time to complete. Your views will still operate
+ normally during compaction.
+ </p>
+ <hr>
+ <label>
+ <input type="radio" name="action" value="view_cleanup">
+ Cleanup Views
+ </label>
+ <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">Compact</button>
+ <button type="submit">Run</button>
<button type="button" class="cancel">Cancel</button>
</div>
</form>
diff --git a/share/www/dialog/_compact_view.html b/share/www/dialog/_compact_view.html
deleted file mode 100644
index e64d97e3..00000000
--- a/share/www/dialog/_compact_view.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!--
-
-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 View</h2>
- <fieldset>
- <p class="help">
- View compaction will affect all views in this design document. This
- operation may take some time to complete. Your views will still operate
- normally during compaction.
- </p>
- </fieldset>
- <div class="buttons">
- <button type="submit">Compact</button>
- <button type="button" class="cancel">Cancel</button>
- </div>
-</form>
diff --git a/share/www/dialog/_view_cleanup.html b/share/www/dialog/_view_cleanup.html
deleted file mode 100644
index 2ede89a5..00000000
--- a/share/www/dialog/_view_cleanup.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!--
-
-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>
-
diff --git a/share/www/script/futon.browse.js b/share/www/script/futon.browse.js
index 4d06d283..31e979bb 100644
--- a/share/www/script/futon.browse.js
+++ b/share/www/script/futon.browse.js
@@ -140,40 +140,22 @@
location.href = "document.html?" + encodeURIComponent(db.name);
}
- this.compactDatabase = function() {
- $.showDialog("dialog/_compact_database.html", {
+ this.compactAndCleanup = function() {
+ $.showDialog("dialog/_compact_cleanup.html", {
submit: function(data, callback) {
- db.compact({
- success: function(resp) {
- callback();
- }
- });
- }
- });
- }
-
- 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'));
- $.showDialog("dialog/_compact_view.html", {
- submit: function(data, callback) {
- db.compactView(groupname, {
- success: function(resp) {
- callback();
- }
- });
+ switch (data.action) {
+ case "compact_database":
+ db.compact({success: function(resp) { callback() }});
+ break;
+ case "compact_views":
+ var groupname = page.viewName.substring(8,
+ page.viewName.indexOf("/_view"));
+ db.compactView(groupname, {success: function(resp) { callback() }});
+ break;
+ case "view_cleanup":
+ db.viewCleanup({success: function(resp) { callback() }});
+ break;
+ }
}
});
}
diff --git a/share/www/style/layout.css b/share/www/style/layout.css
index e6ce26b9..d3a43db3 100644
--- a/share/www/style/layout.css
+++ b/share/www/style/layout.css
@@ -237,8 +237,6 @@ body.fullwidth #wrap { margin-right: 0; }
#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); }
#toolbar button.run { background-image: url(../image/run.png); }
@@ -290,6 +288,11 @@ body.loading #dialog h2 {
#dialog fieldset input { background-color: #e9e9e9; vertical-align: middle; }
#dialog fieldset input.error { background-color: #f9e4e4; }
#dialog fieldset div.error { padding-top: .3em; color: #b33; }
+#dialog fieldset.radiogroup { padding-top: 1em; }
+#dialog fieldset.radiogroup label { position: relative; padding-left: 25px; }
+#dialog fieldset.radiogroup input { position: absolute; left: 5px; top: 2px; }
+#dialog fieldset.radiogroup p.help { margin-top: .5em; margin-left: 25px; }
+#dialog fieldset.radiogroup hr { border-color: #333; margin-left: 25px; }
#dialog .buttons { padding: 0 .5em .5em; text-align: right; }
#dialog .buttons button { background: #444; border: 1px solid #aaa;
color: #ddd; cursor: pointer; font-size: 90%; font-weight: normal;