Repository: ambari
Updated Branches:
  refs/heads/trunk 1bd7f3482 -> 09c3ad4ef


AMBARI-16962. REmote cluster with non-URI safe chars cause problems (pallavkul)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/09c3ad4e
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/09c3ad4e
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/09c3ad4e

Branch: refs/heads/trunk
Commit: 09c3ad4ef1d378e133727c4cdf2e8e86211b89de
Parents: 1bd7f34
Author: Pallav Kulshreshtha <[email protected]>
Authored: Thu Jun 2 20:17:07 2016 +0530
Committer: Pallav Kulshreshtha <[email protected]>
Committed: Thu Jun 2 20:17:07 2016 +0530

----------------------------------------------------------------------
 .../remoteClusters/RemoteClustersCreateCtrl.js        |  2 ++
 .../remoteClusters/RemoteClustersEditCtrl.js          |  2 ++
 .../views/remoteClusters/editRemoteClusterPage.html   |  9 +++++----
 .../app/views/remoteClusters/remoteClusterPage.html   | 14 +++++++-------
 4 files changed, 16 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/09c3ad4e/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/remoteClusters/RemoteClustersCreateCtrl.js
----------------------------------------------------------------------
diff --git 
a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/remoteClusters/RemoteClustersCreateCtrl.js
 
b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/remoteClusters/RemoteClustersCreateCtrl.js
index e669c82..0977d09 100644
--- 
a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/remoteClusters/RemoteClustersCreateCtrl.js
+++ 
b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/remoteClusters/RemoteClustersCreateCtrl.js
@@ -23,6 +23,8 @@ angular.module('ambariAdminConsole')
 
   $scope.cluster = {};
 
