Browse Source

AMBARI-6621. RM HA Wizard: Show confirmation popup if user try to close wizard on the last step. (akovalenko)

Aleksandr Kovalenko 10 years ago
parent
commit
d6949dc378
2 changed files with 27 additions and 13 deletions
  1. 1 0
      ambari-web/app/messages.js
  2. 26 13
      ambari-web/app/routes/rm_high_availability_routes.js

+ 1 - 0
ambari-web/app/messages.js

@@ -840,6 +840,7 @@ Em.I18n.translations = {
   'admin.highAvailability.error.security':'You cannot enable NameNode HA via this wizard as your cluster is already secured.  First, disable security by going to Admin > Security, and then run this Enable NameNode HA wizard again.  After NameNode HA is enabled, you can go back to Admin > Security to secure the cluster.',
   'admin.rm_highAvailability.error.hostsNum':'You must have at least 3 hosts in your cluster to enable ResourceManager HA.',
   'admin.rm_highAvailability.error.zooKeeperNum':'You must have at least 3 ZooKeeper Servers in your cluster to enable ResourceManager HA.',
+  'admin.rm_highAvailability.closePopup':'Enable ResourceManager HA Wizard is in progress. You must allow the wizard to complete for Ambari to be in usable state. If you choose to quit, you must follow manual instructions to complete or revert enabling ResourceManager HA as documented in the Ambari User Guide. Are you sure you want to exit the wizard?',
 
   'admin.highAvailability.wizard.header':'Enable NameNode HA Wizard',
   'admin.highAvailability.wizard.progressPage.notice.inProgress':'Please wait while NameNode HA is being deployed.',

+ 26 - 13
ambari-web/app/routes/rm_high_availability_routes.js

@@ -36,18 +36,30 @@ module.exports = App.WizardRoute.extend({
         secondary: null,
 
         onClose: function () {
-          var controller = App.router.get('rMHighAvailabilityWizardController');
-          controller.clearStorageData();
-          controller.setCurrentStep('1');
-          App.router.get('updateController').set('isWorking', true);
-          App.clusterStatus.setClusterStatus({
-            clusterName: App.router.get('content.cluster.name'),
-            clusterState: 'DEFAULT',
-            wizardControllerName: App.router.get('rMHighAvailabilityWizardController.name'),
-            localdb: App.db.data
-          });
-          this.hide();
-          App.router.transitionTo('main.admin.adminHighAvailability');
+          var rMHighAvailabilityWizardController = router.get('rMHighAvailabilityWizardController');
+          var currStep = rMHighAvailabilityWizardController.get('currentStep');
+
+          if (parseInt(currStep) === 4) {
+            var self = this;
+            App.showConfirmationPopup(function () {
+              self.hide();
+              rMHighAvailabilityWizardController.setCurrentStep('1');
+              App.clusterStatus.setClusterStatus({
+                clusterName: App.router.getClusterName(),
+                clusterState: 'DEFAULT',
+                wizardControllerName: rMHighAvailabilityWizardController.get('name'),
+                localdb: App.db.data
+              });
+              router.get('updateController').set('isWorking', true);
+              router.transitionTo('main.admin.adminHighAvailability.index');
+              location.reload();
+            }, Em.I18n.t('admin.rm_highAvailability.closePopup'));
+          } else {
+            this.hide();
+            rMHighAvailabilityWizardController.setCurrentStep('1');
+            router.get('updateController').set('isWorking', true);
+            router.transitionTo('main.admin.adminHighAvailability.index')
+          }
         },
         didInsertElement: function () {
           this.fitHeight();
@@ -164,7 +176,8 @@ module.exports = App.WizardRoute.extend({
         wizardControllerName: 'rMHighAvailabilityWizardController',
         localdb: App.db.data
       });
-      router.transitionTo('main.index');
+      router.transitionTo('main.admin.adminHighAvailability.index');
+      location.reload();
     }
   }),