You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ja...@apache.org on 2014/11/01 23:46:16 UTC

git commit: AMBARI-8094. Install Wizard completely breaks after install fails and going back to a previous step. (jaimin)

Repository: ambari
Updated Branches:
  refs/heads/branch-1.7.0 7106b5b48 -> cdf266586


AMBARI-8094. Install Wizard completely breaks after install fails and going back to a previous step. (jaimin)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/cdf26658
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/cdf26658
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/cdf26658

Branch: refs/heads/branch-1.7.0
Commit: cdf26658636990450a740033b68cb789b23e477d
Parents: 7106b5b
Author: Jaimin Jetly <ja...@hortonworks.com>
Authored: Sat Nov 1 15:45:11 2014 -0700
Committer: Jaimin Jetly <ja...@hortonworks.com>
Committed: Sat Nov 1 15:45:11 2014 -0700

----------------------------------------------------------------------
 ambari-web/app/router.js           |  4 ++--
 ambari-web/app/routes/installer.js | 15 +++++++++++++--
 2 files changed, 15 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/cdf26658/ambari-web/app/router.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/router.js b/ambari-web/app/router.js
index 97fc560..f5948be 100644
--- a/ambari-web/app/router.js
+++ b/ambari-web/app/router.js
@@ -124,7 +124,7 @@ App.Router = Em.Router.extend({
   },
 
   onAuthenticationSuccess: function (data) {
-    this.set('loggedIn', true);
+    this.setAuthenticated(true);
     if (data.items.length) {
       this.setClusterInstalled(data);
     }
@@ -132,7 +132,7 @@ App.Router = Em.Router.extend({
 
   onAuthenticationError: function (data) {
     if (data.status === 403) {
-      this.set('loggedIn', false);
+      this.setAuthenticated(false);
     } else {
       console.log('error in getAuthenticated');
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/cdf26658/ambari-web/app/routes/installer.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/installer.js b/ambari-web/app/routes/installer.js
index 5c164fe..350e430 100644
--- a/ambari-web/app/routes/installer.js
+++ b/ambari-web/app/routes/installer.js
@@ -42,18 +42,28 @@ module.exports = Em.Route.extend({
             console.log('current step=' + router.get('installerController.currentStep'));
             Ember.run.next(function () {
               var installerController = router.get('installerController');
-
               App.clusterStatus.updateFromServer().complete(function () {
                 var currentClusterStatus = App.clusterStatus.get('value');
-
+                //@TODO: Clean up  following states. Navigation should be done solely via currentStep stored in the localDb and API persist endpoint.
+                //       Actual currentStep value for the installer controller should always remain in sync with localdb and at persist store in the server.
                 if (currentClusterStatus) {
                   switch (currentClusterStatus.clusterState) {
                     case 'CLUSTER_NOT_CREATED_1' :
+                      var localDb = currentClusterStatus.localdb;
+                      if (localDb && localDb.Installer && localDb.Installer.currentStep) {
+                        App.db.data = currentClusterStatus.localdb;
+                        App.router.setAuthenticated(true);
+                        var controllerName = installerController.get('name');
+                        var suffixLength = 10;
+                        var currentStep = App.get('router').getWizardCurrentStep(controllerName.substr(0, controllerName.length - suffixLength));
+                        installerController.setCurrentStep(currentStep);
+                      }
                       router.transitionTo('step' + installerController.get('currentStep'));
                       break;
                     case 'CLUSTER_DEPLOY_PREP_2' :
                       installerController.setCurrentStep('8');
                       App.db.data = currentClusterStatus.localdb;
+                      App.router.setAuthenticated(true);
                       router.transitionTo('step' + installerController.get('currentStep'));
                       break;
                     case 'CLUSTER_INSTALLING_3' :
@@ -68,6 +78,7 @@ module.exports = Em.Route.extend({
                         installerController.setCurrentStep('10');
                       }
                       App.db.data = currentClusterStatus.localdb;
+                      App.router.setAuthenticated(true);
                       router.transitionTo('step' + installerController.get('currentStep'));
                       break;
                     case 'DEFAULT' :