summaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
authorJohn Christopher Anderson <jchris@apache.org>2010-01-02 19:01:25 +0000
committerJohn Christopher Anderson <jchris@apache.org>2010-01-02 19:01:25 +0000
commit22da1e28bd68084cc5e13feab81db445775c6429 (patch)
tree0a6d79bda5665bf39cf7789702012d3d0ff98d57 /share
parent6bd4afc34d12f96b3872e6b0bc028ad7f01b579c (diff)
add button to cleanup old view files. closes COUCHDB-610. thanks Ilia Cheishvili
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@895262 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'share')
-rw-r--r--share/www/database.html2
-rw-r--r--share/www/dialog/_view_cleanup.html28
-rw-r--r--share/www/script/couch.js6
-rw-r--r--share/www/script/futon.browse.js12
-rw-r--r--share/www/script/jquery.couch.js10
-rw-r--r--share/www/style/layout.css1
6 files changed, 59 insertions, 0 deletions
diff --git a/share/www/database.html b/share/www/database.html
index b997f2cf..65177eb7 100644
--- a/share/www/database.html
+++ b/share/www/database.html
@@ -115,6 +115,7 @@ specific language governing permissions and limitations under the License.
});
$("#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 @@ specific language governing permissions and limitations under the License.
<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>
diff --git a/share/www/dialog/_view_cleanup.html b/share/www/dialog/_view_cleanup.html
new file mode 100644
index 00000000..2ede89a5
--- /dev/null
+++ b/share/www/dialog/_view_cleanup.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>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/couch.js b/share/www/script/couch.js
index f7d7d43d..19b98edb 100644
--- a/share/www/script/couch.js
+++ b/share/www/script/couch.js
@@ -243,6 +243,12 @@ function CouchDB(name, httpHeaders) {
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)
diff --git a/share/www/script/futon.browse.js b/share/www/script/futon.browse.js
index 172c7b62..437c30c2 100644
--- a/share/www/script/futon.browse.js
+++ b/share/www/script/futon.browse.js
@@ -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'));
diff --git a/share/www/script/jquery.couch.js b/share/www/script/jquery.couch.js
index 05b3af79..6812ed9a 100644
--- a/share/www/script/jquery.couch.js
+++ b/share/www/script/jquery.couch.js
@@ -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({
diff --git a/share/www/style/layout.css b/share/www/style/layout.css
index 1d9a7873..94e59746 100644
--- a/share/www/style/layout.css
+++ b/share/www/style/layout.css
@@ -235,6 +235,7 @@ 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); }