You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ab...@apache.org on 2017/01/05 15:36:30 UTC

ambari git commit: AMBARI-19387 When deleting services UI shows a lot of configs to be changing but none changes. (ababiichuk)

Repository: ambari
Updated Branches:
  refs/heads/trunk bca0346b9 -> c76d6a1ec


AMBARI-19387 When deleting services UI shows a lot of configs to be changing but none changes. (ababiichuk)


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

Branch: refs/heads/trunk
Commit: c76d6a1ec9306064e900687ec32ab926c89cd88a
Parents: bca0346
Author: ababiichuk <ab...@hortonworks.com>
Authored: Thu Jan 5 16:54:01 2017 +0200
Committer: ababiichuk <ab...@hortonworks.com>
Committed: Thu Jan 5 16:54:01 2017 +0200

----------------------------------------------------------------------
 .../controllers/main/service/info/configs.js    |  6 ++----
 ambari-web/app/controllers/main/service/item.js | 10 ++++++++-
 .../mixins/common/configs/enhanced_configs.js   |  5 +++++
 .../main/service/info/config_test.js            | 15 +++++++------
 .../common/configs/enhanced_configs_test.js     | 22 ++++++++++++++++++++
 5 files changed, 47 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/c76d6a1e/ambari-web/app/controllers/main/service/info/configs.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/info/configs.js b/ambari-web/app/controllers/main/service/info/configs.js
index b5538e0..60a0e02 100644
--- a/ambari-web/app/controllers/main/service/info/configs.js
+++ b/ambari-web/app/controllers/main/service/info/configs.js
@@ -239,8 +239,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.AddSecurityConfi
     App.set('componentToBeDeleted', {});
     this.clearLoadInfo();
     this.clearSaveInfo();
