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/14 03:27:09 UTC

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

Author: jaimin
Date: Fri Jun 14 01:27:08 2013
New Revision: 1492923

URL: http://svn.apache.org/r1492923
Log:
AMBARI-2382: Security Wizard: user should be shown a proper pop-up when an attempt to quit wizard is made on different stages.

Modified:
    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/messages.js
    incubator/ambari/trunk/ambari-web/app/router.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/step2.hbs

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=1492923&r1=1492922&r2=1492923&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 14 01:27:08 2013
@@ -44,19 +44,11 @@ App.MainAdminSecurityController = Em.Con
   notifySecurityOffPopup: function () {
     var self = this;
     if (!this.get('isSubmitDisabled')) {
-      App.ModalPopup.show({
-        header: Em.I18n.t('admin.security.disable.popup.header'),
-        secondary: null,
-        onPrimary: function () {
-          App.db.setSecurityDeployStages(undefined);
-          self.setDisableSecurityStatus("RUNNING");
-          App.router.transitionTo('disableSecurity');
-          this.hide();
-        },
-        bodyClass: Ember.View.extend({
-          template: Ember.Handlebars.compile('<h5>{{t admin.security.disable.popup.body}}</h5>')
-        })
-      });
+      App.showConfirmationPopup(function () {
+        App.db.setSecurityDeployStages(undefined);
+        self.setDisableSecurityStatus("RUNNING");
+        App.router.transitionTo('disableSecurity');
+      }, Em.I18n.t('admin.security.disable.popup.body'));
     }
   },
 

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=1492923&r1=1492922&r2=1492923&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 14 01:27:08 2013
@@ -78,7 +78,6 @@ App.MainAdminSecurityAddStep3Controller 
         runningStage.set('isStarted', false);
       }
       this.get('stages').pushObjects(stages);
-      this.updateServices();
     }
 
     this.moveToNextStage();

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=1492923&r1=1492922&r2=1492923&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 14 01:27:08 2013
@@ -60,7 +60,6 @@ App.MainAdminSecurityDisableController =
         runningStage.set('isStarted', false);
       }
       this.get('stages').pushObjects(stages);
-      this.updateServices();
     }
     this.loadSecureServices();
     this.moveToNextStage();
@@ -199,11 +198,10 @@ App.MainAdminSecurityDisableController =
   },
 
   loadClusterConfigsSuccessCallback: function (jsonData) {
-    var self = this;
     //prepare tags to fetch all configuration for a service
     this.get('secureServices').forEach(function (_secureService) {
-      self.setServiceTagNames(_secureService, jsonData.Clusters.desired_configs);
-    });
+      this.setServiceTagNames(_secureService, jsonData.Clusters.desired_configs);
+    },this);
     this.getAllConfigurations();
   },
 
@@ -253,12 +251,12 @@ App.MainAdminSecurityDisableController =
   loadSecureServices: function () {
     var secureServices = require('data/secure_configs');
     var installedServices = App.Service.find().mapProperty('serviceName');
-    this.get('secureServices').push(secureServices.findProperty('serviceName', 'GENERAL'));
+    this.get('secureServices').pushObject(secureServices.findProperty('serviceName', 'GENERAL'));
     //General (only non service tab) tab is always displayed
     installedServices.forEach(function (_service) {
       var secureService = secureServices.findProperty('serviceName', _service);
       if (secureService) {
-        this.get('secureServices').push(secureService);
+        this.get('secureServices').pushObject(secureService);
       }
     }, this);
   },

