You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ja...@apache.org on 2013/06/07 23:36:41 UTC

svn commit: r1490841 - in /incubator/ambari/trunk/ambari-web/app: ./ controllers/main/admin/ controllers/main/admin/security/ controllers/main/admin/security/add/ data/ routes/ templates/main/admin/security/add/ utils/

Author: jaimin
Date: Fri Jun  7 21:36:40 2013
New Revision: 1490841

URL: http://svn.apache.org/r1490841
Log:
AMBARI-2327: Security Wizard: Handle refresh gracefully on deploy step. (jaimin)

Modified:
    incubator/ambari/trunk/ambari-web/app/config.js
    incubator/ambari/trunk/ambari-web/app/controllers/main/admin/security.js
    incubator/ambari/trunk/ambari-web/app/controllers/main/admin/security/add/step3.js
    incubator/ambari/trunk/ambari-web/app/controllers/main/admin/security/disable.js
    incubator/ambari/trunk/ambari-web/app/data/secure_configs.js
    incubator/ambari/trunk/ambari-web/app/data/secure_properties.js
    incubator/ambari/trunk/ambari-web/app/routes/add_security.js
    incubator/ambari/trunk/ambari-web/app/routes/main.js
    incubator/ambari/trunk/ambari-web/app/templates/main/admin/security/add/step3.hbs
    incubator/ambari/trunk/ambari-web/app/utils/db.js
    incubator/ambari/trunk/ambari-web/app/utils/polling.js

Modified: incubator/ambari/trunk/ambari-web/app/config.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/config.js?rev=1490841&r1=1490840&r2=1490841&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/config.js (original)
+++ incubator/ambari/trunk/ambari-web/app/config.js Fri Jun  7 21:36:40 2013
@@ -44,7 +44,7 @@ App.supports = {
   addServices: false,
   hostOverrides: false,
   mirroring: false,
-  secureCluster: false,
+  secureCluster: true,
   reassignMaster: false,
   stackUpgrade: false,
   capacitySchedulerUi: false,

Modified: incubator/ambari/trunk/ambari-web/app/controllers/main/admin/security.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/main/admin/security.js?rev=1490841&r1=1490840&r2=1490841&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/controllers/main/admin/security.js (original)
+++ incubator/ambari/trunk/ambari-web/app/controllers/main/admin/security.js Fri Jun  7 21:36:40 2013
@@ -30,6 +30,14 @@ App.MainAdminSecurityController = Em.Con
   setAddSecurityWizardStatus: function (status) {
     App.db.setSecurityWizardStatus(status);
   },
+
+  setDisableSecurityStatus: function (status) {
+    App.db.setDisableSecurityStatus(status);
+  },
+  getDisableSecurityStatus: function(status) {
+    return App.db.getDisableSecurityStatus();
+  },
+
   notifySecurityOff: false,
   notifySecurityAdd: false,
 
@@ -41,6 +49,8 @@ App.MainAdminSecurityController = Em.Con
         primary: 'OK',
         secondary: null,
         onPrimary: function () {
+          App.db.setSecurityDeployStages(undefined);
+          self.setDisableSecurityStatus("RUNNING");
           App.router.transitionTo('disableSecurity');
           this.hide();
         },
@@ -50,7 +60,7 @@ App.MainAdminSecurityController = Em.Con
       });
     }
   },
-  //
+
   /**
    * return true if security status is loaded and false otherwise
    */

Modified: incubator/ambari/trunk/ambari-web/app/controllers/main/admin/security/add/step3.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/main/admin/security/add/step3.js?rev=1490841&r1=1490840&r2=1490841&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/controllers/main/admin/security/add/step3.js (original)
+++ incubator/ambari/trunk/ambari-web/app/controllers/main/admin/security/add/step3.js Fri Jun  7 21:36:40 2013
@@ -43,6 +43,19 @@ App.MainAdminSecurityAddStep3Controller 
   services: [],
   serviceTimestamp: null,
 
