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/05/31 22:08:45 UTC

[1/3] ambari git commit: AMBARI-11572. Admin View UI does not allow cluster association all the time (alexantonenko)

Repository: ambari
Updated Branches:
  refs/heads/trunk f3d49fade -> 23604e3a1


AMBARI-11572. Admin View UI does not allow cluster association all the time (alexantonenko)


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

Branch: refs/heads/trunk
Commit: f4631d7045fe6d76309f61f2a0adf7ce797d7b96
Parents: f3d49fa
Author: Alex Antonenko <hi...@gmail.com>
Authored: Sun May 31 21:32:19 2015 +0300
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Sun May 31 23:02:55 2015 +0300

----------------------------------------------------------------------
 .../ambariViews/CreateViewInstanceCtrl.js         | 18 +++++++++++++++++-
 .../controllers/ambariViews/ViewsEditCtrl.js      |  2 +-
 .../admin-web/app/views/ambariViews/create.html   |  2 +-
 .../ui/admin-web/app/views/ambariViews/edit.html  |  8 ++++----
 4 files changed, 23 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/f4631d70/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/CreateViewInstanceCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/CreateViewInstanceCtrl.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/CreateViewInstanceCtrl.js
index 902a593..9ee7cf7 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/CreateViewInstanceCtrl.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/CreateViewInstanceCtrl.js
@@ -64,9 +64,24 @@ angular.module('ambariAdminConsole')
     }
   });
 
+  $scope.enableLocalCluster = function () {
+    if($scope.errorKeys.length > 0) {
+      $scope.errorKeys.forEach( function (key) {
+        try {
+          $scope.form.instanceCreateForm[key].validationError = false;
+          $scope.form.instanceCreateForm[key].validationMessage = '';
+        } catch (e) {
+          console.log('Unable to reset error message for prop:', key);
+        }
+      });
+      $scope.errorKeys = [];
+    }
+  };
+
   // $scope.view = viewVersion;
   $scope.isAdvancedClosed = true;
   $scope.instanceExists = false;
+  $scope.errorKeys = [];
 
   $scope.clusterConfigurable = false;
   $scope.clusterConfigurableErrorMsg = "";
@@ -120,7 +135,7 @@ angular.module('ambariAdminConsole')
           var errorMessage = data.message;
           var showGeneralError = true;
 
