Browse Source

[AMBARI-24836] Service Auto start is enabled after page refresh

Ishan Bhatt 7 years ago
parent
commit
ad3658288c

+ 11 - 6
ambari-web/app/controllers/main/admin/service_auto_start.js

@@ -116,14 +116,19 @@ App.MainAdminServiceAutoStartController = Em.Controller.extend({
   },
 
   load: function() {
-    App.router.get('configurationController').getCurrentConfigsBySites(['cluster-env']).done((data) => {
-      this.set('clusterConfigs', data[0].properties);
-      this.set('isGeneralRecoveryEnabled', data[0].properties.recovery_enabled === 'true');
-      this.set('isGeneralRecoveryEnabledCached', this.get('isGeneralRecoveryEnabled'));
-      this.loadComponentsConfigs().then(() => {
-        this.set('isLoaded', true);
+    const self = this;
+    const clusterConfigController = App.router.get('configurationController');
+    clusterConfigController.updateConfigTags().always(function () {
+      clusterConfigController.getCurrentConfigsBySites(['cluster-env']).done((data) => {
+        self.set('clusterConfigs', data[0].properties);
+        self.set('isGeneralRecoveryEnabled', data[0].properties.recovery_enabled === 'true');
+        self.set('isGeneralRecoveryEnabledCached', self.get('isGeneralRecoveryEnabled'));
+        self.loadComponentsConfigs().then(() => {
+          self.set('isLoaded', true);
+        });
       });
     });
+
   },
 
   loadComponentsConfigs: function () {

+ 4 - 0
ambari-web/test/controllers/main/admin/service_auto_start_test.js

@@ -92,6 +92,9 @@ describe('App.MainAdminServiceAutoStartController', function() {
           ]);
         }
       });
+      sinon.stub(App.router.get('configurationController'), 'updateConfigTags').returns({
+        always: Em.clb
+      });
       sinon.stub(controller, 'loadComponentsConfigs').returns({
         then: Em.clb
       });
@@ -99,6 +102,7 @@ describe('App.MainAdminServiceAutoStartController', function() {
     });
     afterEach(function() {
       App.router.get('configurationController').getCurrentConfigsBySites.restore();
+      App.router.get('configurationController').updateConfigTags.restore();
       controller.loadComponentsConfigs.restore();
     });