Fauxton: Fix rename view shows in sidebar
Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/15f4fff0 Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/15f4fff0 Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/15f4fff0 Branch: refs/heads/api-options Commit: 15f4fff02882bdfe879ddbbeba447677d1b18fc1 Parents: eabece1 Author: Garren Smith <[email protected]> Authored: Tue Jan 21 15:30:46 2014 +0200 Committer: Garren Smith <[email protected]> Committed: Tue Jan 21 15:30:46 2014 +0200 ---------------------------------------------------------------------- src/fauxton/app/addons/compaction/views.js | 1 - src/fauxton/app/addons/documents/views.js | 13 ++++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb/blob/15f4fff0/src/fauxton/app/addons/compaction/views.js ---------------------------------------------------------------------- diff --git a/src/fauxton/app/addons/compaction/views.js b/src/fauxton/app/addons/compaction/views.js index 06a1300..f5469cf 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 http://git-wip-us.apache.org/repos/asf/couchdb/blob/15f4fff0/src/fauxton/app/addons/documents/views.js ---------------------------------------------------------------------- diff --git a/src/fauxton/app/addons/documents/views.js b/src/fauxton/app/addons/documents/views.js index ba7e7d7..d5319f3 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});
