ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akovale...@apache.org
Subject ambari git commit: AMBARI-17594 UI: Excess services on Select Config Group popup. (akovalenko)
Date Wed, 06 Jul 2016 17:09:34 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.4 578f1563e -> 2e530e55e


AMBARI-17594 UI: Excess services on Select Config Group popup. (akovalenko)


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

Branch: refs/heads/branch-2.4
Commit: 2e530e55ef6ddecc3db70acb80d2dc584e14dd5a
Parents: 578f156
Author: Aleksandr Kovalenko <akovalenko@hortonworks.com>
Authored: Wed Jul 6 19:40:58 2016 +0300
Committer: Aleksandr Kovalenko <akovalenko@hortonworks.com>
Committed: Wed Jul 6 20:09:25 2016 +0300

----------------------------------------------------------------------
 .../mixins/common/configs/enhanced_configs.js   | 12 +++--
 .../common/configs/enhanced_configs_test.js     | 51 ++++++++++++++++++++
 2 files changed, 58 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/2e530e55/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 60bf6e1..3b7781a 100644
--- a/ambari-web/app/mixins/common/configs/enhanced_configs.js
+++ b/ambari-web/app/mixins/common/configs/enhanced_configs.js
@@ -281,13 +281,15 @@ App.EnhancedConfigsMixin = Em.Mixin.create(App.ConfigWithOverrideRecommendationP
 
   loadRecommendationsError: Em.K,
 
-  changedDependentGroup: function() {
-    var dependentServices = this.get('stepConfigs').filter(function(stepConfig) {
-      return this.get('selectedService.dependentServiceNames').contains(stepConfig.get('serviceName'));
+  changedDependentGroup: function () {
+    var dependentServices = this.get('selectedService.dependentServiceNames');
+    var installedServices = App.Service.find().mapProperty('serviceName');
+    var services = this.get('stepConfigs').filter(function (stepConfig) {
+      return installedServices.contains(stepConfig.get('serviceName')) && dependentServices.contains(stepConfig.get('serviceName'));
     }, this);
     App.showSelectGroupsPopup(this.get('selectedService.serviceName'),
-      this.get('selectedService.configGroups').findProperty('name', this.get('selectedConfigGroup.name')),
-      dependentServices, this.get('recommendations'))
+        this.get('selectedService.configGroups').findProperty('name', this.get('selectedConfigGroup.name')),
+        services, this.get('recommendations'));
   },
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/2e530e55/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 e68cb94..880f4d2 100644
--- a/ambari-web/test/mixins/common/configs/enhanced_configs_test.js
+++ b/ambari-web/test/mixins/common/configs/enhanced_configs_test.js
@@ -212,5 +212,56 @@ describe('App.EnhancedConfigsMixin', function() {
       expect(App.config.getClusterEnvConfigs.calledOnce).to.be.false;
     });
   });
+
+  describe("#changedDependentGroup", function () {
+    var mixinInstance;
+
+    beforeEach(function () {
+      mixinInstance = mixinObject.create({
+        selectedService: {
+          serviceName: 'test',
+          dependentServiceNames: ['test1', 'test2', 'test3'],
+          configGroups: [
+            {name: 'testCG'},
+            {name: 'notTestCG'}
+          ]
+        },
+        stepConfigs: [
+          Em.Object.create({serviceName: 'test1'}),
+          Em.Object.create({serviceName: 'test2'}),
+          Em.Object.create({serviceName: 'test3'}),
+          Em.Object.create({serviceName: 'test4'}),
+          Em.Object.create({serviceName: 'test5'})
+        ],
+        selectedConfigGroup: {name: 'testCG'},
+        recommendations: [1, 2, 3]
+      });
+
+      sinon.stub(App, 'showSelectGroupsPopup', Em.K);
+      sinon.stub(App.Service, 'find').returns([
+        {serviceName: 'test2'},
+        {serviceName: 'test3'},
+        {serviceName: 'test4'}
+      ]);
+    });
+
+    afterEach(function () {
+      App.showSelectGroupsPopup.restore();
+      App.Service.find.restore();
+    });
+
+    it("should call showSelectGroupsPopup with appropriate arguments", function () {
+      mixinInstance.changedDependentGroup();
+      expect(App.showSelectGroupsPopup.calledWith(
+          'test',
+          {name: 'testCG'},
+          [
+            Em.Object.create({serviceName: 'test2'}),
+            Em.Object.create({serviceName: 'test3'})
+          ],
+          [1, 2, 3]
+      )).to.be.true;
+    });
+  });
 });
 


Mime
View raw message