+  $scope.nameValidationPattern = /^\s*\w*\s*$/;
+
   $scope.registerRemoteCluster = function () {
     $scope.form.submitted = true;
     if ($scope.form.$valid){

http://git-wip-us.apache.org/repos/asf/ambari/blob/09c3ad4e/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/remoteClusters/RemoteClustersEditCtrl.js
----------------------------------------------------------------------
diff --git 
a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/remoteClusters/RemoteClustersEditCtrl.js
 
b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/remoteClusters/RemoteClustersEditCtrl.js
index ec2915e..7dbe103 100644
--- 
a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/remoteClusters/RemoteClustersEditCtrl.js
+++ 
b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/remoteClusters/RemoteClustersEditCtrl.js
@@ -24,6 +24,8 @@ angular.module('ambariAdminConsole')
   $scope.cluster = {};
   $scope.instancesAffected = [];
 
+  $scope.nameValidationPattern = /^\s*\w*\s*$/;
+
   $scope.openChangePwdDialog = function() {
     var modalInstance = $modal.open({
       templateUrl: 'views/remoteClusters/modals/changePassword.html',

http://git-wip-us.apache.org/repos/asf/ambari/blob/09c3ad4e/ambari-admin/src/main/resources/ui/admin-web/app/views/remoteClusters/editRemoteClusterPage.html
----------------------------------------------------------------------
diff --git 
a/ambari-admin/src/main/resources/ui/admin-web/app/views/remoteClusters/editRemoteClusterPage.html
 
b/ambari-admin/src/main/resources/ui/admin-web/app/views/remoteClusters/editRemoteClusterPage.html
index e3fbe9c..c3ad9e7 100644
--- 
a/ambari-admin/src/main/resources/ui/admin-web/app/views/remoteClusters/editRemoteClusterPage.html
+++ 
b/ambari-admin/src/main/resources/ui/admin-web/app/views/remoteClusters/editRemoteClusterPage.html
@@ -31,15 +31,16 @@
 <form class="form-horizontal create-user-form" role="form" novalidate 
name="form" autocomplete="off">
 
   <div class="form-group" ng-class="{'has-error' : 
form.user_name.$error.required && form.submitted}">
-    <label for="clustername" class="col-sm-2 
control-label">{{'views.clusterName' | translate}}</label>
+    <label for="clustername" class="col-sm-2 
control-label">{{'views.clusterName' | translate}}*</label>
     <div class="col-sm-10">
-      <input type="text" id="clustername" class="form-control" 
name="cluster_name" ng-pattern="/[a-zA-Z0-9\-]*/" placeholder="Cluster Name" 
ng-model="cluster.cluster_name" required autocomplete="off">
+      <input type="text" id="clustername" class="form-control" 
name="cluster_name" ng-pattern="nameValidationPattern" placeholder="Cluster 
Name" ng-model="cluster.cluster_name" required autocomplete="off">
       <div class="alert alert-danger top-margin" 
ng-show="form.cluster_name.$error.required && form.submitted"> 
{{'common.alerts.fieldIsRequired' | translate}}</div>
+      <div class="alert alert-danger top-margin" 
ng-show='form.cluster_name.$error.pattern && 
form.submitted'>{{'views.alerts.noSpecialCharsOrSpaces' | translate}}</div>
     </div>
   </div>
 
   <div class="form-group" ng-class="{'has-error' : 
form.user_name.$error.required && form.submitted}">
-    <label for="clusterurl" class="col-sm-2 
control-label">{{'users.ambariClusterURL' | translate}}</label>
+    <label for="clusterurl" class="col-sm-2 
control-label">{{'users.ambariClusterURL' | translate}}*</label>
     <div class="col-sm-10">
       <input type="text" id="clusterurl" class="form-control" 
name="cluster_url" placeholder="Ambari Cluster URL" 
ng-model="cluster.cluster_url" required autocomplete="off">
       <div class="alert alert-danger top-margin" 
ng-show="form.cluster_url.$error.required && form.submitted"> 
{{'common.alerts.fieldIsRequired' | translate}}</div>
@@ -47,7 +48,7 @@
   </div>
 
   <div class="form-group" ng-class="{'has-error' : 
form.user_name.$error.required && form.submitted}" style="display: none" >
-    <label for="clusteruser" class="col-sm-2 control-label"> 
{{'users.roles.clusterUser' | translate}}</label>
+    <label for="clusteruser" class="col-sm-2 control-label"> 
{{'users.roles.clusterUser' | translate}}*</label>
     <div class="col-sm-10">
       <input type="text" id="clusteruser" class="form-control" 
name="cluster_user" placeholder="Cluster User" ng-model="cluster.cluster_user" 
required autocomplete="off">
       <div class="alert alert-danger top-margin" 
ng-show="form.cluster_user.$error.required && form.submitted"> 
{{'common.alerts.fieldIsRequired' | translate}}</div>

http://git-wip-us.apache.org/repos/asf/ambari/blob/09c3ad4e/ambari-admin/src/main/resources/ui/admin-web/app/views/remoteClusters/remoteClusterPage.html
----------------------------------------------------------------------
diff --git 
a/ambari-admin/src/main/resources/ui/admin-web/app/views/remoteClusters/remoteClusterPage.html
 
b/ambari-admin/src/main/resources/ui/admin-web/app/views/remoteClusters/remoteClusterPage.html
index 0f82360..db869f2 100644
--- 
a/ambari-admin/src/main/resources/ui/admin-web/app/views/remoteClusters/remoteClusterPage.html
+++ 
b/ambari-admin/src/main/resources/ui/admin-web/app/views/remoteClusters/remoteClusterPage.html
@@ -23,16 +23,16 @@
 <form class="form-horizontal create-user-form" role="form" novalidate 
name="form" autocomplete="off">
 
   <div class="form-group" ng-class="{'has-error' : 
form.user_name.$error.required && form.submitted}">
-    <label for="clustername" class="col-sm-2 
control-label">{{'views.clusterName' | translate}} </label>
+    <label for="clustername" class="col-sm-2 
control-label">{{'views.clusterName' | translate}}* </label>
     <div class="col-sm-10">
-      <input type="text" id="clustername" class="form-control" 
ng-pattern="/[a-zA-Z0-9\-]*/" name="cluster_name" placeholder="Ambari Cluster 
Name" ng-model="cluster.cluster_name" required autocomplete="off">
+      <input type="text" id="clustername" class="form-control" 
ng-pattern="nameValidationPattern" name="cluster_name" placeholder="Ambari 
Cluster Name" ng-model="cluster.cluster_name" required autocomplete="off">
       <div class="alert alert-danger top-margin" 
ng-show="form.cluster_name.$error.required && form.submitted"> 
{{'common.alerts.fieldIsRequired' | translate}}</div>
-      <div class="alert alert-danger top-margin" 
ng-show="form.cluster_name.$error.pattern && form.submitted"> 
{{'views.alerts.noSpecialChars' | translate}}</div>
+      <div class="alert alert-danger top-margin" 
ng-show='form.cluster_name.$error.pattern && 
form.submitted'>{{'views.alerts.noSpecialCharsOrSpaces' | translate}}</div>
     </div>
   </div>
 
   <div class="form-group" ng-class="{'has-error' : 
form.user_name.$error.required && form.submitted}">
-    <label for="clusterurl" class="col-sm-2 
control-label">{{'users.ambariClusterURL' | translate}}</label>
+    <label for="clusterurl" class="col-sm-2 
control-label">{{'users.ambariClusterURL' | translate}}*</label>
     <div class="col-sm-10">
       <input type="text" id="clusterurl" class="form-control" 