+  isSecurityApplied: function () {
+    return this.get('stages').someProperty('stage', 'stage3') && this.get('stages').findProperty('stage', 'stage3').get('isSuccess');
+  }.property('stages.@each.isCompleted'),
+
+  isBackBtnDisabled: function () {
+    return  ((this.get('stages').someProperty('stage', 'stage3') &&
+      this.get('stages').findProperty('stage', 'stage3').get('isSuccess')) ||
+      (this.get('stages').someProperty('stage', 'stage2') &&
+        (!this.get('stages').findProperty('stage', 'stage2').get('isError')) ||
+        (this.get('stages').someProperty('stage', 'stage3') &&
+          (!this.get('stages').findProperty('stage', 'stage3').get('isError')))));
+  }.property('stages.@each.isCompleted'),
+
   clearStep: function () {
     this.get('stages').clear();
     this.set('isSubmitDisabled', true);
@@ -50,10 +63,28 @@ App.MainAdminSecurityAddStep3Controller 
   },
 
   loadStep: function () {
-    this.clearStep();
-    this.loadStages();
-    this.addInfoToStages();
+    var stages = App.db.getSecurityDeployStages();
     this.prepareSecureConfigs();
+    if (stages === undefined) {
+      this.clearStep();
+      this.loadStages();
+      this.addInfoToStages();
+    } else {
+      stages.forEach(function (_stage, index) {
+        stages[index] = App.Poll.create(_stage);
+      }, this);
+      if (stages.someProperty('isError', true)) {
+        var failedStages = stages.filterProperty('isError', true);
+        failedStages.setEach('isError', false);
+        failedStages.setEach('isStarted', false);
+        failedStages.setEach('isCompleted', false)
+      } else if (stages.filterProperty('isStarted', true).someProperty('isCompleted', false)) {
+        var runningStage = stages.filterProperty('isStarted', true).findProperty('isCompleted', false);
+        runningStage.set('isStarted', false);
+      }
+      this.get('stages').pushObjects(stages);
+    }
+
     this.moveToNextStage();
   },
 
@@ -72,15 +103,17 @@ App.MainAdminSecurityAddStep3Controller 
         name: stages.label,
         hosts: []
       });
-      var hostNames = stages.get("polledData").mapProperty('Tasks.host_name').uniq();
-      hostNames.forEach(function (name) {
-        newService.hosts.push({
-          name: name,
-          publicName: name,
-          logTasks: stages.polledData.filterProperty("Tasks.host_name", name)
+      if (stages && stages.get("polledData")) {
+        var hostNames = stages.get("polledData").mapProperty('Tasks.host_name').uniq();
+        hostNames.forEach(function (name) {
+          newService.hosts.push({
+            name: name,
+            publicName: name,
+            logTasks: stages.polledData.filterProperty("Tasks.host_name", name)
+          });
         });
-      });
-      services.push(newService);
+        services.push(newService);
+      }
     });
     this.set('serviceTimestamp', new Date().getTime());
   }.observes("stages.@each.polledData"),
@@ -102,8 +135,9 @@ App.MainAdminSecurityAddStep3Controller 
       } else if (currentStage && currentStage.get('stage') === 'stage3') {
         if (App.testMode) {
           currentStage.set('isSuccess', true);
+          App.router.get('mainAdminSecurityController').setAddSecurityWizardStatus(null);
         } else {
-          this.loadClusterConfigs();
+          this.loadClusterConfigs()
         }
       }
     }
@@ -120,7 +154,8 @@ App.MainAdminSecurityAddStep3Controller 
   }.observes('stages.@each.isCompleted'),
 
   moveToNextStage: function () {
-    var nextStage = this.get('stages').findProperty('isStarted', false);
+    var leftStages = this.get('stages').filterProperty('isStarted', false);
+    var nextStage = leftStages.findProperty('isCompleted', false);
     if (nextStage) {
       nextStage.set('isStarted', true);
     }
@@ -168,16 +203,6 @@ App.MainAdminSecurityAddStep3Controller 
         "filename": _config.filename
       });
     }, this);
-    var dependentConfig = this.get('configMapping').filterProperty('foreignKey');
-    dependentConfig.forEach(function (_config) {
-      this.setConfigValue(uiConfig, _config);
-      uiConfig.pushObject({
-        "id": "site property",
-        "name": _config.name,
-        "value": _config.value,
-        "filename": _config.filename
-      });
-    }, this);
     return uiConfig;
   },
 