-          if (data.status >= 400) {
+          if (data.status >= 400 && !$scope.instance.isLocalCluster) {
             try {
               var errorObject = JSON.parse(errorMessage);
               errorMessage = errorObject.detail;
@@ -129,6 +144,7 @@ angular.module('ambariAdminConsole')
                 if (!item.valid) {
                   showGeneralError = false;
                   $scope.form.instanceCreateForm[key].validationMessage = item.detail;
+                  $scope.errorKeys.push(key);
                 }
               });
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/f4631d70/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/ViewsEditCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/ViewsEditCtrl.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/ViewsEditCtrl.js
index 512761c..e7f80ee 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/ViewsEditCtrl.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/ViewsEditCtrl.js
@@ -300,7 +300,7 @@ angular.module('ambariAdminConsole')
         //TODO: maybe the BackEnd should sanitize the string beforehand?
         errorMessage = errorMessage.substr(errorMessage.indexOf("\{"));
 
-        if (data.status >= 400) {
+        if (data.status >= 400 && !$scope.isLocalCluster) {
           try {
             var errorObject = JSON.parse(errorMessage);
             errorMessage = errorObject.detail;

http://git-wip-us.apache.org/repos/asf/ambari/blob/f4631d70/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/create.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/create.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/create.html
index dd274a2..dffd66e 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/create.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/create.html
@@ -128,7 +128,7 @@
     <div class="panel-body property-form" popover="{{clusterConfigurableErrorMsg}}" popover-trigger="mouseenter">
       <div class="checkbox create-checkbox-cluster">
         <label>
-          <input type="radio" ng-disabled="!clusterConfigurable || noClusterAvailible" ng-model="instance.isLocalCluster" ng-value="true" class="visibilityCheckbox"> Local Ambari Managed Cluster
+          <input type="radio" ng-disabled="!clusterConfigurable || noClusterAvailible" ng-model="instance.isLocalCluster" ng-change="enableLocalCluster()" ng-value="true" class="visibilityCheckbox"> Local Ambari Managed Cluster
         </label>
       </div>
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/f4631d70/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/edit.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/edit.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/edit.html
index b41f639..ac058c0 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/edit.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/edit.html
@@ -211,18 +211,18 @@
   <div class="panel-body edit-view-custom-wrap">
     <form name="propertiesForm" class="form-horizontal property-form" ng-hide="isConfigurationEmpty" novalidate>
       <fieldset>
-        <div class="form-group" ng-repeat="property in configurationMeta | filter:{clusterConfig:true}" ng-class="{'has-error' : (!editConfigurationDisabled && ((property.required && propertiesForm[property.name].$error.required && !editConfigurationDisabled) || propertiesForm[property.name].validationError))}">
+        <div class="form-group" ng-repeat="property in configurationMeta | filter:{clusterConfig:true}" ng-class="{'has-error' : (!editConfigurationDisabled && !isLocalCluster && ((property.required && propertiesForm[property.name].$error.required && !editConfigurationDisabled) || propertiesForm[property.name].validationError))}">
           <label for="" class="control-label col-sm-3" ng-class="{'not-required': !property.required}">{{property.label || property.displayName}}{{property.required ? '*' : ''}}</label>
           <div ng-switch="property.type">
             <div class="col-sm-9 checkbox" ng-switch-when="boolean">
               <input type="checkbox" class="propertie-input" ng-disabled="isLocalCluster || editConfigurationDisabled" name="{{property.name}}" ng-model="configuration[property.name]" ng-true-value="true" ng-false-value="false" popover="{{property.description}}" popover-title="{{property.name}}" popover-trigger="mouseenter">
             </div>
             <div class="col-sm-9" ng-switch-default>
-              <input type="{{property.masked ? 'password' : 'text'}}" class="form-control propertie-input" ng-required="property.required" ng-change="propertiesForm[property.name].validationError=''" ng-disabled="isLocalCluster || editConfigurationDisabled" name="{{property.name}}" ng-model="configuration[property.name]" popover="{{property.description}}" popover-title="{{property.name}}" popover-trigger="mouseenter" placeholder="{{property.placeholder}}">
-              <div class="alert alert-danger no-margin-bottom top-margin" ng-show='property.required && propertiesForm[property.name].$error.required && !editConfigurationDisabled'>
+              <input type="{{property.masked ? 'password' : 'text'}}" class="form-control propertie-input" ng-required="property.required && !isLocalCluster" ng-change="propertiesForm[property.name].validationError=''" ng-disabled="isLocalCluster || editConfigurationDisabled" name="{{property.name}}" ng-model="configuration[property.name]" popover="{{property.description}}" popover-title="{{property.name}}" popover-trigger="mouseenter" placeholder="{{property.placeholder}}">
+              <div class="alert alert-danger no-margin-bottom top-margin" ng-show='property.required && propertiesForm[property.name].$error.required && !editConfigurationDisabled && !isLocalCluster'>
                 This field is required.
               </div>
-              <div class="alert alert-danger no-margin-bottom top-margin" ng-show='property.required && propertiesForm[property.name].validationError && !editConfigurationDisabled'>
+              <div class="alert alert-danger no-margin-bottom top-margin" ng-show='property.required && propertiesForm[property.name].validationError && !editConfigurationDisabled && !isLocalCluster'>
                 {{propertiesForm[property.name].validationMessage}}
               </div>
             </div>


[3/3] ambari git commit: AMBARI-11578. View instance creation should default to automatic mode. (alexantonenko)

Posted by al...@apache.org.
AMBARI-11578. View instance creation should default to automatic mode. (alexantonenko)


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

Branch: refs/heads/trunk
Commit: 23604e3a199457030cb531e05e2dc594b3db80b6
Parents: 2ea32f8
Author: Alex Antonenko <hi...@gmail.com>
Authored: Sun May 31 22:59:04 2015 +0300
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Sun May 31 23:06:29 2015 +0300

----------------------------------------------------------------------
 .../ambariViews/CreateViewInstanceCtrl.js       | 27 ++++++++++++--------
 1 file changed, 16 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/23604e3a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/CreateViewInstanceCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/CreateViewInstanceCtrl.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/CreateViewInstanceCtrl.js
index 9ee7cf7..ddda59e 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/CreateViewInstanceCtrl.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/CreateViewInstanceCtrl.js
@@ -52,6 +52,7 @@ angular.module('ambariAdminConsole')
         description: '',
         isLocalCluster: false
       };
+      loadClusters();
     });
   }
 
