From 22da1e28bd68084cc5e13feab81db445775c6429 Mon Sep 17 00:00:00 2001 From: John Christopher Anderson Date: Sat, 2 Jan 2010 19:01:25 +0000 Subject: 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 --- share/www/database.html | 2 ++ share/www/dialog/_view_cleanup.html | 28 ++++++++++++++++++++++++++++ share/www/script/couch.js | 6 ++++++ share/www/script/futon.browse.js | 12 ++++++++++++ share/www/script/jquery.couch.js | 10 ++++++++++ share/www/style/layout.css | 1 + 6 files changed, 59 insertions(+) create mode 100644 share/www/dialog/_view_cleanup.html (limited to 'share') 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. 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 @@ + +
+

View Cleanup

+
+

+ Cleaning up views in a database removes old view files still stored + on the filesystem. It is an irreversible operation. +

+
+
+ + +
+
+ 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); } -- cgit v1.2.3