Repository: ambari Updated Branches: refs/heads/branch-2.6 070f69d40 -> 181f6b63f
AMBARI-21966. "Next" button on "Assign Masters" page gets disabled when installing Ambari (akovalenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/181f6b63 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/181f6b63 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/181f6b63 Branch: refs/heads/branch-2.6 Commit: 181f6b63fbe40f0c3b0ad5914b766ec942b7626d Parents: 070f69d Author: Aleksandr Kovalenko <akovale...@hortonworks.com> Authored: Wed Sep 20 16:45:37 2017 +0300 Committer: Aleksandr Kovalenko <akovale...@hortonworks.com> Committed: Wed Sep 20 19:18:22 2017 +0300 ---------------------------------------------------------------------- .../wizard/step7/assign_master_controller.js | 5 +++- .../mixins/wizard/assign_master_components.js | 18 ++++++++------- .../step7/assign_master_controller_test.js | 24 ++++++++++++++++++++ 3 files changed, 38 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/181f6b63/ambari-web/app/controllers/wizard/step7/assign_master_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/wizard/step7/assign_master_controller.js b/ambari-web/app/controllers/wizard/step7/assign_master_controller.js index 9e6c6cc..039dd55 100644 --- a/ambari-web/app/controllers/wizard/step7/assign_master_controller.js +++ b/ambari-web/app/controllers/wizard/step7/assign_master_controller.js @@ -286,8 +286,9 @@ App.AssignMasterOnStep7Controller = Em.Controller.extend(App.BlueprintMixin, App renderHostInfo: function () { var parentController = this.get('content.controllerName'); if (parentController) { - this._super(); + return this._super(); } else { + var dfd = $.Deferred(); var hosts = App.Host.find().toArray(); var result = []; for (var p = 0; p < hosts.length; p++) { @@ -304,6 +305,8 @@ App.AssignMasterOnStep7Controller = Em.Controller.extend(App.BlueprintMixin, App this.set("hosts", result); this.sortHosts(result); this.set('isHostsLoaded', true); + dfd.resolve(); + return dfd.promise(); } }, http://git-wip-us.apache.org/repos/asf/ambari/blob/181f6b63/ambari-web/app/mixins/wizard/assign_master_components.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/mixins/wizard/assign_master_components.js b/ambari-web/app/mixins/wizard/assign_master_components.js index 5da9a13..d84399e 100644 --- a/ambari-web/app/mixins/wizard/assign_master_components.js +++ b/ambari-web/app/mixins/wizard/assign_master_components.js @@ -551,17 +551,19 @@ App.AssignMasterComponents = Em.Mixin.create({ * @method loadStep */ loadStep: function () { + var self = this; this.clearStep(); if (this._additionalClearSteps) { this._additionalClearSteps(); } - this.renderHostInfo(); - //when returning from step Assign Slaves and Clients, recommendations are already available - //set the flag so that recommendations AJAX call is not made unnecessarily - if (this.get('recommendations')) { - this.set('backFromNextStep',true); - } - this.loadComponentsRecommendationsFromServer(this.loadStepCallback); + this.renderHostInfo().done(function () { + //when returning from step Assign Slaves and Clients, recommendations are already available + //set the flag so that recommendations AJAX call is not made unnecessarily + if (self.get('recommendations')) { + self.set('backFromNextStep', true); + } + self.loadComponentsRecommendationsFromServer(self.loadStepCallback); + }); }, /** @@ -627,7 +629,7 @@ App.AssignMasterComponents = Em.Mixin.create({ */ renderHostInfo: function () { var isInstaller = (this.get('wizardController.name') === 'installerController' || this.get('content.controllerName') === 'installerController'); - App.ajax.send({ + return App.ajax.send({ name: isInstaller ? 'hosts.info.install' : 'hosts.high_availability.wizard', sender: this, data: { http://git-wip-us.apache.org/repos/asf/ambari/blob/181f6b63/ambari-web/test/controllers/wizard/step7/assign_master_controller_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/controllers/wizard/step7/assign_master_controller_test.js b/ambari-web/test/controllers/wizard/step7/assign_master_controller_test.js index e70055b..a8b96ef 100644 --- a/ambari-web/test/controllers/wizard/step7/assign_master_controller_test.js +++ b/ambari-web/test/controllers/wizard/step7/assign_master_controller_test.js @@ -19,6 +19,7 @@ var App = require('app'); var stringUtils = require('utils/string_utils'); var numberUtils = require('utils/number_utils'); +var testHelpers = require('test/helpers'); require('models/stack_service_component'); describe('App.AssignMasterOnStep7Controller', function () { @@ -230,6 +231,7 @@ describe('App.AssignMasterOnStep7Controller', function () { }) ]); sinon.stub(view, 'sortHosts'); + sinon.stub(view, 'getHosts').returns([]); sinon.stub(numberUtils, 'bytesToSize').returns(1); }); @@ -261,6 +263,28 @@ describe('App.AssignMasterOnStep7Controller', function () { host_info: Em.I18n.t('installer.step5.hostInfo').fmt('host1', 1, 1) })])).to.be.true; }); + + it("should make general request to get hosts", function() { + view.reopen({ + content: Em.Object.create({ + controllerName: 'name' + }) + }); + view.renderHostInfo(); + var args = testHelpers.findAjaxRequest('name', 'hosts.high_availability.wizard'); + expect(args).exists; + }); + + it("should make request for installer to get hosts", function() { + view.reopen({ + content: Em.Object.create({ + controllerName: 'installerController' + }) + }); + view.renderHostInfo(); + var args = testHelpers.findAjaxRequest('name', 'hosts.info.install'); + expect(args).exists; + }); }); describe("#loadMasterComponentHosts()", function () {