@@ -241,63 +266,6 @@ App.MainAdminSecurityAddStep3Controller 
     }, this);
     return value;
   },
-  /**
-   * Set all site property that are derived from other site-properties
-   */
-  setConfigValue: function (uiConfig, config) {
-    if (config.value == null) {
-      return;
-    }
-    var fkValue = config.value.match(/<(foreignKey.*?)>/g);
-    if (fkValue) {
-      fkValue.forEach(function (_fkValue) {
-        var index = parseInt(_fkValue.match(/\[([\d]*)(?=\])/)[1]);
-        if (uiConfig.someProperty('name', config.foreignKey[index])) {
-          var globalValue = uiConfig.findProperty('name', config.foreignKey[index]).value;
-          config.value = config.value.replace(_fkValue, globalValue);
-        } else if (this.get('content.serviceConfigProperties').someProperty('name', config.foreignKey[index])) {
-          var globalValue;
-          if (this.get('content.serviceConfigProperties').findProperty('name', config.foreignKey[index]).value === '') {
-            globalValue = this.get('content.serviceConfigProperties').findProperty('name', config.foreignKey[index]).defaultValue;
-          } else {
-            globalValue = this.get('content.serviceConfigProperties').findProperty('name', config.foreignKey[index]).value;
-          }
-          config.value = config.value.replace(_fkValue, globalValue);
-        }
-      }, this);
-    }
-    if (fkValue = config.name.match(/<(foreignKey.*?)>/g)) {
-      fkValue.forEach(function (_fkValue) {
-        var index = parseInt(_fkValue.match(/\[([\d]*)(?=\])/)[1]);
-        if (uiConfig.someProperty('name', config.foreignKey[index])) {
-          var globalValue = uiConfig.findProperty('name', config.foreignKey[index]).value;
-          config.name = config.name.replace(_fkValue, globalValue);
-        } else if (this.get('content.serviceConfigProperties').someProperty('name', config.foreignKey[index])) {
-          var globalValue;
-          if (this.get('content.serviceConfigProperties').findProperty('name', config.foreignKey[index]).value === '') {
-            globalValue = this.get('content.serviceConfigProperties').findProperty('name', config.foreignKey[index]).defaultValue;
-          } else {
-            globalValue = this.get('content.serviceConfigProperties').findProperty('name', config.foreignKey[index]).value;
-          }
-          config.name = config.name.replace(_fkValue, globalValue);
-        }
-      }, this);
-    }
-    //For properties in the configMapping file having foreignKey and templateName properties.
-
-    var templateValue = config.value.match(/<(templateName.*?)>/g);
-    if (templateValue) {
-      templateValue.forEach(function (_value) {
-        var index = parseInt(_value.match(/\[([\d]*)(?=\])/)[1]);
-        if (this.get('globalProperties').someProperty('name', config.templateName[index])) {
-          var globValue = this.appendInstanceName(config.templateName[index]);
-          config.value = config.value.replace(_value, globValue);
-        } else {
-          config.value = null;
-        }
-      }, this);
-    }
-  },
 
   prepareSecureConfigs: function () {
     this.loadGlobals();
@@ -322,7 +290,6 @@ App.MainAdminSecurityAddStep3Controller 
   },
 
   loadUsersFromServer: function () {
-    var self = this;
     if (App.testMode) {
       var serviceUsers = this.get('serviceUsers');
       serviceUsers.pushObject({id: 'puppet var', name: 'hdfs_user', value: 'hdfs'});
@@ -410,6 +377,8 @@ App.MainAdminSecurityAddStep3Controller 
   applyConfigurationToClusterSuccessCallback: function (data) {
     this.set('noOfWaitingAjaxCalls', this.get('noOfWaitingAjaxCalls') - 1);
     if (this.get('noOfWaitingAjaxCalls') == 0) {
+      App.router.get('mainAdminSecurityController').setAddSecurityWizardStatus(null);
+      App.router.get('addSecurityController').setCurrentStep(1);
       var currentStage = this.get('stages').findProperty('stage', 'stage3');
       currentStage.set('isSuccess', true);
     }
@@ -471,6 +440,25 @@ App.MainAdminSecurityAddStep3Controller 
         }, this);
       }
     }, this);
