couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From deathb...@apache.org
Subject git commit: updated refs/heads/1807-Replication to 784c3c7
Date Mon, 09 Sep 2013 19:39:05 GMT
Updated Branches:
  refs/heads/1807-Replication 402efe8f9 -> 784c3c79e


Fixes from code review


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/784c3c79
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/784c3c79
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/784c3c79

Branch: refs/heads/1807-Replication
Commit: 784c3c79ed866c87ef444f20a62765c33b622c5a
Parents: 402efe8
Author: suelockwood <deathbearbrown@gmail.com>
Authored: Mon Sep 9 15:38:56 2013 -0400
Committer: suelockwood <deathbearbrown@gmail.com>
Committed: Mon Sep 9 15:38:56 2013 -0400

----------------------------------------------------------------------
 src/fauxton/app/addons/replication/resources.js |  2 +-
 src/fauxton/app/addons/replication/route.js     |  2 +-
 src/fauxton/app/addons/replication/views.js     | 68 +++++++++++---------
 src/fauxton/assets/less/fauxton.less            |  4 +-
 4 files changed, 41 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/784c3c79/src/fauxton/app/addons/replication/resources.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/replication/resources.js b/src/fauxton/app/addons/replication/resources.js
index 62cb3d1..38ae139 100644
--- a/src/fauxton/app/addons/replication/resources.js
+++ b/src/fauxton/app/addons/replication/resources.js
@@ -53,7 +53,7 @@ function (app, FauxtonAPI, ActiveTasks) {
     parse: function(resp){
       //only want replication tasks to return
       return _.filter(resp, function(task){
-        return task["type"] === "replication";
+        return task.type === "replication";
       });
     }
   });

