Browse Source

AMBARI-16264 Clean up local DB when get back to step 0 of installer wizard (zhewang)

Zhe (Joe) Wang 9 years ago
parent
commit
1770820a7a

+ 3 - 0
ambari-web/app/controllers/wizard/step1_controller.js

@@ -121,6 +121,9 @@ App.WizardStep1Controller = Em.Controller.extend({
   },
 
   changeUseRedhatSatellite: function () {
+    if (App.router.get('installerController.currentStep') !== "1") {
+      return;
+    }
     if (this.get('selectedStack.useRedhatSatellite')) {
       return App.ModalPopup.show({
         header: Em.I18n.t('common.important'),

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

@@ -104,9 +104,40 @@ module.exports = Em.Route.extend(App.RouterRedirections, {
     next: function (router) {
       console.time('step0 next');
       var installerController = router.get('installerController');
+      var wizardStep1Controller = router.get('wizardStep1Controller');
       installerController.save('cluster');
       App.db.setStacks(undefined);
+      App.db.setRepos(undefined);
+      App.db.setLocalRepoVDFData(undefined);
+      App.Stack.find().clear();
+
       installerController.set('content.stacks',undefined);
+      wizardStep1Controller.set('skipValidationChecked', false);
+      wizardStep1Controller.set('optionsToSelect', {
+        'usePublicRepo': {
+          index: 0,
+          isSelected: true
+        },
+        'useLocalRepo': {
+          index: 1,
+          isSelected: false,
+          'uploadFile': {
+            index: 0,
+            name: 'uploadFile',
+            file: '',
+            hasError: false,
+            isSelected: true
+          },
+          'enterUrl': {
+            index: 1,
+            name: 'enterUrl',
+            url: '',
+            placeholder: 'Enter URL to Version Definition File',
+            hasError: false,
+            isSelected: false
+          }
+        }
+      });
       router.transitionTo('step1');
       console.timeEnd('step0 next');
     }