ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ababiic...@apache.org
Subject ambari git commit: AMBARI-11297 Install Wizard > Customize Services: confusing display regarding config changes. (ababiichuk)
Date Thu, 21 May 2015 13:14:17 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 46d142795 -> 6f3617353


AMBARI-11297 Install Wizard > Customize Services: confusing display regarding config changes.
(ababiichuk)


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

Branch: refs/heads/trunk
Commit: 6f3617353498fdf306eab36a3e5ee1fba93f90d2
Parents: 46d1427
Author: aBabiichuk <ababiichuk@cybervisiontech.com>
Authored: Thu May 21 15:15:54 2015 +0300
Committer: aBabiichuk <ababiichuk@cybervisiontech.com>
Committed: Thu May 21 15:57:17 2015 +0300

----------------------------------------------------------------------
 .../app/controllers/wizard/step7_controller.js  |  3 +-
 .../mixins/common/configs/enhanced_configs.js   | 58 +++++++++++++++++---
 ambari-web/app/mixins/common/serverValidator.js |  2 +
 3 files changed, 54 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/6f361735/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 f0ae1d3..3f3cafb 100644
--- a/ambari-web/app/controllers/wizard/step7_controller.js
+++ b/ambari-web/app/controllers/wizard/step7_controller.js
@@ -641,7 +641,6 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin,
App.E
     }
     self.setStepConfigs(configs, storedConfigs);
     this.loadServerSideConfigsRecommendations().always(function () {
-      self.set('isRecommendedLoaded', true);
       // format descriptor configs
       var serviceConfigProperties = (self.get('content.serviceConfigProperties') || []).mapProperty('name');
       var recommendedToDelete = self.get('_dependentConfigValues').filterProperty('toDelete');
@@ -657,6 +656,8 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin,
App.E
       self.activateSpecialConfigs();
       self.selectProperService();
       self.restoreRecommendedConfigs();
+      self.clearDependentConfigsByService(App.StackService.find().filterProperty('isSelected').mapProperty('serviceName'));
+      self.set('isRecommendedLoaded', true);
       if (self.get('content.skipConfigStep')) {
         App.router.send('next');
       }

http://git-wip-us.apache.org/repos/asf/ambari/blob/6f361735/ambari-web/app/mixins/common/configs/enhanced_configs.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/common/configs/enhanced_configs.js b/ambari-web/app/mixins/common/configs/enhanced_configs.js
index 85df56b..6a214c7 100644
--- a/ambari-web/app/mixins/common/configs/enhanced_configs.js
+++ b/ambari-web/app/mixins/common/configs/enhanced_configs.js
@@ -48,11 +48,13 @@ App.EnhancedConfigsMixin = Em.Mixin.create({
   /**
    * defines if initialValue of config can be used on current controller
    * if not savedValue is used instead
-   * @type {boolean}
+   * @param {String} serviceName
+   * @return {boolean}
+   * @method useInitialValue
    */
-  useInitialValue: function() {
-    ['wizardStep7Controller'].contains(this.get('name'));
-  }.property('name'),
+  useInitialValue: function(serviceName) {
+    return ['wizardStep7Controller'].contains(this.get('name')) && !App.Service.find().findProperty('serviceName',
serviceName);
+  },
 
 
   /**
@@ -139,6 +141,18 @@ App.EnhancedConfigsMixin = Em.Mixin.create({
     });
   },
 
+  /**
+   * clear values for dependent configs for given services
+   * @method clearDependentConfigs
+   * @private
+   */
+  clearDependentConfigsByService: function(serviceNames) {
+    var cleanDependencies = this.get('_dependentConfigValues').reject(function(c) {
+      return serviceNames.contains(c.serviceName);
+    }, this);
+    this.set('_dependentConfigValues', cleanDependencies);
+  },
+
   onConfigGroupChangeForEnhanced: function() {
     if (this.get('name') === 'mainServiceInfoConfigsController') {
       this.clearDependentConfigs();
@@ -426,7 +440,7 @@ App.EnhancedConfigsMixin = Em.Mixin.create({
 
           var value = override ? override.get('value') : cp && cp.get('value');
 
-          if (this.get('useInitialValue')) {
+          if (this.useInitialValue(serviceName)) {
             initialValue = override ? override.get('initialValue') : cp && cp.get('initialValue');
           } else {
             initialValue = override ? override.get('savedValue') : cp && cp.get('savedValue');
@@ -546,7 +560,7 @@ App.EnhancedConfigsMixin = Em.Mixin.create({
                 self.get('_dependentConfigValues').pushObject({
                   saveRecommended: true,
                   saveRecommendedDefault: true,
-                  propertyValue: cp && (cp.get('useInitialValue') ? cp.get('initialValue')
: cp.get('savedValue')),
+                  propertyValue: cp && (self.useInitialValue(serviceName) ? cp.get('initialValue')
: cp.get('savedValue')),
                   toDelete: true,
                   toAdd: false,
                   isDeleted: true,
@@ -624,7 +638,7 @@ App.EnhancedConfigsMixin = Em.Mixin.create({
           this.addOverrideProperty(cp, selectedGroup, Em.get(propertyToAdd, 'recommendedValue'),
!Em.get(propertyToAdd, 'isDeleted'));
         }
         Em.setProperties(propertyToAdd, {
-          isDeleted: false,
+          isDeleted: Em.get(propertyToAdd, 'isDeleted'),
           toAdd: false,
           toDelete: false
         });
@@ -669,6 +683,8 @@ App.EnhancedConfigsMixin = Em.Mixin.create({
             toAdd: false,
             toDelete: false
           });
+        } else {
+          this.get('_dependentConfigValues').removeObject(propertyToDelete);
         }
       }, this);
     }
@@ -697,7 +713,7 @@ App.EnhancedConfigsMixin = Em.Mixin.create({
           } else {
             if (stepConfigs.get('serviceName') !== this.get('content.serviceName')) {
               if (propertyToUpdate.saveRecommended || cp.get('value') == propertyToUpdate.recommendedValue)
{
-                cp.set('value', this.get('useInitialValue') ? cp.get('initialValue') : cp.get('savedValue'));
+                cp.set('value', this.useInitialValue(stepConfigs.get('serviceName')) ? cp.get('initialValue')
: cp.get('savedValue'));
               }
               cp.set('recommendedValue', propertyToUpdate.recommendedValue);
             }
@@ -712,6 +728,32 @@ App.EnhancedConfigsMixin = Em.Mixin.create({
         }
       }, this);
     }
+  },
+
+  /**
+   * On first load on installer and add service <code>initialValue<code> of <code>serviceConfigProperty<code>
object
+   * that contains value from stack should be overriden by dynamic recommendation.
+   * Do this only for not installed services as in this case <code>initialValue<code>
is not used.
+   * @param configObject
+   */
+  updateInitialValue: function(configObject) {
+    for (var key in configObject) {
+      /**  defines main info for file name (service name, config group, config that belongs
to filename) **/
+      var service = App.config.getServiceByConfigType(key);
+      if (App.Service.find().filterProperty('serviceName', service.get('serviceName'))) {
+        var stepConfig = this.get('stepConfigs').findProperty('serviceName', service.get('serviceName'));
+        if (stepConfig) {
+          var configProperties = stepConfig ? stepConfig.get('configs').filterProperty('filename',
App.config.getOriginalFileName(key)) : [];
+
+          for (var propertyName in configObject[key].properties) {
+            var configProperty = configProperties.findProperty('name', propertyName);
+            if (configProperty) {
+              configProperty.set('initialValue', configObject[key].properties[propertyName]);
+            }
+          }
+        }
+      }
+    }
   }
 
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/6f361735/ambari-web/app/mixins/common/serverValidator.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/common/serverValidator.js b/ambari-web/app/mixins/common/serverValidator.js
index 8ee28ef..47c6624 100644
--- a/ambari-web/app/mixins/common/serverValidator.js
+++ b/ambari-web/app/mixins/common/serverValidator.js
@@ -142,6 +142,8 @@ App.ServerValidatorMixin = Em.Mixin.create({
       console.warn('error while loading default config values');
     }
     this._saveRecommendedValues(data);
+    var configObject = data.resources[0].recommendations.blueprint.configurations;
+    if (configObject) this.updateInitialValue(configObject);
     this.set("recommendationsConfigs", Em.get(data.resources[0] , "recommendations.blueprint.configurations"));
   },
 


Mime
View raw message