You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by de...@apache.org on 2013/09/24 19:21:03 UTC

git commit: updated refs/heads/replicator-redesign to 02ea4cd

Updated Branches:
  refs/heads/replicator-redesign b92f880aa -> 02ea4cd99


More fixes for autocomplete and starting on validation


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

Branch: refs/heads/replicator-redesign
Commit: 02ea4cd996079cf617f1919ffe5540b6b178ed0e
Parents: b92f880
Author: suelockwood <de...@gmail.com>
Authored: Mon Sep 23 16:55:22 2013 -0400
Committer: suelockwood <de...@gmail.com>
Committed: Tue Sep 24 13:20:13 2013 -0400

----------------------------------------------------------------------
 .../replication/assets/less/replication.less    | 12 +++-
 .../app/addons/replication/templates/form.html  | 47 ++++++--------
 src/fauxton/app/addons/replication/views.js     | 65 ++++++++++----------
 3 files changed, 63 insertions(+), 61 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/02ea4cd9/src/fauxton/app/addons/replication/assets/less/replication.less
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/replication/assets/less/replication.less b/src/fauxton/app/addons/replication/assets/less/replication.less
index d903b7a..df76464 100644
--- a/src/fauxton/app/addons/replication/assets/less/replication.less
+++ b/src/fauxton/app/addons/replication/assets/less/replication.less
@@ -24,15 +24,20 @@ form#replication {
 	position: relative;
 	max-width: none;
 	width: auto;
-
+	.actions{
+		padding: 15px 0;
+	}
 	#from_name {
 		margin-right: 20px;
 	}
 	.authArea_source_local {
 		display: inline-block;
 		vertical-align: top;
+		padding-top: 10px;
+	}
+	button.fonticon-replicate{
+		padding: 15px 20px;
 	}
-	
 	.span12{
 		margin-left: 0;
 		padding-bottom: 20px;
@@ -41,6 +46,9 @@ form#replication {
 		margin-bottom: 0;
 		border: 0;
 	}
