浏览代码

AMBARI-11932. clicking back to go to confirm hosts leads to re-installation (alexantonenko)

Alex Antonenko 10 年之前
父节点
当前提交
eaf9a27791

+ 2 - 0
ambari-web/app/controllers/wizard.js

@@ -24,6 +24,7 @@ App.WizardController = Em.Controller.extend(App.LocalStorage, App.ThemesMappingM
 
   isStepDisabled: null,
 
+  previousStep: 0,
   /**
    * map of actions which load data required by which step
    * used by <code>loadAllPriorSteps</code>
@@ -146,6 +147,7 @@ App.WizardController = Em.Controller.extend(App.LocalStorage, App.ThemesMappingM
    * @param completed
    */
   setCurrentStep: function (currentStep, completed) {
+    this.set('previousStep', this.get('currentStep'));
     App.db.setWizardCurrentStep(this.get('name').substr(0, this.get('name').length - 10), currentStep, completed);
     this.set('currentStep', currentStep);
   },

+ 13 - 4
ambari-web/app/controllers/wizard/step3_controller.js

@@ -265,10 +265,19 @@ App.WizardStep3Controller = Em.Controller.extend(App.ReloadPopupMixin, {
    */
   loadStep: function () {
     console.log("TRACE: Loading step3: Confirm Hosts");
-    this.disablePreviousSteps();
-    this.clearStep();
-    App.router.get('clusterController').loadAmbariProperties();
-    this.loadHosts();
+    var wizardController = this.get('wizardController');
+    var previousStep = wizardController && wizardController.get('previousStep');
+    var currentStep = wizardController && wizardController.get('currentStep');
+    var isHostsLoaded = this.get('hosts').length !== 0;
+    var isPrevAndCurrStepsSetted = previousStep && currentStep;
+    var isPrevStepSmallerThenCurrent = previousStep < currentStep;
+    if (!isHostsLoaded || isPrevStepSmallerThenCurrent || 
+        !wizardController || !isPrevAndCurrStepsSetted) {
+      this.disablePreviousSteps();
+      this.clearStep();
+      App.router.get('clusterController').loadAmbariProperties();
+      this.loadHosts();
+    }
   },
 
   /**

+ 0 - 2
ambari-web/app/routes/installer.js

@@ -217,7 +217,6 @@ module.exports = Em.Route.extend(App.RouterRedirections, {
       var wizardStep4Controller = router.get('wizardStep4Controller');
       controller.saveServices(wizardStep4Controller);
       controller.saveClients(wizardStep4Controller);
-
       router.get('wizardStep5Controller').clearRecommendations(); // Force reload recommendation between steps 4 and 5
       controller.setDBProperty('recommendations', undefined);
       controller.setDBProperty('masterComponentHosts', undefined);
@@ -417,7 +416,6 @@ module.exports = Em.Route.extend(App.RouterRedirections, {
         var installerController = router.get('installerController');
         var wizardStep9Controller = router.get('wizardStep9Controller');
         installerController.saveInstalledHosts(wizardStep9Controller);
-
         installerController.saveClusterState('CLUSTER_INSTALLED_4');
         router.transitionTo('step10');
       }