http://git-wip-us.apache.org/repos/asf/couchdb/blob/784c3c79/src/fauxton/app/addons/replication/route.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/replication/route.js b/src/fauxton/app/addons/replication/route.js
index 4002203..8c45d6f 100644
--- a/src/fauxton/app/addons/replication/route.js
+++ b/src/fauxton/app/addons/replication/route.js
@@ -32,7 +32,7 @@ function(app, FauxtonAPI, Replication, Views) {
     ],
     defaultView: function(){
 			this.databases = new Replication.DBList({});
-      this.tasks = new Replication.Tasks({id: "ReplicationTasks"}); //replace with with a
call to active tasks when that is merged in
+      this.tasks = new Replication.Tasks({id: "ReplicationTasks"});
 			this.setView("#dashboard-content", new Views.ReplicationForm({
 				collection: this.databases,
         status:  this.tasks

http://git-wip-us.apache.org/repos/asf/couchdb/blob/784c3c79/src/fauxton/app/addons/replication/views.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/replication/views.js b/src/fauxton/app/addons/replication/views.js
index b2b8728..4b55030 100644
--- a/src/fauxton/app/addons/replication/views.js
+++ b/src/fauxton/app/addons/replication/views.js
@@ -44,13 +44,13 @@ function(app, FauxtonAPI, replication) {
   View.ReplicationForm = FauxtonAPI.View.extend({
 		template: "addons/replication/templates/form",
 		events:  {
-			"submit #replication": "submit",
+			"submit #replication": "validate",
 			"click .btn-group .btn": "showFields",
 			"click .swap": "swapFields",
 			"click .options": "toggleAdvancedOptions"
 		},
-		initialize: function(){
-			this.status = this.options.status;
+		initialize: function(options){
+			this.status = options.status;
 			this.newRepModel = new replication.Replicate({});
 		},
 		afterRender: function(){
@@ -89,17 +89,14 @@ function(app, FauxtonAPI, replication) {
 		cleanup: function(){
 			clearInterval(pollingInfo.intervalId);
 		},
-
-		disableFields: function(disable){
-			if(disable){
+		enableFields: function(){
+			this.$el.find('input','select').attr('disabled',false);
+		},
+		disableFields: function(){
 				this.$el.find('input:hidden','select:hidden').attr('disabled',true);
-			}else{
-				this.$el.find('input','select').attr('disabled',false);
-			}
 		},
-
 		showFields: function(e){
-			var $currentTarget = $(e.currentTarget),
+			var $currentTarget = this.$(e.currentTarget),
 					targetVal = $currentTarget.val();
 
 			if (targetVal === "local"){
@@ -111,23 +108,36 @@ function(app, FauxtonAPI, replication) {
 		establish: function(){
 			return [ this.collection.fetch(), this.status.fetch()];
 		},
-
-		formValidation: function(){
-			var $remote = this.$el.find('input:visible'),
-					error = false;
-			for(var i=0; i<$remote.length; i++){
-				if ($remote[i].value =="http://" || $remote[i].value ==" "){
-					error = true;
-				}
-			}
-
-			if (this.$('input#to_name').is(':visible')){
+		validate: function(e){
+			e.preventDefault();
+			var notification;
+			if (this.formValidation()){
+					notification = FauxtonAPI.addNotification({
+						msg: "Please enter every field.",
+						type: "error",
+						clear: true
+					});
+			}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){
-					error = true;
+					notification = FauxtonAPI.addNotification({
+						msg: "This database doesn't exist. Check create target if you want to create it.",
+						type: "error",
+						clear: true
+					});
 				}
+			}else{
+				this.submit(e);
 			}
-
+		},
+		formValidation: function(e){
+			var $remote = this.$el.find('input:visible'),
+      error = false;
+      for(var i=0; i<$remote.length; i++){
+				if ($remote[i].value =="http://" || $remote[i].value ===""){
+					error = true;
+				}
+      }
 			return error;
 		},
 		serialize: function(){
@@ -157,7 +167,7 @@ function(app, FauxtonAPI, replication) {
 					that.updateButtonText(false);
 				}
 			});
-			this.disableFields(false);
+			this.enableFields();
 		},		
 		updateButtonText: function(wait){
 			var $button = this.$('#replication button[type=submit]');
@@ -168,9 +178,7 @@ function(app, FauxtonAPI, replication) {
 			}
 		},
 		submit: function(e){
-			e.preventDefault();
-			this.disableFields(true); //disable fields not relevant to submitting
-
+			this.disableFields(); 
 			var formJSON = {};
 			_.map(this.$(e.currentTarget).serializeArray(), function(formData){
 				if(formData.value !== ''){
@@ -179,7 +187,6 @@ function(app, FauxtonAPI, replication) {
 				}
 			});
 
-			console.log($(e.currentTarget).serializeArray(), formJSON);
 			this.updateButtonText(true);
 			this.startReplication(formJSON);
 		},	
@@ -225,7 +232,6 @@ View.ReplicationList = FauxtonAPI.View.extend({
 		clearInterval(pollingInfo.intervalId);
   },
 	beforeRender:  function(){
-		var that = this;
     this.collection.forEach(function(item) {
       this.insertView(new View.replicationItem({ 
         model: item
@@ -261,7 +267,7 @@ View.ReplicationList = FauxtonAPI.View.extend({
 		},
 		cancelReplication: function(e){
 			//need to pass "cancel": true with source & target
-			var $currentTarget = $(e.currentTarget),
+			var $currentTarget = this.$(e.currentTarget),
 					repID = $currentTarget.attr('data-rep-id');
 			this.newRepModel.save({
 				"replication_id": repID,

http://git-wip-us.apache.org/repos/asf/couchdb/blob/784c3c79/src/fauxton/assets/less/fauxton.less
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/less/fauxton.less b/src/fauxton/assets/less/fauxton.less
index 185113e..1e0ccd2 100644
--- a/src/fauxton/assets/less/fauxton.less
+++ b/src/fauxton/assets/less/fauxton.less
@@ -166,9 +166,9 @@ a:hover{
   top: 0px;
   display: block;
   z-index: 100000;
-  left: 340px;
+  left: @navWidth;
   .closeMenu & {
-    left: 63px;
+    left: @collapsedNavWidth;
   }
   width: 100%;
 }


Mime
View raw message