summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Newson <rnewson@apache.org>2010-11-18 15:20:08 +0000
committerRobert Newson <rnewson@apache.org>2010-11-18 15:20:08 +0000
commit9741ab0ea74fab1a480a9a7c34dac954bedd1dd6 (patch)
treede631591e20a64a6a5d99dd9a3ac9c0279cefb98
parent3cf27c815bf0db1ed81e0acdd94b2f0d816c1585 (diff)
COUCHDB-957 - Show an error message if trying 'Compact View' without selecting a view, rather than compacting the associated database by mistake.
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@1036486 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--share/www/script/futon.browse.js10
1 files changed, 7 insertions, 3 deletions
diff --git a/share/www/script/futon.browse.js b/share/www/script/futon.browse.js
index 65acbdeb..17975de2 100644
--- a/share/www/script/futon.browse.js
+++ b/share/www/script/futon.browse.js
@@ -153,9 +153,13 @@
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() }});
+ var idx = page.viewName.indexOf("/_view");
+ if (idx == -1) {
+ alert("Compact Views requires focus on a view!");
+ } else {
+ var groupname = page.viewName.substring(8, idx);
+ db.compactView(groupname, {success: function(resp) { callback() }});
+ }
break;
case "view_cleanup":
db.viewCleanup({success: function(resp) { callback() }});