AMBARI-12185. User is able to go back from deploy step of installer 
(onechiporenko)


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

Branch: refs/heads/branch-2.1
Commit: ad1025efa683f56145fc851dddef226615a95121
Parents: 3310837
Author: Oleg Nechiporenko <onechipore...@apache.org>
Authored: Thu Jul 9 17:19:27 2015 +0300
Committer: Oleg Nechiporenko <onechipore...@apache.org>
Committed: Thu Jul 9 17:19:27 2015 +0300

----------------------------------------------------------------------
 ambari-web/app/controllers/wizard.js            | 28 +++++++++++++-------
 ambari-web/app/mixins/routers/redirections.js   |  2 ++
 .../test/mixins/routers/redirections_test.js    | 11 ++++++--
 3 files changed, 29 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/ad1025ef/ambari-web/app/controllers/wizard.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard.js 
b/ambari-web/app/controllers/wizard.js
index bf579ba..cfe6e49 100644
--- a/ambari-web/app/controllers/wizard.js
+++ b/ambari-web/app/controllers/wizard.js
@@ -46,18 +46,26 @@ App.WizardController = 
Em.Controller.extend(App.LocalStorage, App.ThemesMappingM
   ],
 
   init: function () {
-    this.set('isStepDisabled', []);
     this.clusters = App.Cluster.find();
-    this.get('isStepDisabled').pushObject(Ember.Object.create({
-      step: 1,
-      value: false
-    }));
-    for (var i = 2; i <= this.get('totalSteps'); i++) {
-      this.get('isStepDisabled').pushObject(Ember.Object.create({
-        step: i,
-        value: true
+    this.setIsStepDisabled();
+  },
+
+  /**
+   * Set <code>isStepDisabled</code> with list of available steps (basing on 
<code>totalSteps</code>)
+   * @method setIsStepDisabled
+   */
+  setIsStepDisabled: function () {
+      this.set('isStepDisabled', []);
+      this.get('isStepDisabled').pushObject(Em.Object.create({
+        step: 1,
+        value: false
       }));
-    }
+      for (var i = 2; i <= this.get('totalSteps'); i++) {
+        this.get('isStepDisabled').pushObject(Em.Object.create({
+          step: i,
+          value: true
+        }));
+      }
   },
 
   slaveComponents: function () {

http://git-wip-us.apache.org/repos/asf/ambari/blob/ad1025ef/ambari-web/app/mixins/routers/redirections.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/routers/redirections.js 
b/ambari-web/app/mixins/routers/redirections.js
index 2e605be..5ef9bae 100644
--- a/ambari-web/app/mixins/routers/redirections.js
+++ b/ambari-web/app/mixins/routers/redirections.js
@@ -62,12 +62,14 @@ App.RouterRedirections = Em.Mixin.create({
       case 'SERVICE_STARTING_3' :
         if (!installerController.get('isStep9')) {
           installerController.setCurrentStep('9');
+          installerController.setLowerStepsDisable(9);
         }
         router.transitionTo(path + 'step' + 
installerController.get('currentStep'));
         break;
       case 'CLUSTER_INSTALLED_4' :
         if (!installerController.get('isStep10')) {
           installerController.setCurrentStep('10');
+          installerController.setLowerStepsDisable(10);
         }
         App.db.data = currentClusterStatus.localdb;
         App.get('router').setAuthenticated(true);

http://git-wip-us.apache.org/repos/asf/ambari/blob/ad1025ef/ambari-web/test/mixins/routers/redirections_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mixins/routers/redirections_test.js 
b/ambari-web/test/mixins/routers/redirections_test.js
index 7b3eed7..d25ee81 100644
--- a/ambari-web/test/mixins/routers/redirections_test.js
+++ b/ambari-web/test/mixins/routers/redirections_test.js
@@ -18,18 +18,25 @@
 
 var App = require('app');
 
-var route, installerController, currentClusterStatus;
+var router, installerController, currentClusterStatus;
 
-describe('App.Redirections', function () {
+describe('App.RouterRedirections', function () {
 
   beforeEach(function () {
 
     installerController = Em.Object.create({
       currentStep: '',
+      totalSteps: 11,
       setCurrentStep: function (k) {
         this.set('currentStep', k);
       }
     });
+    
App.router.get('installerController').setIsStepDisabled.call(installerController);
+    installerController.setLowerStepsDisable = 
App.router.get('installerController').setLowerStepsDisable.bind(installerController);
+    installerController.get('isStepDisabled').pushObject(Ember.Object.create({
+      step: 0,
+      value: true
+    }));
 
     router = Em.Object.create(App.RouterRedirections, {
       transitionTo: Em.K,

Reply via email to