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-14719 After enabling NN HA AMS shows critical alert. (ababiichuk)
Date Tue, 19 Jan 2016 16:47:20 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 8f6b45d5a -> 07b8a3ab2


AMBARI-14719 After enabling NN HA AMS shows critical alert. (ababiichuk)


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

Branch: refs/heads/trunk
Commit: 07b8a3ab2c8fa72a9f8d63fa5564a1f13835e26c
Parents: 8f6b45d
Author: ababiichuk <ababiichuk@hortonworks.com>
Authored: Tue Jan 19 15:54:51 2016 +0200
Committer: ababiichuk <ababiichuk@hortonworks.com>
Committed: Tue Jan 19 17:20:25 2016 +0200

----------------------------------------------------------------------
 .../configs/config_recommendation_parser.js     |  9 +++++--
 ...onfig_with_override_recommendation_parser.js |  2 +-
 .../mixins/common/configs/enhanced_configs.js   | 13 ++--------
 ambari-web/app/views/common/controls_view.js    |  7 ++---
 .../config_recommendation_parser_test.js        | 27 +++++++++++++++++++-
 5 files changed, 38 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/07b8a3ab/ambari-web/app/mixins/common/configs/config_recommendation_parser.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/common/configs/config_recommendation_parser.js b/ambari-web/app/mixins/common/configs/config_recommendation_parser.js