-  }
+  },
+
+  saveStages: function () {
+    var stages = [];
+    this.get('stages').forEach(function (_stage) {
+      var stage = {
+        stage: _stage.get('stage'),
+        label: _stage.get('label'),
+        isPolling: _stage.get('isPolling'),
+        isStarted: _stage.get('isStarted'),
+        requestId: _stage.get('requestId'),
+        isSuccess: _stage.get('isSuccess'),
+        isError: _stage.get('isError'),
+        url: _stage.get('url'),
+        data: _stage.get('data')
+      };
+      stages.pushObject(stage);
+    }, this);
+    App.db.setSecurityDeployStages(stages);
+  }.observes('stages.@each.requestId','stages.@each.isStarted','stages.@each.isCompleted')
 
 });

Modified: incubator/ambari/trunk/ambari-web/app/controllers/main/admin/security/disable.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/main/admin/security/disable.js?rev=1490841&r1=1490840&r2=1490841&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/controllers/main/admin/security/disable.js (original)
+++ incubator/ambari/trunk/ambari-web/app/controllers/main/admin/security/disable.js Fri Jun  7 21:36:40 2013
@@ -41,11 +41,28 @@ App.MainAdminSecurityDisableController =
   },
 
   loadStep: function () {
-    this.clearStep();
-    this.loadStages();
-    this.loadSecureServices();
-    this.addInfoToStages();
-    this.moveToNextStage();
+    var stages = App.db.getSecurityDeployStages();
+    if (stages === undefined) {
+      this.clearStep();
+      this.loadStages();
+      this.addInfoToStages();
+    } else {
+      stages.forEach(function(_stage,index){
+        stages[index] = App.Poll.create(_stage);
+      },this);
+      if (stages.someProperty('isError', true)) {
+        var failedStages = stages.filterProperty('isError', true);
+        failedStages.setEach('isError', false);
+        failedStages.setEach('isStarted', false);
+        failedStages.setEach('isCompleted', false);
+      } else if (stages.filterProperty('isStarted', true).someProperty('isCompleted', false)) {
+        var runningStage = stages.filterProperty('isStarted', true).findProperty('isCompleted', false);
+        runningStage.set('isStarted', false);
+      }
+      this.get('stages').pushObjects(stages);
+    }
+   this.loadSecureServices();
+   this.moveToNextStage();
   },
 
 
@@ -266,6 +283,7 @@ App.MainAdminSecurityDisableController =
   applyConfigurationToClusterSuccessCallback: function (data) {
     this.set('noOfWaitingAjaxCalls', this.get('noOfWaitingAjaxCalls') - 1);
     if (this.get('noOfWaitingAjaxCalls') == 0) {
+      App.router.get('mainAdminSecurityController').setDisableSecurityStatus(undefined);
       var currentStage = this.get('stages').findProperty('stage', 'stage3');
       currentStage.set('isSuccess', true);
     }
@@ -320,5 +338,25 @@ App.MainAdminSecurityDisableController =
         }, this);
       }
     }, this);
-  }
+  },
+
+  saveStages: function() {
+    var stages = [];
+    this.get('stages').forEach(function(_stage){
+      var stage = {
+        stage: _stage.get('stage'),
+        label: _stage.get('label'),
+        isPolling: _stage.get('isPolling'),
+        isStarted: _stage.get('isStarted'),
+        requestId: _stage.get('requestId'),
+        isSuccess: _stage.get('isSuccess'),
+        isError: _stage.get('isError'),
+        url: _stage.get('url'),
+        data: _stage.get('data')
+      };
+      stages.pushObject(stage);
+    },this);
+    App.db.setSecurityDeployStages(stages);
+  }.observes('stages.@each.requestId','stages.@each.isStarted','stages.@each.isCompleted')
+
 });

Modified: incubator/ambari/trunk/ambari-web/app/data/secure_configs.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/data/secure_configs.js?rev=1490841&r1=1490840&r2=1490841&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/data/secure_configs.js (original)
+++ incubator/ambari/trunk/ambari-web/app/data/secure_configs.js Fri Jun  7 21:36:40 2013
@@ -16,10 +16,10 @@
  * limitations under the License.
  */
 var App = require('app');
