瀏覽代碼

AMBARI-17879 Stack Advisor recommendation call doesn't happen after we select the host for HSI. (ababiichuk)

ababiichuk 9 年之前
父節點
當前提交
7afbe89bf2

+ 6 - 0
ambari-web/app/controllers/wizard/step7/assign_master_controller.js

@@ -390,10 +390,16 @@ App.AssignMasterOnStep7Controller = Em.Controller.extend(App.BlueprintMixin, App
       var hostComponentConfig = context.get('config.configAction.hostComponentConfig');
       var serviceConfigs = context.get('controller.stepConfigs').findProperty('serviceName', context.get('config.serviceName')).get('configs');
       var config = serviceConfigs.filterProperty('filename', hostComponentConfig.fileName).findProperty('name', hostComponentConfig.configName);
+      var oldValue = config.get('value');
       config.set('value', componentHostName);
       config.set('recommendedValue', componentHostName);
       configActionComponent.hostName = componentHostName;
       self.get('configWidgetContext.config').set('configActionComponent', configActionComponent);
+      context.get('controller').loadConfigRecommendations([{
+        "type": App.config.getConfigTagFromFileName(config.get('filename')),
+        "name": config.get('name'),
+        "old_value": oldValue
+      }])
     });
   },
 

+ 10 - 2
ambari-web/test/controllers/wizard/step7/assign_master_controller_test.js

@@ -325,7 +325,8 @@ describe('App.AssignMasterOnStep7Controller', function () {
       mock = {
         saveMasterComponentHosts: Em.K,
         loadMasterComponentHosts: Em.K,
-        setDBProperty: Em.K
+        setDBProperty: Em.K,
+        loadConfigRecommendations: Em.K
       },
       config = Em.Object.create({
         filename: 'file1',
@@ -338,6 +339,7 @@ describe('App.AssignMasterOnStep7Controller', function () {
       sinon.stub(mock, 'saveMasterComponentHosts');
       sinon.stub(mock, 'loadMasterComponentHosts');
       sinon.stub(mock, 'setDBProperty');
+      sinon.stub(mock, 'loadConfigRecommendations');
       view.reopen({
         content: Em.Object.create({
           controllerName: 'ctrl1'
@@ -371,7 +373,8 @@ describe('App.AssignMasterOnStep7Controller', function () {
                   config
                 ]
               })
-            ]
+            ],
+            loadConfigRecommendations: mock.loadConfigRecommendations
           })
         })
       });
@@ -384,6 +387,7 @@ describe('App.AssignMasterOnStep7Controller', function () {
       mock.saveMasterComponentHosts.restore();
       mock.loadMasterComponentHosts.restore();
       mock.setDBProperty.restore();
+      mock.loadConfigRecommendations.restore();
     });
 
     it("saveMasterComponentHosts should be called", function() {
@@ -405,5 +409,9 @@ describe('App.AssignMasterOnStep7Controller', function () {
       expect(config.get('value')).to.be.equal('host1');
       expect(config.get('recommendedValue')).to.be.equal('host1');
     });
+
+    it("config should be set", function() {
+      expect(mock.loadConfigRecommendations.calledOnce).to.be.true;
+    });
   });
 });