Browse Source

AMBARI-10344 Min/Max/Step/etc from '/recommendations' API should override '/stacks' data. (ababiichuk)

aBabiichuk 10 years ago
parent
commit
0055b86bfa

+ 20 - 18
ambari-web/app/mixins/common/configs/enhanced_configs.js

@@ -464,7 +464,7 @@ App.EnhancedConfigsMixin = Em.Mixin.create({
    * @private
    */
   _getConfigsByGroup: function(stepConfigs) {
-    if (this.get('selectedConfigGroup.isDefault')) {
+    if (this.get('selectedConfigGroup.isDefault') || this.get('controller.name') === 'wizardStep7Controller') {
       return stepConfigs;
     } else {
       var configsToSend = [];
@@ -505,7 +505,8 @@ App.EnhancedConfigsMixin = Em.Mixin.create({
     for (var key in configs) {
 
       /**  defines main info for file name (service name, config group, config that belongs to filename) **/
-      var serviceName = App.config.getServiceByConfigType(key).get('serviceName');
+      var service = App.config.getServiceByConfigType(key);
+      var serviceName = service.get('serviceName');
       var stepConfig = stepConfigsByGroup.findProperty('serviceName', serviceName);
       var configProperties = stepConfig ? stepConfig.get('configs').filterProperty('filename', App.config.getOriginalFileName(key)) : [];
 
@@ -531,7 +532,7 @@ App.EnhancedConfigsMixin = Em.Mixin.create({
                   saveRecommendedDefault: true,
                   fileName: key,
                   propertyName: propertyName,
-                  configGroup: group.get('name'),
+                  configGroup: group ? group.get('name') : service.get('displayName') + " Default",
                   value: value,
                   serviceName: serviceName,
                   recommendedValue: configs[key].properties[propertyName]
@@ -539,22 +540,23 @@ App.EnhancedConfigsMixin = Em.Mixin.create({
               }
             }
           }
-          /**
-           * saving new attribute values
-           */
-          if (configs[key].property_attributes && configs[key].property_attributes[propertyName]) {
+        }
 
-            var stackProperty = App.StackConfigProperty.find(propertyName + '_' + key);
-            if (stackProperty && stackProperty.get('valueAttributes')) {
-              if (configs[key].property_attributes[propertyName].min) {
-                stackProperty.set('valueAttributes.minimum', configs[key].property_attributes[propertyName].min);
-              }
-              if (configs[key].property_attributes[propertyName].max) {
-                stackProperty.set('valueAttributes.maximum', configs[key].property_attributes[propertyName].max);
-              }
-              if (configs[key].property_attributes[propertyName].step) {
-                stackProperty.set('valueAttributes.step', configs[key].property_attributes[propertyName].step);
-              }
+        /**
+         * saving new attribute values
+         */
+        if (configs[key].property_attributes && configs[key].property_attributes[propertyName]) {
+
+          var stackProperty = App.StackConfigProperty.find(propertyName + '_' + key);
+          if (stackProperty && stackProperty.get('valueAttributes')) {
+            if (configs[key].property_attributes[propertyName].min) {
+              stackProperty.set('valueAttributes.minimum', configs[key].property_attributes[propertyName].min);
+            }
+            if (configs[key].property_attributes[propertyName].max) {
+              stackProperty.set('valueAttributes.maximum', configs[key].property_attributes[propertyName].max);
+            }
+            if (configs[key].property_attributes[propertyName].step) {
+              stackProperty.set('valueAttributes.step', configs[key].property_attributes[propertyName].step);
             }
           }
         }

+ 1 - 0
ambari-web/app/mixins/common/serverValidator.js

@@ -144,6 +144,7 @@ App.ServerValidatorMixin = Em.Mixin.create({
     if (!data) {
       console.warn('error while loading default config values');
     }
+    this._saveRecommendedValues(data, true);
     this.set("recommendationsConfigs", Em.get(data.resources[0] , "recommendations.blueprint.configurations"));
   },
 

+ 1 - 0
ambari-web/app/views/common/configs/widgets/config_widget_view.js

@@ -82,6 +82,7 @@ App.ConfigWidgetView = Em.View.extend(App.SupportsDependentConfigs, App.WidgetPo
    */
   restoreValue: function () {
     this.set('config.value', this.get('config.defaultValue'));
+    this.sendRequestRorDependentConfigs(this.get('config'));
   },
 
   /**

+ 1 - 1
ambari-web/app/views/common/controls_view.js

@@ -67,7 +67,7 @@ App.SupportsDependentConfigs = Ember.Mixin.create({
    * and in case there was changes shows popup with info about changed configs
    */
   sendRequestRorDependentConfigs: function(config) {
-    if (App.get('supports.enhancedConfigs') && App.router.get('clusterInstallCompleted') && ['mainServiceInfoConfigsController','wizardStep7Controller'].contains(this.get('controller.name'))) {
+    if (App.get('supports.enhancedConfigs') && ['mainServiceInfoConfigsController','wizardStep7Controller'].contains(this.get('controller.name'))) {
       var name = config.get('name');
       var type = App.config.getConfigTagFromFileName(config.get('filename'));
       var p = App.StackConfigProperty.find(name + '_' + type);