You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ro...@apache.org on 2014/09/08 15:29:32 UTC
[1/4] fauxton commit: updated refs/heads/master to 36957d0
Repository: couchdb-fauxton
Updated Branches:
refs/heads/master bacf6fd71 -> 36957d032
Convert tabs to spaces, remove trailing whitespaces
Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/00b8fd03
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/00b8fd03
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/00b8fd03
Branch: refs/heads/master
Commit: 00b8fd0307ab2e18220ba968732e81cdabf3dae4
Parents: bacf6fd
Author: Robert Kowalski <ro...@kowalski.gd>
Authored: Sun Aug 31 22:58:39 2014 +0200
Committer: Robert Kowalski <ro...@kowalski.gd>
Committed: Mon Sep 8 15:28:15 2014 +0200
----------------------------------------------------------------------
app/addons/replication/route.js | 10 +++++-----
app/addons/replication/views.js | 10 +++++-----
2 files changed, 10 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/00b8fd03/app/addons/replication/route.js
----------------------------------------------------------------------
diff --git a/app/addons/replication/route.js b/app/addons/replication/route.js
index 17368f8..8495fa2 100644
--- a/app/addons/replication/route.js
+++ b/app/addons/replication/route.js
@@ -32,19 +32,19 @@ function(app, FauxtonAPI, Replication, Views) {
{"name": "Replicate changes from: ", "link": "replication"}
],
defaultView: function(dbname){
- this.databases = new Replication.DBList({});
+ this.databases = new Replication.DBList({});
this.tasks = new Replication.Tasks({id: "ReplicationTasks"});
this.replication = new Replication.Replicate({});
- this.setView("#dashboard-content", new Views.ReplicationForm({
+ this.setView("#dashboard-content", new Views.ReplicationForm({
selectedDB: dbname ||"",
- collection: this.databases,
+ collection: this.databases,
status: this.tasks
- }));
+ }));
}
});
- Replication.RouteObjects = [RepRouteObject];
+ Replication.RouteObjects = [RepRouteObject];
return Replication;
});
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/00b8fd03/app/addons/replication/views.js
----------------------------------------------------------------------
diff --git a/app/addons/replication/views.js b/app/addons/replication/views.js
index a19e609..1184878 100644
--- a/app/addons/replication/views.js
+++ b/app/addons/replication/views.js
@@ -32,7 +32,7 @@ function(app, FauxtonAPI, Components, replication) {
// -----------------------------------
// afterRender: autocomplete on the target input field
// beforeRender: add the status table
- // disableFields: disable non active fields on submit
+ // disableFields: disable non active fields on submit
// enableFields: enable field when radio btns are clicked
// establish: get the DB list for autocomplete
// formValidation: make sure fields aren't empty
@@ -153,7 +153,7 @@ function(app, FauxtonAPI, Components, replication) {
}
});
this.enableFields();
- },
+ },
updateButtonText: function(wait){
var $button = this.$('#replication button[type=submit]');
if(wait){
@@ -163,7 +163,7 @@ function(app, FauxtonAPI, Components, replication) {
}
},
submit: function(e){
- this.disableFields();
+ this.disableFields();
var formJSON = {};
_.map(this.$(e.currentTarget).serializeArray(), function(formData){
if(formData.value !== ''){
@@ -173,7 +173,7 @@ function(app, FauxtonAPI, Components, replication) {
this.updateButtonText(true);
this.startReplication(formJSON);
- },
+ },
swapFields: function(e){
//WALL O' VARIABLES
var $fromSelect = this.$('#from_name'),
@@ -219,7 +219,7 @@ function(app, FauxtonAPI, Components, replication) {
},
beforeRender: function(){
this.collection.forEach(function(item) {
- this.insertView(new View.replicationItem({
+ this.insertView(new View.replicationItem({
model: item
}));
}, this);
[2/4] fauxton commit: updated refs/heads/master to 36957d0
Posted by ro...@apache.org.
Enable access on replication for non-admins
COUCHDB-2244
Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/be420542
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/be420542
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/be420542
Branch: refs/heads/master
Commit: be420542b01eaaacfe83455bbdbcc9f962eefbfb
Parents: 00b8fd0
Author: Robert Kowalski <ro...@kowalski.gd>
Authored: Mon Sep 1 00:12:32 2014 +0200
Committer: Robert Kowalski <ro...@kowalski.gd>
Committed: Mon Sep 8 15:30:29 2014 +0200
----------------------------------------------------------------------
app/addons/replication/route.js | 17 ++++++--
app/addons/replication/tests/replicationSpec.js | 31 ++++++++++-----
app/addons/replication/views.js | 42 ++++++++++++++------
app/core/couchdbSession.js | 7 +++-
4 files changed, 72 insertions(+), 25 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/be420542/app/addons/replication/route.js
----------------------------------------------------------------------
diff --git a/app/addons/replication/route.js b/app/addons/replication/route.js
index 8495fa2..1b9ba91 100644
--- a/app/addons/replication/route.js
+++ b/app/addons/replication/route.js
@@ -19,7 +19,6 @@ define([
function(app, FauxtonAPI, Replication, Views) {
var RepRouteObject = FauxtonAPI.RouteObject.extend({
layout: "one_pane",
- roles: ["_admin"],
routes: {
"replication": "defaultView",
"replication/:dbname": "defaultView"
@@ -32,13 +31,25 @@ function(app, FauxtonAPI, Replication, Views) {
{"name": "Replicate changes from: ", "link": "replication"}
],
defaultView: function(dbname){
+ var isAdmin = FauxtonAPI.session.isAdmin();
+
+ this.tasks = [];
this.databases = new Replication.DBList({});
- this.tasks = new Replication.Tasks({id: "ReplicationTasks"});
this.replication = new Replication.Replicate({});
+
+ if (isAdmin) {
+ this.tasks = new Replication.Tasks({id: "ReplicationTasks"});
+ this.setView("#dashboard-content", new Views.ReplicationFormForAdmins({
+ selectedDB: dbname ||"",
+ collection: this.databases,
+ status: this.tasks
+ }));
+ return;
+ }
this.setView("#dashboard-content", new Views.ReplicationForm({
selectedDB: dbname ||"",
collection: this.databases,
- status: this.tasks
+ status: this.tasks
}));
}
});
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/be420542/app/addons/replication/tests/replicationSpec.js
----------------------------------------------------------------------
diff --git a/app/addons/replication/tests/replicationSpec.js b/app/addons/replication/tests/replicationSpec.js
index 788b082..55fe1c8 100644
--- a/app/addons/replication/tests/replicationSpec.js
+++ b/app/addons/replication/tests/replicationSpec.js
@@ -10,18 +10,31 @@
// License for the specific language governing permissions and limitations under
// the License.
define([
- 'addons/replication/base',
- 'chai'
-], function (Replication, chai) {
- var expect = chai.expect;
+ 'addons/replication/base',
+ 'addons/replication/views',
+ 'addons/replication/resources',
+ 'testUtils'
+], function (Replication, Views, Resources, testUtils) {
+ var assert = testUtils.assert,
+ ViewSandbox = testUtils.ViewSandbox,
+ viewSandbox;
- describe('Replication Addon', function(){
+ describe('Replication Addon', function () {
+ describe('Replication View', function () {
+ var view = new Views.ReplicationForm({
+ collection: new Replication.DBList()
+ });
+ beforeEach(function (done) {
+ viewSandbox = new ViewSandbox();
+ viewSandbox.renderView(view, done);
+ });
- describe('Replication DBList Collection', function () {
- var rep;
+ afterEach(function () {
+ viewSandbox.remove();
+ });
- beforeEach(function () {
- rep = new rep.DBList(["foo","bar","baz","bo"]);
+ it("should render", function () {
+ assert.ok(view.$el.length > 0);
});
});
});
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/be420542/app/addons/replication/views.js
----------------------------------------------------------------------
diff --git a/app/addons/replication/views.js b/app/addons/replication/views.js
index 1184878..a138beb 100644
--- a/app/addons/replication/views.js
+++ b/app/addons/replication/views.js
@@ -16,7 +16,7 @@ define([
"addons/fauxton/components",
"addons/replication/resources"
],
-function(app, FauxtonAPI, Components, replication) {
+function(app, FauxtonAPI, Components, Replication) {
var View = {},
Events ={},
pollingInfo ={
@@ -42,7 +42,7 @@ function(app, FauxtonAPI, Components, replication) {
// swapFields: change to and from target
// toggleAdvancedOptions: toggle advanced
- View.ReplicationForm = FauxtonAPI.View.extend({
+ View.ReplicationFormForAdmins = FauxtonAPI.View.extend({
template: "addons/replication/templates/form",
events: {
"submit #replication": "validate",
@@ -53,7 +53,7 @@ function(app, FauxtonAPI, Components, replication) {
initialize: function(options){
this.status = options.status;
this.selectedDB = options.selectedDB;
- this.newRepModel = new replication.Replicate({});
+ this.newRepModel = new Replication.Replicate({});
},
afterRender: function(){
this.dbSearchTypeahead = new Components.DbSearchTypeahead({
@@ -66,7 +66,7 @@ function(app, FauxtonAPI, Components, replication) {
},
beforeRender: function(){
- this.insertView("#replicationStatus", new View.ReplicationList({
+ this.insertView("#replicationStatus", new View.ReplicationListForAdmins({
collection: this.status
}));
},
@@ -90,7 +90,7 @@ function(app, FauxtonAPI, Components, replication) {
}
},
establish: function(){
- return [ this.collection.fetch(), this.status.fetch()];
+ return [this.collection.fetch(), this.status.fetch()];
},
validate: function(e){
e.preventDefault();
@@ -196,8 +196,29 @@ function(app, FauxtonAPI, Components, replication) {
}
});
+ View.ReplicationForm = View.ReplicationFormForAdmins.extend({
+ template: "addons/replication/templates/form",
- View.ReplicationList = FauxtonAPI.View.extend({
+ events: {
+ "submit #replication": "validate",
+ "click .btn-group .btn": "showFields",
+ "click .swap": "swapFields",
+ "click .options": "toggleAdvancedOptions"
+ },
+
+ initialize: function (options) {
+ this.selectedDB = options.selectedDB;
+ this.newRepModel = new Replication.Replicate({});
+ },
+
+ beforeRender: function () {},
+
+ establish: function () {
+ return [this.collection.fetch()];
+ },
+ });
+
+ View.ReplicationListForAdmins = FauxtonAPI.View.extend({
tagName: "ul",
initialize: function(){
Events.bind('update:tasks', this.establish, this);
@@ -225,11 +246,8 @@ function(app, FauxtonAPI, Components, replication) {
}, this);
},
showHeader: function(){
- if (this.collection.length > 0){
- this.$el.parent().addClass('showHeader');
- } else {
- this.$el.parent().removeClass('showHeader');
- }
+ this.$el.parent()
+ .toggleClass('showHeader', this.collection.length > 0);
},
afterRender: function(){
this.showHeader();
@@ -246,7 +264,7 @@ function(app, FauxtonAPI, Components, replication) {
"click .cancel": "cancelReplication"
},
initialize: function(){
- this.newRepModel = new replication.Replicate({});
+ this.newRepModel = new Replication.Replicate({});
},
establish: function(){
return [this.model.fetch()];
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/be420542/app/core/couchdbSession.js
----------------------------------------------------------------------
diff --git a/app/core/couchdbSession.js b/app/core/couchdbSession.js
index 7482db9..7ee28d9 100644
--- a/app/core/couchdbSession.js
+++ b/app/core/couchdbSession.js
@@ -27,6 +27,11 @@ function (FauxtonAPI) {
};
},
+ isAdmin: function () {
+ var userCtx = this.get('userCtx');
+ return userCtx.roles.indexOf('_admin') !== -1;
+ },
+
fetchUser: function (opt) {
var that = this,
options = opt || {},
@@ -50,7 +55,7 @@ function (FauxtonAPI) {
// this will return the user as a value to all function that calls done on this
// eg. session.fetchUser().done(user) { .. do something with user ..}
- return user;
+ return user;
});
}
})
[4/4] fauxton commit: updated refs/heads/master to 36957d0
Posted by ro...@apache.org.
Replication: Unbind event on cleanup
Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/36957d03
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/36957d03
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/36957d03
Branch: refs/heads/master
Commit: 36957d032bcfbfa2957f1d3e2fc0cbdc0ca61963
Parents: 7d9daf5
Author: Robert Kowalski <ro...@kowalski.gd>
Authored: Thu Sep 4 00:25:26 2014 +0200
Committer: Robert Kowalski <ro...@kowalski.gd>
Committed: Mon Sep 8 15:30:40 2014 +0200
----------------------------------------------------------------------
app/addons/replication/views.js | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/36957d03/app/addons/replication/views.js
----------------------------------------------------------------------
diff --git a/app/addons/replication/views.js b/app/addons/replication/views.js
index 1a6936d..7eb4a7e 100644
--- a/app/addons/replication/views.js
+++ b/app/addons/replication/views.js
@@ -237,6 +237,7 @@ function(app, FauxtonAPI, Components, Replication) {
}, pollingInfo.rate*1000);
},
cleanup: function(){
+ Events.unbind('update:tasks');
clearInterval(pollingInfo.intervalId);
},
beforeRender: function(){
[3/4] fauxton commit: updated refs/heads/master to 36957d0
Posted by ro...@apache.org.
Allow replications to existing databases
Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/7d9daf5c
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/7d9daf5c
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/7d9daf5c
Branch: refs/heads/master
Commit: 7d9daf5c73c63f431ff251ee9c55e8edd1dae514
Parents: be42054
Author: Robert Kowalski <ro...@kowalski.gd>
Authored: Mon Sep 1 01:36:00 2014 +0200
Committer: Robert Kowalski <ro...@kowalski.gd>
Committed: Mon Sep 8 15:30:39 2014 +0200
----------------------------------------------------------------------
app/addons/replication/views.js | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/7d9daf5c/app/addons/replication/views.js
----------------------------------------------------------------------
diff --git a/app/addons/replication/views.js b/app/addons/replication/views.js
index a138beb..1a6936d 100644
--- a/app/addons/replication/views.js
+++ b/app/addons/replication/views.js
@@ -101,18 +101,19 @@ function(app, FauxtonAPI, Components, Replication) {
type: "error",
clear: true
});
+ return;
}else if (this.$('input#to_name').is(':visible') && !this.$('input[name=create_target]').is(':checked')){
var alreadyExists = this.collection.where({"name":this.$('input#to_name').val()});
- if (alreadyExists.length === 0){
- notification = FauxtonAPI.addNotification({
+ if (alreadyExists.length === 0) {
+ FauxtonAPI.addNotification({
msg: "This database doesn't exist. Check create target if you want to create it.",
type: "error",
clear: true
});
+ return;
}
- }else{
- this.submit(e);
}
+ this.submit(e);
},
formValidation: function(e){
var $remote = this.$el.find('input:visible'),