You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by al...@apache.org on 2015/06/19 18:38:44 UTC

ambari git commit: AMBARI-12005. Admin View: Setting cluster name to more than 100 chars hangs ambari-server (alexantonenko)

Repository: ambari
Updated Branches:
  refs/heads/trunk db55ececd -> e7a4800b2


AMBARI-12005. Admin View: Setting cluster name to more than 100 chars hangs ambari-server (alexantonenko)


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

Branch: refs/heads/trunk
Commit: e7a4800b2c0bd2cc83ec8340f95636012366db58
Parents: db55ece
Author: Alex Antonenko <hi...@gmail.com>
Authored: Fri Jun 19 18:42:35 2015 +0300
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Fri Jun 19 19:38:40 2015 +0300

----------------------------------------------------------------------
 .../ui/admin-web/app/views/leftNavbar.html         | 17 +++++++++++++----
 .../app/controllers/wizard/step0_controller.js     |  4 ++++
 ambari-web/app/messages.js                         |  1 +
 3 files changed, 18 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/e7a4800b/ambari-admin/src/main/resources/ui/admin-web/app/views/leftNavbar.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/leftNavbar.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/leftNavbar.html
index 4795ec8..471d899 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/leftNavbar.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/leftNavbar.html
@@ -22,12 +22,20 @@
       <div class="cluster-section" ng-show="cluster">
         <div id="cluster-name"  ng-switch on="editCluster.editingName">
           <h5 ng-switch-when="false">{{cluster.Clusters.cluster_name}}
-            <i ng-show="cluster.Clusters.provisioning_state == 'INSTALLED'" ng-click="toggleEditName()" class="glyphicon glyphicon-edit pull-right edit-cluster-name" tooltip="Rename Cluster"></i>
+            <i ng-show="cluster.Clusters.provisioning_state == 'INSTALLED'" 
+               ng-click="toggleEditName()" 
+               class="glyphicon glyphicon-edit pull-right edit-cluster-name" tooltip="Rename Cluster">
+            </i>
           </h5>
 
-          <form ng-keyup="toggleEditName($event)" tabindex="1" name="editClusterNameForm" class="editClusterNameForm" ng-switch-when="true"
+          <form ng-keyup="toggleEditName($event)" 
+                tabindex="1" 
+                name="editClusterNameForm" 
+                class="editClusterNameForm" 
+                ng-switch-when="true"
                 ng-submit="editCluster.name !== cluster.Clusters.cluster_name && editClusterNameForm.newClusterName.$valid && confirmClusterNameChange()">
-            <div class="form-group" ng-class="{'has-error': editClusterNameForm.newClusterName.$invalid && !editClusterNameForm.newClusterName.$pristine }">
+            <div class="form-group" 
+                 ng-class="{'has-error': editClusterNameForm.newClusterName.$invalid && !editClusterNameForm.newClusterName.$pristine }">
               <input
                   autofocus
                   type="text"
@@ -37,7 +45,8 @@
                   ng-trim="false"
                   ng-model="editCluster.name"
                   class="form-control input-sm"
-                  tooltip="Only alpha-numeric characters."
+                  ng-maxlength="80"
+                  tooltip="Only alpha-numeric characters, up to 80 characters"
                   tooltip-trigger="focus">
               <button ng-click="toggleEditName()"
                       class="btn btn-xs">

http://git-wip-us.apache.org/repos/asf/ambari/blob/e7a4800b/ambari-web/app/controllers/wizard/step0_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step0_controller.js b/ambari-web/app/controllers/wizard/step0_controller.js
index 1cff37d..5f134b5 100644
--- a/ambari-web/app/controllers/wizard/step0_controller.js
+++ b/ambari-web/app/controllers/wizard/step0_controller.js
@@ -33,10 +33,14 @@ App.WizardStep0Controller = Em.Controller.extend({
    * set <code>clusterNameError</code> if validation fails
    */
   invalidClusterName: function () {
+    var MAX_CLUSTER_NAME_LENGTH = 80;
     var clusterName = this.get('content.cluster.name');
     if (clusterName == '' && this.get('hasSubmitted')) {
       this.set('clusterNameError', Em.I18n.t('installer.step0.clusterName.error.required'));
       return true;
+    } else if (clusterName.length > MAX_CLUSTER_NAME_LENGTH) {
+      this.set('clusterNameError', Em.I18n.t('installer.step0.clusterName.error.tooLong'));
+      return true;
     } else if (/\s/.test(clusterName)) {
       this.set('clusterNameError', Em.I18n.t('installer.step0.clusterName.error.whitespace'));
       return true;

http://git-wip-us.apache.org/repos/asf/ambari/blob/e7a4800b/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 1ea4bf2..f752dd6 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -487,6 +487,7 @@ Em.I18n.translations = {
   'installer.step0.clusterName.tooltip.title':'Cluster Name',
   'installer.step0.clusterName.tooltip.content':'Enter a unique cluster name.',
   'installer.step0.clusterName.error.required':'Cluster Name is required',
+  'installer.step0.clusterName.error.tooLong':'Cluster Name is too long',
   'installer.step0.clusterName.error.whitespace':'Cluster Name cannot contain whitespace',
   'installer.step0.clusterName.error.specialChar':'Cluster Name cannot contain special characters',