-    this.clearRecommendationsInfo();
-    this.clearAllRecommendations();
+    this.clearRecommendations();
     this.setProperties({
       saveInProgress: false,
       isInit: true,
@@ -627,8 +626,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.AddSecurityConfi
    */
   doCancel: function () {
     this.set('preSelectedConfigVersion', null);
-    this.clearAllRecommendations();
-    this.clearRecommendationsInfo();
+    this.clearRecommendations();
     this.loadSelectedVersion(this.get('selectedVersion'), this.get('selectedConfigGroup'));
   },
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/c76d6a1e/ambari-web/app/controllers/main/service/item.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/item.js b/ambari-web/app/controllers/main/service/item.js
index 8921e22..9c4b5b7 100644
--- a/ambari-web/app/controllers/main/service/item.js
+++ b/ambari-web/app/controllers/main/service/item.js
@@ -1323,7 +1323,7 @@ App.MainServiceItemController = Em.Controller.extend(App.SupportClientConfigsDow
       popupPrimary = Em.I18n.t('common.delete'),
       warningMessage = Em.I18n.t('services.service.delete.popup.warning').format(displayName) +
         (interDependentServices.length ? Em.I18n.t('services.service.delete.popup.warning.dependent').format(dependentServicesToDeleteFmt) : '');
-    this.clearRecommendationsInfo();
+    this.clearRecommendations();
     this.setProperties({
       isRecommendationInProgress: true,
       selectedConfigGroup: Em.Object.create({
@@ -1349,6 +1349,14 @@ App.MainServiceItemController = Em.Controller.extend(App.SupportClientConfigsDow
       onPrimary: function () {
         self.confirmDeleteService(serviceName, interDependentServices, dependentServicesToDeleteFmt);
         this._super();
+      },
+      onSecondary: function () {
+        self.clearRecommendations();
+        this._super();
+      },
+      onClose: function () {
+        self.clearRecommendations();
+        this._super();
       }
     });
   },

http://git-wip-us.apache.org/repos/asf/ambari/blob/c76d6a1e/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 f92aac1..507dc6a 100644
--- a/ambari-web/app/mixins/common/configs/enhanced_configs.js
+++ b/ambari-web/app/mixins/common/configs/enhanced_configs.js
@@ -178,6 +178,11 @@ App.EnhancedConfigsMixin = Em.Mixin.create(App.ConfigWithOverrideRecommendationP
     this.set('recommendationsConfigs', null);
   },
 
+  clearRecommendations: function () {
+    this.clearRecommendationsInfo();
+    this.clearAllRecommendations();
+  },
+
   /**
    * sends request to get values for dependent configs
    * @param {{type: string, name: string}[]} changedConfigs - list of changed configs to track recommendations

http://git-wip-us.apache.org/repos/asf/ambari/blob/c76d6a1e/ambari-web/test/controllers/main/service/info/config_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/info/config_test.js b/ambari-web/test/controllers/main/service/info/config_test.js
index a06ff8a..ce98c0c 100644
--- a/ambari-web/test/controllers/main/service/info/config_test.js
+++ b/ambari-web/test/controllers/main/service/info/config_test.js
@@ -529,20 +529,23 @@ describe("App.MainServiceInfoConfigsController", function () {
     beforeEach(function () {
       sinon.stub(Em.run, 'once', Em.K);
       sinon.stub(mainServiceInfoConfigsController, 'loadSelectedVersion');
-      sinon.stub(mainServiceInfoConfigsController, 'clearRecommendationsInfo');
+      sinon.spy(mainServiceInfoConfigsController, 'clearRecommendations');
+      mainServiceInfoConfigsController.set('groupsToSave', { HDFS: 'my cool group'});
+      mainServiceInfoConfigsController.set('recommendations', Em.A([{name: 'prop_1'}]));
+      mainServiceInfoConfigsController.doCancel();
     });
     afterEach(function () {
       Em.run.once.restore();
       mainServiceInfoConfigsController.loadSelectedVersion.restore();
-      mainServiceInfoConfigsController.clearRecommendationsInfo.restore();
+      mainServiceInfoConfigsController.clearRecommendations.restore();
+    });
+
+    it("should launch recommendations cleanup", function() {
+      expect(mainServiceInfoConfigsController.clearRecommendations.calledOnce).to.be.true;
     });
 
     it("should clear dependent configs", function() {
-      mainServiceInfoConfigsController.set('groupsToSave', { HDFS: 'my cool group'});
-      mainServiceInfoConfigsController.set('recommendations', Em.A([{name: 'prop_1'}]));
-      mainServiceInfoConfigsController.doCancel();
       expect(App.isEmptyObject(mainServiceInfoConfigsController.get('recommendations'))).to.be.true;
-      expect(mainServiceInfoConfigsController.clearRecommendationsInfo.calledOnce).to.be.true;
     });
   });
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/c76d6a1e/ambari-web/test/mixins/common/configs/enhanced_configs_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mixins/common/configs/enhanced_configs_test.js b/ambari-web/test/mixins/common/configs/enhanced_configs_test.js
index a9c9770..0955a8f 100644
--- a/ambari-web/test/mixins/common/configs/enhanced_configs_test.js
+++ b/ambari-web/test/mixins/common/configs/enhanced_configs_test.js
@@ -494,6 +494,28 @@ describe('App.EnhancedConfigsMixin', function () {
     });
   });
 
+  describe('#clearRecommendations()', function () {
+
+    beforeEach(function () {
+      sinon.stub(mixin, 'clearRecommendationsInfo');
+      sinon.stub(mixin, 'clearAllRecommendations');
+      mixin.clearRecommendations();
+    });
+
+    afterEach(function () {
+      mixin.clearRecommendationsInfo.restore();
+      mixin.clearAllRecommendations.restore();
+    });
+
+    it('clearRecommendationsInfo should be called', function() {
+      expect(mixin.get('clearRecommendationsInfo').calledOnce).to.be.true;
+    });
+
+    it('clearAllRecommendations should be called', function() {
+      expect(mixin.get('clearAllRecommendations').calledOnce).to.be.true;
+    });
+  });
+
   describe("#loadConfigRecommendations()", function () {
     var mock = {
       onComplete: Em.K