summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGarren Smith <garren.smith@gmail.com>2014-01-21 15:30:46 +0200
committerGarren Smith <garren.smith@gmail.com>2014-01-21 15:30:46 +0200
commit15f4fff02882bdfe879ddbbeba447677d1b18fc1 (patch)
tree4ac09e7a871f4c4f3459987378ddb105e89453bf
parenteabece10a40618875e9e43cbc3f9231f80adecb7 (diff)
downloadcouchdb-15f4fff02882bdfe879ddbbeba447677d1b18fc1.tar.gz
Fauxton: Fix rename view shows in sidebar
-rw-r--r--src/fauxton/app/addons/compaction/views.js1
-rw-r--r--src/fauxton/app/addons/documents/views.js13
2 files changed, 8 insertions, 6 deletions
diff --git a/src/fauxton/app/addons/compaction/views.js b/src/fauxton/app/addons/compaction/views.js
index 06a13003c..f5469cf8c 100644
--- a/src/fauxton/app/addons/compaction/views.js
+++ b/src/fauxton/app/addons/compaction/views.js
@@ -52,7 +52,6 @@ function (app, FauxtonAPI, Compaction) {
msg: 'Database compaction has started. Visit <a href="#activetasks">Active Tasks</a> to view the compaction progress.',
});
}, function (xhr, error, reason) {
- console.log(arguments);
FauxtonAPI.addNotification({
type: 'error',
msg: 'Error: ' + JSON.parse(xhr.responseText).reason
diff --git a/src/fauxton/app/addons/documents/views.js b/src/fauxton/app/addons/documents/views.js
index ba7e7d79f..d5319f39d 100644
--- a/src/fauxton/app/addons/documents/views.js
+++ b/src/fauxton/app/addons/documents/views.js
@@ -1344,9 +1344,14 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb, resizeColum
reduceVal = this.reduceVal(),
viewName = this.$('#index-name').val(),
ddoc = this.getCurrentDesignDoc(),
- ddocName = ddoc.id;
+ ddocName = ddoc.id,
+ viewNameChange = false;
- this.viewName = viewName;
+ if (this.viewName !== viewName) {
+ ddoc.removeDdocView(this.viewName);
+ this.viewName = viewName;
+ viewNameChange = true;
+ }
notification = FauxtonAPI.addNotification({
msg: "Saving document.",
@@ -1369,7 +1374,7 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb, resizeColum
clear: true
});
- if (that.newView) {
+ if (that.newView || viewNameChange) {
var fragment = '/database/' + that.database.safeID() +'/' + ddoc.safeID() + '/_view/' + app.utils.safeURLName(viewName);
FauxtonAPI.navigate(fragment, {trigger: false});
@@ -1485,8 +1490,6 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb, resizeColum
promise.then(function () {
params.docs = that.database.allDocs.map(function (model) { return model.get('doc');});
-
- console.log('p', params, paramsInfo);
var queryPromise = pouchdb.runViewQuery({map: mapVal, reduce: reduceVal}, params);
queryPromise.then(function (results) {
FauxtonAPI.triggerRouteEvent('updatePreviewDocs', {rows: results.rows, ddoc: that.getCurrentDesignDoc().id, view: that.viewName});