You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by sr...@apache.org on 2015/04/03 06:40:59 UTC

ambari git commit: AMBARI-10330. Recommend config-dependencies API call should be hooked up properly (ababiichuk via srimanth)

Repository: ambari
Updated Branches:
  refs/heads/trunk ff4598373 -> 105a62060


AMBARI-10330. Recommend config-dependencies API call should be hooked up properly (ababiichuk via srimanth)


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

Branch: refs/heads/trunk
Commit: 105a62060d0f41f5f66dd54cd101663bbf5d0186
Parents: ff45983
Author: Srimanth Gunturi <sg...@hortonworks.com>
Authored: Thu Apr 2 21:40:05 2015 -0700
Committer: Srimanth Gunturi <sg...@hortonworks.com>
Committed: Thu Apr 2 21:40:05 2015 -0700

----------------------------------------------------------------------
 .../configuration-mapred/mapred-site.xml        | 12 +++++++
 .../mixins/common/configs/enhanced_configs.js   | 22 ++++++++++---
 .../widgets/slider_config_widget_view.js        | 34 ++++++++++++++++++++
 .../dependent_configs_list_popup.js             | 19 ++++++-----
 .../widgets/slider_config_widget_view_test.js   |  7 ++++
 5 files changed, 80 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/105a6206/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/configuration-mapred/mapred-site.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/configuration-mapred/mapred-site.xml b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/configuration-mapred/mapred-site.xml
index bf20d6e..88b3de2 100644
--- a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/configuration-mapred/mapred-site.xml
+++ b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/configuration-mapred/mapred-site.xml
@@ -189,6 +189,10 @@
         <type>yarn-site</type>
         <name>yarn.scheduler.maximum-allocation-mb</name>
       </property>
+      <property>
+        <type>yarn-site</type>
+        <name>yarn.scheduler.minimum-allocation-mb</name>
+      </property>
     </depends-on>
   </property>
 
@@ -209,6 +213,10 @@
         <type>yarn-site</type>
         <name>yarn.scheduler.maximum-allocation-mb</name>
       </property>
+      <property>
+        <type>yarn-site</type>
+        <name>yarn.scheduler.minimum-allocation-mb</name>
+      </property>
     </depends-on>
   </property>
 
@@ -284,6 +292,10 @@
         <type>yarn-site</type>
         <name>yarn.scheduler.maximum-allocation-mb</name>
       </property>
