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/a51accc1 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/a51accc1 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/a51accc1 Branch: refs/heads/trunk Commit: a51accc1c5735cbade1870430af4216f0b5944da Parents: c952878 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 18:24:34 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/a51accc1/ambari-web/app/controllers/wizard.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/wizard.js b/ambari-web/app/controllers/wizard.js index 205c56a..eaf60a2 100644 --- a/ambari-web/app/controllers/wizard.js +++ b/ambari-web/app/controllers/wizard.js @@ -47,18 +47,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/a51accc1/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/a51accc1/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,