index b5e2f2d..826ce19 100644
--- a/ambari-web/app/mixins/common/configs/config_recommendation_parser.js
+++ b/ambari-web/app/mixins/common/configs/config_recommendation_parser.js
@@ -290,9 +290,14 @@ App.ConfigRecommendationParser = Em.Mixin.create(App.ConfigRecommendations,
{
 	 * @param parentProperties
 	 * @param name
 	 * @param fileName
+	 * @param [configGroup]
 	 * @returns {boolean}
 	 */
-	allowUpdateProperty: function (parentProperties, name, fileName) {
-		return true;
+	allowUpdateProperty: function (parentProperties, name, fileName, configGroup) {
+		try {
+			return Em.get(this.getRecommendation(name, fileName, configGroup), 'saveRecommended');
+		} catch (e) {
+			return true;
+		}
 	}
 });
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/07b8a3ab/ambari-web/app/mixins/common/configs/config_with_override_recommendation_parser.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/common/configs/config_with_override_recommendation_parser.js
b/ambari-web/app/mixins/common/configs/config_with_override_recommendation_parser.js
index 7002110..ad06cde 100644
--- a/ambari-web/app/mixins/common/configs/config_with_override_recommendation_parser.js
+++ b/ambari-web/app/mixins/common/configs/config_with_override_recommendation_parser.js
@@ -46,7 +46,7 @@ App.ConfigWithOverrideRecommendationParser = Em.Mixin.create(App.ConfigRecommend
 	 * @protected
 	 */
 	_updateOverride: function(config, recommendedValue, parentProperties, configGroup) {
-		var updateValue = this.allowUpdateProperty(parentProperties, Em.get(config, 'name'), Em.get(config,
'filename'));
+		var updateValue = this.allowUpdateProperty(parentProperties, Em.get(config, 'name'), Em.get(config,
'filename'), configGroup.get('name'));
 		var override = config.getOverride(configGroup.get('name'));
 		if (override) {
 			this._updateConfigByRecommendation(override, recommendedValue, parentProperties);

http://git-wip-us.apache.org/repos/asf/ambari/blob/07b8a3ab/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 85d157e..303b0c7 100644
--- a/ambari-web/app/mixins/common/configs/enhanced_configs.js
+++ b/ambari-web/app/mixins/common/configs/enhanced_configs.js
@@ -146,7 +146,7 @@ App.EnhancedConfigsMixin = Em.Mixin.create(App.ConfigWithOverrideRecommendationP
   /**
    * sends request to get values for dependent configs
    * @param {{type: string, name: string}[]} changedConfigs - list of changed configs to
track recommendations
-   * @param {Function} onComplete
+   * @param {Function} [onComplete]
    * @returns {$.ajax|null}
    */
   loadConfigRecommendations: function(changedConfigs, onComplete) {
@@ -379,15 +379,6 @@ App.EnhancedConfigsMixin = Em.Mixin.create(App.ConfigWithOverrideRecommendationP
    */
   removeCurrentFromDependentList: function (config, saveRecommended) {
     var recommendation = this.getRecommendation(config.get('name'), config.get('filename'),
config.get('group.name'));
-    if (recommendation) {
-      try {
-        if (this.saveRecommendation(recommendation)) {
-          this.undoRedoRecommended([recommendation], saveRecommended);
-          this.set('recommendationTimeStamp', (new Date).getTime());
-        }
-      } catch(e) {
-        console.warn(e.message);
-      }
-    }
+    if (recommendation) this.saveRecommendation(recommendation, saveRecommended);
   }
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/07b8a3ab/ambari-web/app/views/common/controls_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/controls_view.js b/ambari-web/app/views/common/controls_view.js
index 48493f0..c9281a8 100644
--- a/ambari-web/app/views/common/controls_view.js
+++ b/ambari-web/app/views/common/controls_view.js
@@ -103,6 +103,7 @@ App.SupportsDependentConfigs = Ember.Mixin.create({
       var saveRecommended = (config.get('value') === config.get('recommendedValue'));
       var type = App.config.getConfigTagFromFileName(config.get('filename'));
       var p = App.configsCollection.getConfig(App.config.configId(name, type));
+      controller.removeCurrentFromDependentList(config, saveRecommended);
        if ((p && Em.get(p, 'propertyDependedBy.length') > 0 || Em.get(p, 'displayType')
=== 'user') && config.get('oldValue') !== config.get('value')) {
          var old = config.get('oldValue');
          config.set('oldValue', config.get('value'));
@@ -110,11 +111,7 @@ App.SupportsDependentConfigs = Ember.Mixin.create({
            "type": type,
            "name": name,
            "old_value": Em.isNone(old) ? config.get('initialValue') : old
-         }], function() {
-           controller.removeCurrentFromDependentList(config, saveRecommended);
-         });
-      } else {
-        controller.removeCurrentFromDependentList(config, saveRecommended);
+         }]);
       }
     }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/07b8a3ab/ambari-web/test/mixins/common/configs/config_recommendation_parser_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mixins/common/configs/config_recommendation_parser_test.js b/ambari-web/test/mixins/common/configs/config_recommendation_parser_test.js
index e895859..35f84cd 100644
--- a/ambari-web/test/mixins/common/configs/config_recommendation_parser_test.js
+++ b/ambari-web/test/mixins/common/configs/config_recommendation_parser_test.js
@@ -71,6 +71,7 @@ describe('App.ConfigRecommendationParser', function() {
         sinon.stub(App.configsCollection, 'getConfigByName', function(name, fileName) {
           return { name: name, filename: fileName };
         });
+        sinon.stub(instanceObject, 'allowUpdateProperty').returns(true);
 
         sinon.spy(instanceObject, 'updateCallback');
         sinon.spy(instanceObject, 'removeCallback');
@@ -83,6 +84,7 @@ describe('App.ConfigRecommendationParser', function() {
       afterEach(function() {
         App.configsCollection.getConfigByName.restore();
 
+        instanceObject.allowUpdateProperty.restore();
         instanceObject.updateCallback.restore();
         instanceObject.removeCallback.restore();
         instanceObject.updateBoundariesCallback.restore();
@@ -449,9 +451,32 @@ describe('App.ConfigRecommendationParser', function() {
   });
 
   describe('#allowUpdateProperty', function() {
+
+
+
+    var cases = [{
+      saveRecommended: true
+    },{
+      saveRecommended: false
+    }];
+
+    cases.forEach(function(c) {
+      describe('allowUpdateProperty based on saveRecommended:' + c.saveRecommended, function()
{
+        beforeEach(function() {
+          sinon.stub(instanceObject, 'getRecommendation').returns({saveRecommended: c.saveRecommended});
+        });
+        afterEach(function() {
+          instanceObject.getRecommendation.restore();
+        });
+        it('default value for allowUpdateProperty is true', function() {
+          expect(instanceObject.allowUpdateProperty()).to.equal(c.saveRecommended);
+        });
+      });
+    });
+
     it('default value for allowUpdateProperty is true', function() {
       expect(instanceObject.allowUpdateProperty()).to.be.true;
-    })
+    });
   });
 });
 


Mime
View raw message