+      <property>
+        <type>yarn-site</type>
+        <name>yarn.scheduler.minimum-allocation-mb</name>
+      </property>
     </depends-on>
   </property>
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/105a6206/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 876823b..02738c5 100644
--- a/ambari-web/app/mixins/common/configs/enhanced_configs.js
+++ b/ambari-web/app/mixins/common/configs/enhanced_configs.js
@@ -282,12 +282,10 @@ App.EnhancedConfigsMixin = Em.Mixin.create({
         services: this.get('serviceNames'),
         recommendations: recommendations
       };
-      /** TODO uncomment when be will be ready
-       if (App.get('supports.enhancedConfigs')) {
+      if (App.get('supports.enhancedConfigs')) {
         dataToSend.recommend = 'configuration-dependencies';
         dataToSend.changed_configurations = changedConfigs;
       }
-       **/
       return App.ajax.send({
         name: 'config.recommendations',
         sender: this,
@@ -345,7 +343,7 @@ App.EnhancedConfigsMixin = Em.Mixin.create({
         if (callback) {
           callback();
         }
-      }, this._discardChanges.bind(this));
+      });
     } else {
       if (callback) {
         callback();
@@ -519,6 +517,7 @@ App.EnhancedConfigsMixin = Em.Mixin.create({
             if (value != configs[key].properties[propertyName]) {
               this.get('_dependentConfigValues').pushObject({
                 saveRecommended: true,
+                saveRecommendedDefault: true,
                 fileName: key,
                 propertyName: propertyName,
                 configGroup: configGroup,
@@ -528,6 +527,21 @@ 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);
+              }
+            }
+          }
         }
       }
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/105a6206/ambari-web/app/views/common/configs/widgets/slider_config_widget_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/widgets/slider_config_widget_view.js b/ambari-web/app/views/common/configs/widgets/slider_config_widget_view.js
index cbabae8..8098337 100644
--- a/ambari-web/app/views/common/configs/widgets/slider_config_widget_view.js
+++ b/ambari-web/app/views/common/configs/widgets/slider_config_widget_view.js
@@ -36,6 +36,31 @@ App.SliderConfigWidgetView = App.ConfigWidgetView.extend({
   slider: null,
 
   /**
+   * recreate widget in case max or min values were changed
+   * @method changeBoundaries
+   */
+  changeBoundaries: function() {
+    if ($.mocho) {
+      //temp fix as it can broke test that doesn't have any connection with this method
+      return;
+    }
+    var self = this;
+    var valueAttributes = this.get('config.stackConfigProperty.valueAttributes');
+    Em.run.once(this, function() {
+      self.prepareValueAttributes();
+      if (self.get('slider')) {
+        self.get('slider').destroy();
+        self.initSlider();
+        if (self.get('config.value') > valueAttributes.get('maximum')) {
+          self.set('mirrorValue', valueAttributes.get('maximum'))
+        }
+        if (self.get('config.value') < valueAttributes.get('minimum')) {
+          self.set('mirrorValue', valueAttributes.get('minimum'))
+        }
+      }
+    })
+  },
+  /**
    * Determines if widget controls should be disabled
    * @type {boolean}
    */
@@ -94,6 +119,15 @@ App.SliderConfigWidgetView = App.ConfigWidgetView.extend({
     this.initSlider();
     this.toggleWidgetState();
     this.initPopover();
+    this.addObserver('config.stackConfigProperty.valueAttributes.minimum', this, this.changeBoundaries);
+    this.addObserver('config.stackConfigProperty.valueAttributes.maximum', this, this.changeBoundaries);
+    this.addObserver('config.stackConfigProperty.valueAttributes.step', this, this.changeBoundaries);
+  },
+
+  willDestroyElement: function() {
+    this.removeObserver('config.stackConfigProperty.valueAttributes.step', this, this.changeBoundaries);
+    this.removeObserver('config.stackConfigProperty.valueAttributes.maximum', this, this.changeBoundaries);
+    this.removeObserver('config.stackConfigProperty.valueAttributes.minimum', this, this.changeBoundaries);
   },
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/105a6206/ambari-web/app/views/common/modal_popups/dependent_configs_list_popup.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/modal_popups/dependent_configs_list_popup.js b/ambari-web/app/views/common/modal_popups/dependent_configs_list_popup.js
index ec7ea1f..4de93d5 100644
--- a/ambari-web/app/views/common/modal_popups/dependent_configs_list_popup.js
+++ b/ambari-web/app/views/common/modal_popups/dependent_configs_list_popup.js
@@ -22,15 +22,12 @@ var App = require('app');
  * Show confirmation popup
  * @param {[Object]} configs
  * @param {function} [callback=null]
- * @param {function} [secondaryCallback=null]
  * we use this parameter to defer saving configs before we make some decisions.
  * @return {App.ModalPopup}
  */
-App.showDependentConfigsPopup = function (configs, callback, secondaryCallback) {
+App.showDependentConfigsPopup = function (configs, callback) {
   return App.ModalPopup.show({
     encodeBody: false,
-    primary: Em.I18n.t('common.save'),
-    secondary: Em.I18n.t('common.discard'),
     header: Em.I18n.t('popup.dependent.configs.header'),
     classNames: ['sixty-percent-width-modal','modal-full-width'],
     configs: configs,
@@ -41,17 +38,19 @@ App.showDependentConfigsPopup = function (configs, callback, secondaryCallback)
       return App.get('router.mainServiceInfoConfigsController.stepConfigs').objectAt(0).get('configs');
     }.property('controller.stepConfigs.@each'),
     onPrimary: function () {
-      this.hide();
+      this._super();
+      configs.forEach(function(c) {
+        Em.set(c, 'saveRecommendedDefault', Em.get(c, 'saveRecommended'));
+      });
       if (callback) {
         callback();
       }
     },
     onSecondary: function() {
-      this.hide();
-      configs.setEach('saveRecommended', false);
-      if(secondaryCallback) {
-        secondaryCallback();
-      }
+      this._super();
+      configs.forEach(function(c) {
+        Em.set(c, 'saveRecommended', Em.get(c, 'saveRecommendedDefault'));
+      });
     }
   });
 };

http://git-wip-us.apache.org/repos/asf/ambari/blob/105a6206/ambari-web/test/views/common/configs/widgets/slider_config_widget_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/configs/widgets/slider_config_widget_view_test.js b/ambari-web/test/views/common/configs/widgets/slider_config_widget_view_test.js
index e9cda26..25346b2 100644
--- a/ambari-web/test/views/common/configs/widgets/slider_config_widget_view_test.js
+++ b/ambari-web/test/views/common/configs/widgets/slider_config_widget_view_test.js
@@ -73,6 +73,13 @@ describe('App.SliderConfigWidgetView', function () {
     });
     viewFloat.willInsertElement();
     viewFloat.didInsertElement();
+    sinon.stub(viewInt, 'changeBoundaries', Em.K);
+    sinon.stub(viewFloat, 'changeBoundaries', Em.K);
+  });
+
+  afterEach(function() {
+    viewInt.changeBoundaries.restore();
+    viewFloat.changeBoundaries.restore();
   });
 
   describe('#mirrorValue', function () {