Browse Source

AMBARI-3627. Reassign Master: Quitting the wizard should be handled gracefully. (akovalenko)

Aleksandr Kovalenko 11 years ago
parent
commit
bae037a86f
2 changed files with 26 additions and 3 deletions
  1. 2 0
      ambari-web/app/messages.js
  2. 24 3
      ambari-web/app/routes/reassign_master_routes.js

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

@@ -1083,6 +1083,8 @@ Em.I18n.translations = {
   'services.service.startAll':'Start All',
   'services.service.stopAll':'Stop All',
 
+  'services.reassign.closePopup':'Reassign {0} wizard is in progress. It\'s necessary to complete the wizard for Ambari to be in usable state. If you choose to quit, you must follow manual instructions to complete or revert reassign {0} wizard as documented in the Ambari User Guide. Are you sure you want to exit the wizard ?',
+
   'services.reassign.step1.header':'Get Started',
   'services.reassign.step1.message1': 'This wizard will walk you through reassigning {0}.<br/>',
   'services.reassign.step1.message2': 'The process to reassign {0} involves a combination of <b>automated steps</b> (that will be handled by the wizard) and ' +

+ 24 - 3
ambari-web/app/routes/reassign_master_routes.js

@@ -44,9 +44,30 @@ module.exports = Em.Route.extend({
           App.router.transitionTo('main.services.index');
         },
         onClose: function () {
-          this.hide();
-          App.router.get('updateController').set('isWorking', true);
-          App.router.transitionTo('main.services.index')
+          var reassignMasterController = router.get('reassignMasterController');
+          var currStep = reassignMasterController.get('currentStep');
+
+          if (parseInt(currStep) > 3) {
+            var self = this;
+            App.showConfirmationPopup(function(){
+              self.hide();
+              reassignMasterController.setCurrentStep('1');
+              router.get('reassignMasterWizardStep' + currStep + 'Controller').removeObserver('tasks.@each.status', this, 'onTaskStatusChange');
+              App.clusterStatus.setClusterStatus({
+                clusterName: router.get('reassignMasterController.content.cluster.name'),
+                clusterState: 'DEFAULT',
+                wizardControllerName: 'reassignMasterController',
+                localdb: App.db.data
+              });
+              router.get('updateController').set('isWorking', true);
+              router.transitionTo('main.services.index')
+            }, Em.I18n.t('services.reassign.closePopup').format(reassignMasterController.get('content.reassign.display_name')));
+          } else {
+            this.hide();
+            reassignMasterController.setCurrentStep('1');
+            router.get('updateController').set('isWorking', true);
+            router.transitionTo('main.services.index')
+          }
         },
         didInsertElement: function () {
           this.fitHeight();