Modified: incubator/ambari/trunk/ambari-web/app/messages.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/messages.js?rev=1492923&r1=1492922&r2=1492923&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/messages.js (original)
+++ incubator/ambari/trunk/ambari-web/app/messages.js Fri Jun 14 01:27:08 2013
@@ -610,12 +610,15 @@ Em.I18n.translations = {
   'admin.addSecurity.apply.stage4': '3. Start Services',
   'admin.addSecurity.apply.stage5': '5. Smoke Test',
   'admin.addSecurity.enable.onClose': 'You are in the process of enabling security on your cluster. ' +
-    'Are you sure you want to navigate away? If you navigate away, ' +
+    'Are you sure you want to quit? If you quit, ' +
     'you may have to re-run the security wizard from the beginning to enable security.',
+  'admin.addSecurity.enable.after.stage2.onClose': 'Services are being started with the Kerberos settings you specified.'+
+    'It is recommended that you wait until all the services are started to ensure that they are set up properly.',
   'admin.addSecurity.disable.onClose': 'You are in the process of disabling security on your cluster. ' +
-    'Are you sure you want to navigate away? If you navigate away, ' +
-    'you may have to re-run the security wizard from the beginning to disable security.',
+    'Are you sure you want to quit?',
   'admin.removeSecurity.header': 'Disable Security',
+  'admin.security.applying.config.header': 'Applying Configurations',
+  'admin.security.applying.config.body':'You cannot quit wizard while configurations are being applied',
   'admin.security.status.error' : 'Error in retrieving cluster security status from Ambari server',
   'admin.users.ldapAuthUsed':'LDAP Authentication is being used to authenticate users',
   'admin.users.delete.yourself.message':'You can\'t delete yourself',

Modified: incubator/ambari/trunk/ambari-web/app/router.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/router.js?rev=1492923&r1=1492922&r2=1492923&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/router.js (original)
+++ incubator/ambari/trunk/ambari-web/app/router.js Fri Jun 14 01:27:08 2013
@@ -275,12 +275,9 @@ App.Router = Em.Router.extend({
     } else if (clusterStatusOnServer && clusterStatusOnServer.wizardControllerName === App.router.get('addHostController.name')) {
       // if wizardControllerName == "addHostController", then it means someone closed the browser or the browser was crashed when we were last in Add Hosts wizard
       return 'main.hostAdd';
-    } else if (clusterStatusOnServer && clusterStatusOnServer.wizardControllerName === App.router.get('addSecurityController.name')) {
+    } else if (clusterStatusOnServer && (clusterStatusOnServer.wizardControllerName === App.router.get('addSecurityController.name') || clusterStatusOnServer.wizardControllerName === App.router.get('mainAdminSecurityDisableController.name'))) {
       // if wizardControllerName == "addSecurityController", then it means someone closed the browser or the browser was crashed when we were last in Add Security wizard
-      return 'main.admin.adminSecurity.adminAddSecurity';
-    } else if (clusterStatusOnServer && clusterStatusOnServer.wizardControllerName === App.router.get('mainAdminSecurityDisableController.name')) {
-      // if wizardControllerName == "disableSecurityController", then it means someone closed the browser or the browser was crashed when we were last in disable Security pop-up.
-      return 'main.admin.adminSecurity.disableSecurity';
+      return 'main.admin.adminSecurity';
     } else if (clusterStatusOnServer && clusterStatusOnServer.wizardControllerName === App.router.get('addServiceController.name')) {
       // if wizardControllerName == "addHostController", then it means someone closed the browser or the browser was crashed when we were last in Add Hosts wizard
       return 'main.serviceAdd';

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=1492923&r1=1492922&r2=1492923&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 14 01:27:08 2013
@@ -23,73 +23,67 @@ module.exports = Em.Route.extend({
     console.log('in /security/add:enter');
 
     Ember.run.next(function () {
-      App.clusterStatus.updateFromServer();
-      var currentClusterStatus = App.clusterStatus.get('value');
-      if (currentClusterStatus) {
-        switch (currentClusterStatus.clusterState) {
-          case 'ADD_SECURITY_STEP_1' :
-            router.set('addSecurityController.currentStep', 1);
-            App.db.data = currentClusterStatus.localdb;
-            break;
-          case 'ADD_SECURITY_STEP_2' :
-            router.set('addSecurityController.currentStep', 2);
-            App.db.data = currentClusterStatus.localdb;
-            break;
-          case 'ADD_SECURITY_STEP_3' :
-            router.set('addSecurityController.currentStep', 3);
-            App.db.data = currentClusterStatus.localdb;
-            break;
-          default:
-            break;
-        }
-      }
       if (router.get('mainAdminSecurityController').getAddSecurityWizardStatus() === 'RUNNING') {
         var mainAdminSecurityController = router.get('mainAdminSecurityController');
         var addSecurityController = router.get('addSecurityController');
         var currentStep = router.get('addSecurityController').get('currentStep');
         App.router.get('updateController').set('isWorking', false);
         App.ModalPopup.show({
-          classNames: ['full-width-modal'],
-          header: Em.I18n.t('admin.addSecurity.header'),
-          bodyClass: App.MainAdminSecurityAddMenuView.extend({
-            controllerBinding: 'App.router.addSecurityController'
-          }),
-          primary: Em.I18n.t('form.cancel'),
-          secondary: null,
-          showFooter: false,
-
-          onClose: function () {
-            var self = this;
-            if (router.get('addSecurityController.currentStep') == 3) {
-              var applyingConfigStage = router.get('mainAdminSecurityAddStep3Controller.stages').findProperty('stage', 'stage3');
-              if (applyingConfigStage && !applyingConfigStage.get('isCompleted')) {
-                App.showConfirmationPopup(function () {
-                  router.get('mainAdminSecurityAddStep3Controller').clearStep();
-                  self.proceedOnClose();
-                }, Em.I18n.t('admin.addSecurity.enable.onClose'));
-                return;
+            classNames: ['full-width-modal'],
+            header: Em.I18n.t('admin.addSecurity.header'),
+            bodyClass: App.MainAdminSecurityAddMenuView.extend({
+              controllerBinding: 'App.router.addSecurityController'
+            }),
+            primary: Em.I18n.t('form.cancel'),
+            secondary: null,
+            showFooter: false,
+
+            onClose: function () {
+              var self = this;
+              if (router.get('addSecurityController.currentStep') == 3) {
+                var applyingConfigStage = router.get('mainAdminSecurityAddStep3Controller.stages').findProperty('stage', 'stage3');
+                if (applyingConfigStage && !applyingConfigStage.get('isCompleted')) {
+                  if (applyingConfigStage.get('isStarted')) {
+                    App.showAlertPopup(Em.I18n.t('admin.security.applying.config.header'), Em.I18n.t('admin.security.applying.config.body'));
+                    return;
+                  } else {
+                    App.showConfirmationPopup(function () {
+                      self.proceedOnClose();
+                    }, Em.I18n.t('admin.addSecurity.enable.onClose'));
+                    return;
+                  }
+                } else {
+                  App.showConfirmationPopup(function () {
+                    self.proceedOnClose();
+                  }, Em.I18n.t('admin.addSecurity.enable.after.stage2.onClose'));
+                  return;
+                }
               }
+              self.proceedOnClose();
+            },
+            proceedOnClose: function () {
+              this.hide();
+              router.get('mainAdminSecurityAddStep3Controller').clearStep();
+              router.get('addSecurityController.content.services').clear();
+              router.set('addSecurityController.content.serviceConfigProperties', null);
+              App.router.get('updateController').set('isWorking', true);
+              mainAdminSecurityController.setAddSecurityWizardStatus(null);
+              App.db.setSecurityDeployStages(undefined);
+              router.get('addSecurityController').setCurrentStep(1);
+              App.clusterStatus.setClusterStatus({
+                clusterName: router.get('content.cluster.name'),
+                clusterState: 'SECURITY_COMPLETED',
+                wizardControllerName: router.get('addSecurityController.name'),
+                localdb: App.db.data
+              });
+              router.transitionTo('adminSecurity.index');
+            },
+            didInsertElement: function () {
+              this.fitHeight();
             }
-            this.proceedOnClose();
-          },
-          proceedOnClose: function(){
-            this.hide();
-            App.router.get('updateController').set('isWorking', true);
-            mainAdminSecurityController.setAddSecurityWizardStatus(null);
-            App.db.setSecurityDeployStages(undefined);
-            router.get('addSecurityController').setCurrentStep(1);
-            App.clusterStatus.setClusterStatus({
-              clusterName: router.get('content.cluster.name'),
-              clusterState: 'SECURITY_COMPLETED',
-              wizardControllerName: router.get('addSecurityController.name'),
-              localdb: App.db.data
-            });
-            router.transitionTo('adminSecurity.index');
-          },
-          didInsertElement: function () {
-            this.fitHeight();
           }
-        });
+        )
+        ;
 
         App.router.transitionTo('step' + currentStep);
       } else {

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=1492923&r1=1492922&r2=1492923&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/routes/main.js (original)
+++ incubator/ambari/trunk/ambari-web/app/routes/main.js Fri Jun 14 01:27:08 2013
@@ -653,6 +653,9 @@ 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 (!(controller.getAddSecurityWizardStatus() === 'RUNNING') && !(controller.getDisableSecurityStatus() === 'RUNNING')) {
           Em.run.next(function () {
             router.transitionTo('adminSecurity.index');
@@ -708,25 +711,31 @@ module.exports = Em.Route.extend({
                   var self = this;
                   var applyingConfigStage = router.get('mainAdminSecurityDisableController.stages').findProperty('stage', 'stage3');
                   if (applyingConfigStage && !applyingConfigStage.get('isCompleted')) {
-                    App.showConfirmationPopup(function () {
-                      router.get('mainAdminSecurityAddStep3Controller').clearStep();
-                      self.proceedOnClose();
-                    }, Em.I18n.t('admin.addSecurity.disable.onClose'));
-                    return;
+                    if (applyingConfigStage.get('isStarted')) {
+                      App.showAlertPopup(Em.I18n.t('admin.security.applying.config.header'), Em.I18n.t('admin.security.applying.config.body'));
+                      return;
+                    } else {
+                      App.showConfirmationPopup(function () {
+                        self.proceedOnClose();
+                      }, Em.I18n.t('admin.addSecurity.disable.onClose'));
+                      return;
+                    }
                   }
-                  this.proceedOnClose();
+                  self.proceedOnClose();
+
                 },
-                proceedOnClose: function(){
-                  this.hide();
+                proceedOnClose: function () {
+                  router.get('mainAdminSecurityDisableController').clearStep();
                   App.db.setSecurityDeployStages(undefined);
-                  router.get('mainAdminSecurityController').setDisableSecurityStatus(undefined);
                   App.router.get('updateController').set('isWorking', true);
+                  router.get('mainAdminSecurityController').setDisableSecurityStatus(undefined);
                   App.clusterStatus.setClusterStatus({
                     clusterName: router.get('content.cluster.name'),
                     clusterState: 'SECURITY_COMPLETED',
                     wizardControllerName: router.get('mainAdminSecurityDisableController.name'),
                     localdb: App.db.data
                   });
+                  this.hide();
                   router.transitionTo('adminSecurity.index');
                 },
                 didInsertElement: function () {

Modified: incubator/ambari/trunk/ambari-web/app/templates/main/admin/security/add/step2.hbs
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/templates/main/admin/security/add/step2.hbs?rev=1492923&r1=1492922&r2=1492923&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/templates/main/admin/security/add/step2.hbs (original)
+++ incubator/ambari/trunk/ambari-web/app/templates/main/admin/security/add/step2.hbs Fri Jun 14 01:27:08 2013
@@ -28,6 +28,6 @@
     <a class="btn" {{action back}}>&larr; {{t common.back}}</a>
 
     <a class="btn btn-success pull-right" {{bindAttr disabled="isSubmitDisabled"}}
-      {{action submit target="controller"}}>{{t common.next}} &rarr;</a>
+      {{action submit target="controller"}}>{{t common.apply}} &rarr;</a>
   </div>
 </div>
\ No newline at end of file