name="cluster_url" placeholder="http://ambari.server:8080/api/v1/clusters/c1"; 
ng-model="cluster.cluster_url" required autocomplete="off">
       <div class="alert alert-danger top-margin" 
ng-show="form.cluster_url.$error.required && form.submitted"> 
{{'common.alerts.fieldIsRequired' | translate}}</div>
@@ -40,7 +40,7 @@
   </div>
 
   <div class="form-group" ng-class="{'has-error' : 
form.user_name.$error.required && form.submitted}">
-    <label for="clusteruser" class="col-sm-2 control-label"> 
{{'users.roles.clusterUser' | translate}}</label>
+    <label for="clusteruser" class="col-sm-2 control-label"> 
{{'users.roles.clusterUser' | translate}}*</label>
     <div class="col-sm-10">
       <input type="text" id="clusteruser" class="form-control" 
name="cluster_user" placeholder="Cluster User" ng-model="cluster.cluster_user" 
required autocomplete="off">
       <div class="alert alert-danger top-margin" 
ng-show="form.cluster_user.$error.required && form.submitted"> 
{{'common.alerts.fieldIsRequired' | translate}}</div>
@@ -48,10 +48,10 @@
   </div>
 
   <div class="form-group" ng-class="{'has-error' : 
(form.password.$error.required && form.submitted) || 
form.confirmPassword.$error.passwordVerify}">
-    <label for="password" class="col-sm-2 control-label">{{'users.password' | 
translate}}</label>
+    <label for="password" class="col-sm-2 control-label">{{'users.password' | 
translate}}*</label>
     <div class="col-sm-10">
       <input type="password" id="password" class="form-control bottom-margin 
userpassword" name="password" placeholder="Password" required 
ng-model="cluster.cluster_password" autocomplete="off">
-      <div class="alert alert-danger" 
ng-show='form.confirmPassword.$error.passwordVerify'>Wrong Password</div>
+      <div class="alert alert-danger" 
ng-show='form.confirmPassword.$error.passwordVerify'>{{'users.alerts.wrongPassword'
 | translate}}</div>
       <div class="alert alert-danger" ng-show='form.password.$error.required 
&& form.submitted'>{{'common.alerts.passwordRequired' | translate}}</div>
     </div>
   </div>

Reply via email to