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 | |
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')
-rw-r--r-- | share/www/database.html | 4 | ||||
-rw-r--r-- | share/www/dialog/_compact_database.html | 2 | ||||
-rw-r--r-- | share/www/dialog/_compact_view.html | 28 | ||||
-rw-r--r-- | share/www/script/futon.browse.js | 15 | ||||
-rw-r--r-- | share/www/script/jquery.couch.js | 10 | ||||
-rw-r--r-- | share/www/style/layout.css | 1 |
6 files changed, 58 insertions, 2 deletions
diff --git a/share/www/database.html b/share/www/database.html index cfba8f64..0f8c2c22 100644 --- a/share/www/database.html +++ b/share/www/database.html @@ -37,7 +37,7 @@ specific language governing permissions and limitations under the License. $(function() { if (page.redirecting) return; - $("h1 strong").text(page.db.name); + $("h1 strong").html('<a href="?' + page.db.name + '">' + page.db.name + '</a>'); var viewPath = page.viewName || "_all_docs"; if (viewPath != "_temp_view" && viewPath != "_design_docs") { $("h1 a.raw").attr("href", "/" + encodeURIComponent(page.db.name) + @@ -100,6 +100,7 @@ specific language governing permissions and limitations under the License. $("#toolbar button.add").click(page.newDocument); $("#toolbar button.compact").click(page.compactDatabase); $("#toolbar button.delete").click(page.deleteDatabase); + $("#toolbar button.compactview").click(page.compactView); $('#jumpto input').addPlaceholder("Document ID").suggest(function(text, callback) { page.db.allDocs({ @@ -146,6 +147,7 @@ specific language governing permissions and limitations under the License. <li><button class="add">New Document</button></li> <li><button class="compact">Compact Database…</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_database.html index 87ce5d6f..5c898a3c 100644 --- a/share/www/dialog/_compact_database.html +++ b/share/www/dialog/_compact_database.html @@ -17,7 +17,7 @@ specific language governing permissions and limitations under the License. <fieldset> <p class="help"> Compacting a database removes deleted documents and previous revisions. - It is an <strong>irreversible operation</strong> and my take + It is an <strong>irreversible operation</strong> and may take a while to complete for large databases. </p> </fieldset> diff --git a/share/www/dialog/_compact_view.html b/share/www/dialog/_compact_view.html new file mode 100644 index 00000000..e64d97e3 --- /dev/null +++ b/share/www/dialog/_compact_view.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>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/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({ diff --git a/share/www/style/layout.css b/share/www/style/layout.css index c1a6a77b..ae442f1c 100644 --- a/share/www/style/layout.css +++ b/share/www/style/layout.css @@ -230,6 +230,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.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); } |