@@ -91,17 +92,21 @@ angular.module('ambariAdminConsole')
   $scope.numberOfClusterConfigs = 0;
   $scope.numberOfSettingConfigs = 0;
 
-  Cluster.getAllClusters().then(function (clusters) {
-    if(clusters.length >0){
-      clusters.forEach(function(cluster) {
-        $scope.clusters.push(cluster.Clusters.cluster_name)
-      });
-      $scope.noClusterAvailible = false;
-    }else{
-      $scope.clusters.push("No Clusters");
-    }
-    $scope.cluster = $scope.clusters[0];
-  });
+  function loadClusters () {
+    Cluster.getAllClusters().then(function (clusters) {
+      if(clusters.length >0){
+        clusters.forEach(function(cluster) {
+          $scope.clusters.push(cluster.Clusters.cluster_name)
+        });
+        $scope.noClusterAvailible = false;
+        $scope.instance.isLocalCluster = $scope.clusterConfigurable;
+      }else{
+        $scope.clusters.push("No Clusters");
+      }
+      $scope.cluster = $scope.clusters[0];
+    });
+  }
+
 
   $scope.versions = [];
   $scope.version = null;


[2/3] ambari git commit: AMBARI-11574. Kerberos: ignore some properties in stack advisor for manually enabled Kerberos. (alexantonenko)

Posted by al...@apache.org.
AMBARI-11574. Kerberos: ignore some properties in stack advisor for manually enabled Kerberos. (alexantonenko)


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

Branch: refs/heads/trunk
Commit: 2ea32f886d06f30acb1ba03449447894cbbe5492
Parents: f4631d7
Author: Alex Antonenko <hi...@gmail.com>
Authored: Sun May 31 21:50:43 2015 +0300
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Sun May 31 23:06:29 2015 +0300

----------------------------------------------------------------------
 .../app/controllers/wizard/step7_controller.js  | 40 ++++++++++++++++
 .../test/controllers/wizard/step7_test.js       | 50 ++++++++++++++++++++
 2 files changed, 90 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/2ea32f88/ambari-web/app/controllers/wizard/step7_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step7_controller.js b/ambari-web/app/controllers/wizard/step7_controller.js
index 3cc31f0..8550932 100644
--- a/ambari-web/app/controllers/wizard/step7_controller.js
+++ b/ambari-web/app/controllers/wizard/step7_controller.js
@@ -443,6 +443,8 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E
     var serviceConfig = App.config.createServiceConfig(serviceName);
     service.set('selectedConfigGroup', this.get('preSelectedConfigGroup'));
     this.loadComponentConfigs(service.get('configs'), serviceConfig, service);
+    // override if a property isRequired or not
+    this._overrideConfigIsRequired(serviceName);
     service.set('configs', serviceConfig.get('configs'));
   },
 
@@ -1437,5 +1439,43 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E
         $('a[href="#' + service.serviceName + '"]').tab('show');
       }
     }
