浏览代码

AMBARI-12959 FE: Server overloaded with POST calls after changing config group. (atkach)

Andrii Tkach 10 年之前
父节点
当前提交
f917a88f8a

+ 1 - 3
ambari-web/app/controllers/main/service/info/configs.js

@@ -568,9 +568,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ConfigsLoader, A
       this.setVisibilityForRangerProperties(selectedService);
     }
     this._onLoadComplete();
-    this.get('configGroups').forEach(function (configGroup) {
-      this.getRecommendationsForDependencies(null, true, Em.K, configGroup);
-    }, this);
+    this.getRecommendationsForDependencies(null, true, Em.K, this.get('selectedConfigGroup'));
     App.loadTimer.finish('Service Configs Page');
   },
 

+ 18 - 3
ambari-web/app/views/common/configs/widgets/slider_config_widget_view.js

@@ -106,12 +106,27 @@ App.SliderConfigWidgetView = App.ConfigWidgetView.extend({
    * <code>config.stackConfigProperty.valueAttributes.{group.name}.maximum<code>
    * @param {String} attribute - name of attribute, for current moment
    * can be ["maximum","minimum","increment_step"] but allows to use other it there will be available
-   * @returns {*}
+   * @returns {string}
    */
   getValueAttributeByGroup: function(attribute) {
+    var parseFunction = this.get('parseFunction');
+    var configValue = this.get('config.value');
     var defaultGroupAttr = this.get('config.stackConfigProperty.valueAttributes');
-    var groupAttr = this.get('configGroup') && this.get('config.stackConfigProperty.valueAttributes')[this.get('configGroup.name')];
-    return (groupAttr && !Em.isNone(groupAttr[attribute])) ? groupAttr[attribute] : defaultGroupAttr[attribute];
+    var groupAttr = this.get('configGroup') && defaultGroupAttr[this.get('configGroup.name')];
+    var boundary = (groupAttr && !Em.isNone(groupAttr[attribute])) ? groupAttr[attribute] : defaultGroupAttr[attribute];
+
+    if (!this.get('referToSelectedGroup')) {
+      if (attribute === 'minimum') {
+        if (parseFunction(configValue) < parseFunction(boundary)) {
+          return configValue;
+        }
+      } else if (attribute === 'maximum') {
+        if (parseFunction(configValue) > parseFunction(boundary)) {
+          return configValue;
+        }
+      }
+    }
+    return boundary;
   },
   /**
    * step transformed form config units to widget units