+	.dropdown-menu {
+		width: 85%;
+	}
 	.tab-content.small-tabs{
 		margin-top: 0;
 		border: 1px solid #e3e3e3;

http://git-wip-us.apache.org/repos/asf/couchdb/blob/02ea4cd9/src/fauxton/app/addons/replication/templates/form.html
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/replication/templates/form.html b/src/fauxton/app/addons/replication/templates/form.html
index 02fd80e..082c6e7 100644
--- a/src/fauxton/app/addons/replication/templates/form.html
+++ b/src/fauxton/app/addons/replication/templates/form.html
@@ -13,11 +13,9 @@ the License.
 -->
 <form id="replication" class="form-horizontal">
 	<!-- SOURCE -->
-	<div class="row span12" id="step1">
-		<div class="span2">
-			<h3>FROM: </h3>
-		</div>
-		<div class="source span10">
+	<div class="control-group" id="step1">
+		<label class="control-label">FROM: </label>
+		<div class="source controls">
 			<p>Select a database to replicate.</p>
 			<ul class="nav nav-tabs" id="sourceTabs">
 			  <li class="active">
@@ -30,7 +28,7 @@ the License.
 
 			<div class="tab-content small-tabs">
 				<div class="tab-pane active" id="source_local">
-					<input type="text" id="from_name" name="source" data-auth-selector="source_local" data-next-step="step2" class="permission next"  size="30" placeholder="Start typing the name of your database you'd like to replicate...">
+					<input type="text" id="from_name" name="source" data-auth-selector="source_local" data-next-step="step2" class="auto permission next"  size="30" placeholder="Start typing the name of your database you'd like to replicate...">
 
 					<div class="authArea_source_local"></div>
 				</div>
@@ -46,11 +44,9 @@ the License.
 
 	</div>
 
-	<div class="row span12 hide" id="step2">
-		<div class="span2">
-			<h3>TO:</h3>
-		</div>
-		<div class="target span10">
+	<div class="control-group hide" id="step2">
+		<label class="control-label">TO:</label>
+		<div class="target controls">
 			<p>Where do you want to replicate your data?</p>
 			<div class="btn-group" id="create_target">
 			  <button data-next-step="step3" class="btn next" type="button" value="false">Existing Database</button>
@@ -61,10 +57,8 @@ the License.
 	</div>
 
 	<!--TARGET-->
-	<div class="row span12 hide" id="step3">
-		<div class="span2">
-		</div>
-		<div class="target span10">
+	<div class="control-group hide" id="step3">
+		<div class="target controls">
 			<p>Select a target database for your database.</p>
 			<ul class="nav nav-tabs" id="targetTabs">
 			  <li class="active">
@@ -77,12 +71,12 @@ the License.
 
 			<div class="tab-content small-tabs">
 				<div class="tab-pane active" id="target_local">
-					<input type="text" id="to_name" name="target" size="30" placeholder="Select a target database"  data-auth-selector="target_local" class="permission">
+					<input type="text" id="to_name" name="target" size="30" placeholder="Select a target database"  data-auth-selector="target_local" class="permission auto next" data-next-step="step4">
 					<div class="authArea_target_local"></div>
 				</div>
 
 				<div class="tab-pane" id="target_remote">
-					<input type="text" id="to_url" name="target" size="30" value="http://">
+					<input type="text" id="to_url" name="target" size="30" class="next" value="http://" data-next-step="step4">
 					<small>e.g. http://username:password@user.cloudant.com/database</small>
 					<div class="authArea_target_remote"></div>
 				</div>
@@ -96,22 +90,21 @@ the License.
 		</div>
 
 	</div>
-	<div class="row span12 hide" id="step4">
-		<div class="span2">
-			<h3>NAME: </h3>
-		</div>
-		<div class="source span10">
+	<div class="control-group hide" id="step4">
+		<label class="control-label">NAME: </label>
+		<div class="source controls">
 			<p>Give this replication task an ID. (optional)</p>
-				<input type="text" id="repID" name="_id" size="30" value="" placeholder="e.g. my_rep">
+			<input type="text" id="repID" name="_id" size="30" value="" placeholder="e.g. my_rep">
+
+			<div class="actions">
+				<button class="button green save btn-large fonticon-replicate" type="submit" >Replicate</button>
+			</div>
 		</div>
-	</div>
 
+	</div>
 
 
 
-	<div class="actions">
-		<button class="button green save fonticon-replicate" type="submit" disabled>Replicate</button>
-	</div>
 </form>
 
 <div id="replicationStatus"></div>

http://git-wip-us.apache.org/repos/asf/couchdb/blob/02ea4cd9/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 a137aba..04e8630 100644
--- a/src/fauxton/app/addons/replication/views.js
+++ b/src/fauxton/app/addons/replication/views.js
@@ -49,7 +49,8 @@ function(app, FauxtonAPI, Components, replication) {
       "click .options": "toggleAdvancedOptions",
       "click .nav-tabs a": "tabs",
       "change .permission": "showMore",
-      "click .next": "nextStep",
+      "change .next": "nextStep",
+      "click button.next": "nextStep",
       "click #create_target button": "createTarget"
     },
     initialize: function(options){
@@ -61,12 +62,10 @@ function(app, FauxtonAPI, Components, replication) {
     afterRender: function(){
       this.dbSearchTypeahead = new Components.DbSearchTypeahead({
         dbLimit: 30,
-        el: "input#to_name"
-      });
-
-      this.dbSearchTypeahead = new Components.DbSearchTypeahead({
-        dbLimit: 30,
-        el: "input#from_name"
+        el: "input.auto",
+        updater: function(item){
+            return app.host+"/"+item;
+        }
       });
 
       this.dbSearchTypeahead.render();
@@ -96,28 +95,6 @@ function(app, FauxtonAPI, Components, replication) {
     establish: function(){
       return [ this.collection.fetch(), this.status.fetch()];
     },
-    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){
-          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;
@@ -147,10 +124,10 @@ function(app, FauxtonAPI, Components, replication) {
       var dataAuthSelector = this.$(e.currentTarget).attr('data-auth-selector'),
           autharea = ".authArea_"+dataAuthSelector;
 
-      if (this.dataAuthSelector){ this.dataAuthSelector.remove();}
+      if (this[dataAuthSelector]){ this[dataAuthSelector].remove();}
 
-      this.dataAuthSelector = this.insertView(autharea, new View.AuthFields({type:dataAuthSelector}));
-      this.dataAuthSelector.render();
+      this[dataAuthSelector] = this.insertView(autharea, new View.AuthFields({type:dataAuthSelector}));
+      this[dataAuthSelector].render();
     },
     showMore: function(e){
       if (this.$(e.currentTarget).attr('data-auth-selector') === "source_local"){
@@ -205,6 +182,28 @@ function(app, FauxtonAPI, Components, replication) {
         $button.text('Replication').attr('disabled', false);
       }
     },
+    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){
+          notification = FauxtonAPI.addNotification({
+            msg: "This database doesn't exist. Select New Database if you want to create it.",
+            type: "error",
+            clear: true
+          });
+        }
+      }else{
+        this.submit(e);
+      }
+    },
     submit: function(e){
       this.disableFields(); 
       var formJSON = {};
@@ -214,6 +213,8 @@ function(app, FauxtonAPI, Components, replication) {
         }
       });
 
+      // if (formJSON.)
+
       this.updateButtonText(true);
       this.startReplication(formJSON);
     }