Browse Source

AMBARI-2481. Changing browser while enable security results in wizard not visible. (jaimin via yusaku)

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/trunk@1496715 13f79535-47bb-0310-9956-ffa450edef68
Yusaku Sako 12 years ago
parent
commit
67ebae8243

+ 12 - 6
ambari-web/app/controllers/main/admin/security/add/step3.js

@@ -268,7 +268,7 @@ App.MainAdminSecurityAddStep3Controller = Em.Controller.extend({
           globalValue = uiConfig.findProperty('name', config.foreignKey[index]).value;
           config._name = config.name.replace(_fkValue, globalValue);
         } else if (this.get('globalProperties').someProperty('name', config.foreignKey[index])) {
-            globalValue = this.get('globalProperties').findProperty('name', config.foreignKey[index]).value;
+          globalValue = this.get('globalProperties').findProperty('name', config.foreignKey[index]).value;
           config._name = config.name.replace(_fkValue, globalValue);
         }
       }, this);
@@ -354,8 +354,8 @@ App.MainAdminSecurityAddStep3Controller = Em.Controller.extend({
     var principalProperties = this.getPrincipalNames();
     principalProperties.forEach(function (_principalProperty) {
       var name = _principalProperty.name.replace('principal', 'primary');
-      var value =  _principalProperty.value.split('/')[0];
-      this.get('globalProperties').pushObject({name:name,value:value});
+      var value = _principalProperty.value.split('/')[0];
+      this.get('globalProperties').pushObject({name: name, value: value});
     }, this);
   },
 
@@ -510,9 +510,9 @@ App.MainAdminSecurityAddStep3Controller = Em.Controller.extend({
     this.get('serviceConfigTags').forEach(function (_serviceConfigTags) {
       _serviceConfigTags.newTagName = 'version' + (new Date).getTime();
       if (_serviceConfigTags.siteName === 'global') {
-        var nagiosPrincipalName = this.get('globalProperties').findProperty('name','nagios_principal_name');
-        var zkPrincipalName = this.get('globalProperties').findProperty('name','zookeeper_principal_name');
-        var realmName = this.get('globalProperties').findProperty('name','kerberos_domain');
+        var nagiosPrincipalName = this.get('globalProperties').findProperty('name', 'nagios_principal_name');
+        var zkPrincipalName = this.get('globalProperties').findProperty('name', 'zookeeper_principal_name');
+        var realmName = this.get('globalProperties').findProperty('name', 'kerberos_domain');
         nagiosPrincipalName.value = nagiosPrincipalName.value + '@' + realmName.value;
         zkPrincipalName.value = zkPrincipalName.value + '@' + realmName.value;
         this.get('globalProperties').forEach(function (_globalProperty) {
@@ -546,5 +546,11 @@ App.MainAdminSecurityAddStep3Controller = Em.Controller.extend({
       stages.pushObject(stage);
     }, this);
     App.db.setSecurityDeployStages(stages);
+    App.clusterStatus.setClusterStatus({
+      clusterName: this.get('clusterName'),
+      clusterState: 'ADD_SECURITY_STEP_3',
+      wizardControllerName: App.router.get('addSecurityController.name'),
+      localdb: App.db.data
+    });
   }.observes('stages.@each.requestId', 'stages.@each.isStarted', 'stages.@each.isCompleted')
 });

+ 6 - 0
ambari-web/app/controllers/main/admin/security/disable.js

@@ -371,6 +371,12 @@ App.MainAdminSecurityDisableController = Em.Controller.extend({
       stages.pushObject(stage);
     }, this);
     App.db.setSecurityDeployStages(stages);
+    App.clusterStatus.setClusterStatus({
+      clusterName: this.get('clusterName'),
+      clusterState: 'DISABLE_SECURITY',
+      wizardControllerName: this.get('name'),
+      localdb: App.db.data
+    });
   }.observes('stages.@each.requestId', 'stages.@each.isStarted', 'stages.@each.isCompleted')
 
 });

+ 1 - 2
ambari-web/app/routes/add_security.js

@@ -92,8 +92,7 @@ module.exports = Em.Route.extend({
               this.fitHeight();
             }
           }
-        )
-        ;
+        );
 
         App.router.transitionTo('step' + currentStep);
       } else {

+ 12 - 3
ambari-web/app/routes/main.js

@@ -653,9 +653,18 @@ module.exports = Em.Route.extend({
       enter: function (router) {
         router.set('mainAdminController.category', "security");
         var controller = router.get('mainAdminSecurityController');
-        App.clusterStatus.updateFromServer();
-        var currentClusterStatus = App.clusterStatus.get('value');
-        App.db.data = currentClusterStatus.localdb;
+        if (!App.testMode) {
+          App.clusterStatus.updateFromServer();
+          var currentClusterStatus = App.clusterStatus.get('value');
+          App.db.data = currentClusterStatus.localdb;
+          if (currentClusterStatus.localdb.AddSecurity) {
+            App.db.setSecurityDeployStages(currentClusterStatus.localdb.AddSecurity.securityDeployStages);
+            controller.setAddSecurityWizardStatus(currentClusterStatus.localdb.AddSecurity.status);
+            App.db.setServiceConfigProperties(currentClusterStatus.localdb.Installer.configProperties);
+            App.db.setWizardCurrentStep('AddSecurity', currentClusterStatus.localdb.AddSecurity.currentStep);
+          }
+          App.db.setDisableSecurityStatus(currentClusterStatus.localdb.disableSecurityStatus);
+        }
         if (!(controller.getAddSecurityWizardStatus() === 'RUNNING') && !(controller.getDisableSecurityStatus() === 'RUNNING')) {
           Em.run.next(function () {
             router.transitionTo('adminSecurity.index');