+  },
+
+  /**
+   * Override isRequired property of the configurations in given situation
+   * @param serviceName - make changes only for properties from this service
+   * @private
+   */
+  _overrideConfigIsRequired: function (serviceName) {
+    var excludeProperties = [
+      {
+        name: 'KERBEROS',                                                                // affected service
+        exclude: ['kdc_host', 'admin_server_host', 'admin_principal', 'admin_password'], // affected properties
+        condition: 'false',                                                              // check this condition
+        conditionalProperty: 'manage_identities'                                         // against this property
+      }
+    ];
+
+    var configs = this.get('stepConfigs'),
+      service = excludeProperties.findProperty('name', serviceName),
+      serviceConfigs = configs.findProperty('serviceName', serviceName);
+    if (service && !Em.isEmpty(serviceConfigs.configs)) {
+      var conditionProperty = serviceConfigs.configs.findProperty('name', service.conditionalProperty);
+      if (conditionProperty && conditionProperty.get('savedValue') === service.condition) {
+        service.exclude.forEach(function(property) {
+          var serviceProperty = serviceConfigs.configs.findProperty('name', property);
+          if (serviceProperty) {
+            Em.set(serviceProperty, "isRequired", false);
+            if (serviceProperty.get('value')==='') {
+              // clear validation errors because validation does not clear isRequired validations
+              Em.set(serviceProperty, "error", false);
+              Em.set(serviceProperty, "errorMessage", '');
+            }
+            // validate property
+            serviceProperty.validate();
+          }
+        })
+      };
+    }
   }
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/2ea32f88/ambari-web/test/controllers/wizard/step7_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step7_test.js b/ambari-web/test/controllers/wizard/step7_test.js
index 72e2753..0d69d36 100644
--- a/ambari-web/test/controllers/wizard/step7_test.js
+++ b/ambari-web/test/controllers/wizard/step7_test.js
@@ -2107,4 +2107,54 @@ describe('App.InstallerStep7Controller', function () {
 
   });
 
+  describe('#_overrideConfigIsRequired', function () {
+    var controller;
+    beforeEach(function() {
+      controller = App.WizardStep7Controller.create({});
+      var configs = Em.A([
+        App.ServiceConfigProperty.create({ name: 'manage_identities', value: 'true', savedValue: 'true', category: 'KDC', serviceName: 'KERBEROS'}),
+        App.ServiceConfigProperty.create({ name: 'kdc_host', value: '', category: 'KDC', serviceName: 'KERBEROS'}),
+        App.ServiceConfigProperty.create({ name: 'admin_server_host', value: '', category: 'KDC', serviceName: 'KERBEROS'}),
+        App.ServiceConfigProperty.create({ name: 'admin_principal', value: '', category: 'KDC', serviceName: 'KERBEROS'}),
+        App.ServiceConfigProperty.create({ name: 'admin_password', value: '', category: 'KDC', serviceName: 'KERBEROS'})
+      ]);
+      configs.forEach(function(config) {
+        config.validate(); // make isRequired to trigger validation and to set every property's error flag to true
+      });
+      var serviceConfigs = Em.A([
+        App.ServiceConfig.create({
+          'serviceName': 'KERBEROS',
+          'configs': configs
+        })
+      ]);
+      controller.set('stepConfigs', serviceConfigs);
+    });
+
+
+    it('manage_identities = true should warn user that fields are required', function () {
+      controller._overrideConfigIsRequired("KERBEROS");
+
+      var allTrue = true;
+      controller.get('stepConfigs')[0].configs.forEach(function(p) {
+        allTrue = allTrue && !p.error;
+      });
+      // should have error
+      expect(allTrue).to.be.false;
+    });
+
+    it('manage_identities = false should NOT warn user that fields are required', function () {
+      // manage_identities = false
+      Em.set(controller.get('stepConfigs')[0].configs.findProperty('name','manage_identities'), 'savedValue', 'false');
+
+      controller._overrideConfigIsRequired("KERBEROS");
+
+      var allTrue = true;
+      controller.get('stepConfigs')[0].configs.forEach(function(p) {
+        allTrue = allTrue && !p.error;
+      });
+
+      expect(allTrue).to.be.true;
+    });
+  });
+
 });