Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
Futon: Merge the different compaction/cleanup buttons into a single b…
…utton 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
  • Loading branch information
cmlenz committed Jan 19, 2010
1 parent 7023c79 commit 52c50c4ac80d15d4df5fb7f9abe6f0ecd6771ff3
Showing 6 changed files with 48 additions and 100 deletions.
@@ -115,10 +115,8 @@
$.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 @@ <h1>
</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">
@@ -13,16 +13,39 @@
-->
<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>

This file was deleted.

This file was deleted.

@@ -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;
}
}
});
}
@@ -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;

0 comments on commit 52c50c4

Please sign in to comment.