+require('models/service_config');
 App.SecureConfigProperties = Ember.ArrayProxy.extend({
   content: require('data/secure_properties').configProperties
 });
-require('models/service_config');
 
 var configProperties = App.SecureConfigProperties.create();
 
@@ -27,10 +27,10 @@ module.exports = [
   {
     serviceName: 'GENERAL',
     displayName: 'Kerberos',
-    filename: 'hdfs-site',
     configCategories: [
       App.ServiceConfigCategory.create({ name: 'KERBEROS', displayName: 'General'})
     ],
+    sites: ['global'],
     configs: configProperties.filterProperty('serviceName', 'GENERAL')
   },
   {

Modified: incubator/ambari/trunk/ambari-web/app/data/secure_properties.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/data/secure_properties.js?rev=1490841&r1=1490840&r2=1490841&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/data/secure_properties.js (original)
+++ incubator/ambari/trunk/ambari-web/app/data/secure_properties.js Fri Jun  7 21:36:40 2013
@@ -23,7 +23,7 @@ module.exports =
       "name": "security_enabled",
       "displayName": "Enable security",
       "value": "",
-      "defaultValue":"true",
+      "defaultValue": 'true',
       "description": "Enable kerberos security for the cluster",
       "isVisible": false,
       "isOverridable": false,

Modified: incubator/ambari/trunk/ambari-web/app/routes/add_security.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/routes/add_security.js?rev=1490841&r1=1490840&r2=1490841&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/routes/add_security.js (original)
+++ incubator/ambari/trunk/ambari-web/app/routes/add_security.js Fri Jun  7 21:36:40 2013
@@ -23,8 +23,7 @@ module.exports = Em.Route.extend({
     console.log('in /security/add:enter');
 
     Ember.run.next(function () {
-      if (!router.get('mainAdminController.securityEnabled')) {
-        router.get('mainAdminSecurityController').setAddSecurityWizardStatus('RUNNING');
+      if (router.get('mainAdminSecurityController').getAddSecurityWizardStatus() === 'RUNNING') {
         var mainAdminSecurityController = router.get('mainAdminSecurityController');
         var addSecurityController = router.get('addSecurityController');
         var currentStep = router.get('addSecurityController').get('currentStep');
@@ -49,6 +48,7 @@ module.exports = Em.Route.extend({
               this.hide();
               App.router.get('updateController').set('isWorking', true);
               mainAdminSecurityController.setAddSecurityWizardStatus(null);
+              App.db.setSecurityDeployStages(undefined);
               router.get('addSecurityController').setCurrentStep(1);
               router.get('addSecurityController.content').saveCurrentStage(2);
               router.transitionTo('adminSecurity.index');
@@ -101,6 +101,7 @@ module.exports = Em.Route.extend({
       var addSecurityStep2Controller = router.get('mainAdminSecurityAddStep2Controller');
       addSecurityController.saveServiceConfigProperties(addSecurityStep2Controller);
       addSecurityController.get('content').saveCurrentStage('2');
+      App.db.setSecurityDeployStages(undefined);
       router.transitionTo('step3');
     }
   }),
@@ -122,7 +123,7 @@ module.exports = Em.Route.extend({
     },
     back: function (router, context) {
       var controller = router.get('mainAdminSecurityAddStep3Controller');
-      if (!controller.get('isSubmitDisabled')) {
+      if (!controller.get('isBackBtnDisabled')) {
         router.transitionTo('step2');
       }
     },

Modified: incubator/ambari/trunk/ambari-web/app/routes/main.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/routes/main.js?rev=1490841&r1=1490840&r2=1490841&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/routes/main.js (original)
+++ incubator/ambari/trunk/ambari-web/app/routes/main.js Fri Jun  7 21:36:40 2013
@@ -128,7 +128,7 @@ module.exports = Em.Route.extend({
       }
     }),
 
-    gotoMirroringHome : function(router){
+    gotoMirroringHome: function (router) {
       router.transitionTo('mirroring/index');
     },
     addNewDataset: function (router) {
@@ -653,14 +653,18 @@ module.exports = Em.Route.extend({
       enter: function (router) {
         router.set('mainAdminController.category', "security");
         var controller = router.get('mainAdminSecurityController');
-        if (!(controller.getAddSecurityWizardStatus() === 'RUNNING')) {
+        if (!(controller.getAddSecurityWizardStatus() === 'RUNNING') && !(controller.getDisableSecurityStatus() === 'RUNNING')) {
           Em.run.next(function () {
             router.transitionTo('adminSecurity.index');
           });
-        } else {
+        } else if (controller.getAddSecurityWizardStatus() === 'RUNNING') {
           Em.run.next(function () {
             router.transitionTo('adminAddSecurity');
           });
+        } else if (controller.getDisableSecurityStatus() === 'RUNNING') {
+          Em.run.next(function () {
+            router.transitionTo('disableSecurity');
+          });
         }
       },
 
@@ -674,12 +678,14 @@ module.exports = Em.Route.extend({
       }),
 
       addSecurity: function (router, object) {
+        router.get('mainAdminSecurityController').setAddSecurityWizardStatus('RUNNING');
         router.transitionTo('adminAddSecurity');
       },
 
       disableSecurity: Ember.Route.extend({
-        route: '/',
+        route: '/disableSecurity',
         enter: function (router) {
+          if (router.get('mainAdminSecurityController').getAddSecurityWizardStatus() === 'RUNNING') {
           Ember.run.next(function () {
             App.router.get('updateController').set('isWorking', false);
             App.ModalPopup.show({
@@ -697,6 +703,8 @@ module.exports = Em.Route.extend({
                 App.router.get('updateController').set('isWorking', true);
               },
               onClose: function () {
+                App.db.setSecurityDeployStages(undefined);
+                router.get('mainAdminSecurityController').setDisableSecurityStatus(undefined);
                 if (router.get('mainAdminSecurityDisableController.isSubmitDisabled') === false) {
                   this.hide();
                   App.router.get('updateController').set('isWorking', true);
@@ -708,6 +716,9 @@ module.exports = Em.Route.extend({
               }
             });
           });
+          } else {
+            router.transitionTo('adminSecurity.index');
+          }
         },
 
         unroutePath: function () {
@@ -763,7 +774,7 @@ module.exports = Em.Route.extend({
       router.transitionTo('admin' + object.context.capitalize());
     },
 
-    //events
+//events
     goToAdmin: function (router, event) {
       router.transitionTo(event.context);
     }
@@ -787,16 +798,16 @@ module.exports = Em.Route.extend({
     index: Ember.Route.extend({
       route: '/',
       enter: function (router) {
-        Ember.run.next(function(){
-        var controller = router.get('mainController');
-        controller.dataLoading().done(function () {
-          var service = router.get('mainServiceItemController.content');
-          if (!service) {
-            service = App.Service.find().objectAt(0); // getting the first service to display
-          }
-          router.transitionTo('service.summary', service);
+        Ember.run.next(function () {
+          var controller = router.get('mainController');
+          controller.dataLoading().done(function () {
+            var service = router.get('mainServiceItemController.content');
+            if (!service) {
+              service = App.Service.find().objectAt(0); // getting the first service to display
+            }
+            router.transitionTo('service.summary', service);
+          });
         });
-      });
       }
     }),
     connectOutlets: function (router, context) {

Modified: incubator/ambari/trunk/ambari-web/app/templates/main/admin/security/add/step3.hbs
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/templates/main/admin/security/add/step3.hbs?rev=1490841&r1=1490840&r2=1490841&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/templates/main/admin/security/add/step3.hbs (original)
+++ incubator/ambari/trunk/ambari-web/app/templates/main/admin/security/add/step3.hbs Fri Jun  7 21:36:40 2013
@@ -24,7 +24,7 @@
 {{view App.MainServiceReconfigureView}}
 
 <div class="btn-area">
-  <a class="btn" {{bindAttr disabled="isSubmitDisabled"}}
+  <a class="btn" {{bindAttr disabled="isBackBtnDisabled"}}
     {{action back}}>&larr; {{t common.back}}</a>
   <a class="btn btn-success pull-right" {{bindAttr disabled="isSubmitDisabled"}}
     {{action done}}>{{t common.done}} </a>

Modified: incubator/ambari/trunk/ambari-web/app/utils/db.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/utils/db.js?rev=1490841&r1=1490840&r2=1490841&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/utils/db.js (original)
+++ incubator/ambari/trunk/ambari-web/app/utils/db.js Fri Jun  7 21:36:40 2013
@@ -304,12 +304,27 @@ App.db.setSecurityWizardStatus = functio
   localStorage.setObject('ambari', App.db.data);
 };
 
+App.db.setDisableSecurityStatus = function (status) {
+  App.db.data = localStorage.getObject('ambari');
+  App.db.data.disableSecurityStatus = status;
+  localStorage.setObject('ambari', App.db.data);
+};
+
 App.db.setSecurityStage = function (securityStage) {
   App.db.data = localStorage.getObject('ambari');
   App.db.data.AddSecurity.securityStage = securityStage;
   localStorage.setObject('ambari', App.db.data);
 };
 
+App.db.setSecurityDeployStages = function (securityStages) {
+  App.db.data = localStorage.getObject('ambari');
+  if (!App.db.data.AddSecurity) {
+    App.db.data.AddSecurity = {};
+  }
+  App.db.data.AddSecurity.securityDeployStages = securityStages;
+  localStorage.setObject('ambari', App.db.data);
+};
+
 
 /*
  *  getter methods
@@ -486,7 +501,7 @@ App.db.getUpgradeOptions = function () {
   console.log('TRACE: Entering db:getUpgradeOptions function');
   App.db.data = localStorage.getObject('ambari');
   return App.db.data.StackUpgrade.upgradeOptions;
-}
+};
 
 App.db.getSecurityWizardStatus = function () {
   App.db.data = localStorage.getObject('ambari');
@@ -496,10 +511,19 @@ App.db.getSecurityWizardStatus = functio
   return App.db.data.AddSecurity.status;
 };
 
+App.db.getDisableSecurityStatus = function () {
+  App.db.data = localStorage.getObject('ambari');
+  return App.db.data.disableSecurityStatus;
+};
+
 App.db.getSecurityStage = function () {
   App.db.data = localStorage.getObject('ambari');
   return App.db.data.AddSecurity.securityStage;
+};
 
+App.db.getSecurityDeployStages = function () {
+  App.db.data = localStorage.getObject('ambari');
+  return App.db.data.AddSecurity.securityDeployStages;
 };
 
 App.db.getStacks = function () {

Modified: incubator/ambari/trunk/ambari-web/app/utils/polling.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/utils/polling.js?rev=1490841&r1=1490840&r2=1490841&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/utils/polling.js (original)
+++ incubator/ambari/trunk/ambari-web/app/utils/polling.js Fri Jun  7 21:36:40 2013
@@ -23,7 +23,7 @@ App.Poll = Em.Object.extend({
   isStarted: false,
   isPolling: true,
   clusterName: null,
-  requestId: null,
+  requestId: undefined,
   temp: false,
   progress: 0,
   url: null,
@@ -46,19 +46,22 @@ App.Poll = Em.Object.extend({
   }.property('isError', 'isSuccess'),
 
   start: function () {
-    if (App.testMode) {
+    if (this.get('requestId') === undefined) {
+      this.setRequestId();
+    } else {
       this.startPolling();
+    }
+  },
+
+  setRequestId: function () {
+    if (App.testMode) {
+      this.set('requestId', '1');
       return;
     }
     var self = this;
     var url = this.get('url');
-    var method;
+    var method = 'PUT';
     var data = this.get('data');
-    if (App.testMode) {
-      method = 'GET';
-    } else {
-      method = 'PUT';
-    }
 
     $.ajax({
       type: method,
@@ -126,6 +129,7 @@ App.Poll = Em.Object.extend({
         console.log("TRACE: In error function for the GET data");
         console.log("TRACE: value of the url is: " + url);
         console.log("TRACE: error code status is: " + request.status);
+        self.set('requestId', undefined);
         self.set('isError', true);
       },