소스 검색

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

Aleksandr Kovalenko 11 년 전
부모
커밋
bae037a86f
2개의 변경된 파일26개의 추가작업 그리고 3개의 파일을 삭제
  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();