diff options
author | Paul Joseph Davis <davisp@apache.org> | 2009-10-30 23:08:42 +0000 |
---|---|---|
committer | Paul Joseph Davis <davisp@apache.org> | 2009-10-30 23:08:42 +0000 |
commit | 78088d9faa123bcae39ed16dd0e15f8d41b34bd3 (patch) | |
tree | c3dcbdb77dda6fbd166c602d0323ab196176f8a2 /share/www/script | |
parent | 97dc2ded847aec78ec2ac1f60eec583ae7111f6c (diff) |
Closes COUCHDB-547 - Adding a View Compaction Button
Thanks to Joshua Bronson for the patch.
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@831485 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'share/www/script')
-rw-r--r-- | share/www/script/futon.browse.js | 15 | ||||
-rw-r--r-- | share/www/script/jquery.couch.js | 10 |
2 files changed, 25 insertions, 0 deletions
diff --git a/share/www/script/futon.browse.js b/share/www/script/futon.browse.js index 39f38365..e962ee9c 100644 --- a/share/www/script/futon.browse.js +++ b/share/www/script/futon.browse.js @@ -138,6 +138,20 @@ }); } + 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(); + } + }); + } + }); + } + this.deleteDatabase = function() { $.showDialog("dialog/_delete_database.html", { submit: function(data, callback) { @@ -638,6 +652,7 @@ options.endkey = options.descending ? "_design" : "_design0"; db.allDocs(options); } else { + $("button.compactview").show(); $("#viewcode").show(); var currentMapCode = $("#viewcode_map").val(); var currentReduceCode = $.trim($("#viewcode_reduce").val()) || null; diff --git a/share/www/script/jquery.couch.js b/share/www/script/jquery.couch.js index ab1a7a00..05b3af79 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" ); }, + compactView: function(groupname, options) { + $.extend(options, {successStatus: 202}); + ajax({ + type: "POST", url: this.uri + "_compact/" + groupname, + data: "", processData: false + }, + options, + "The view could not be compacted" + ); + }, create: function(options) { $.extend(options, {successStatus: 201}); ajax({ |