Return-Path: X-Original-To: apmail-ambari-commits-archive@www.apache.org Delivered-To: apmail-ambari-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 998A018171 for ; Fri, 4 Dec 2015 13:31:58 +0000 (UTC) Received: (qmail 27336 invoked by uid 500); 4 Dec 2015 13:31:58 -0000 Delivered-To: apmail-ambari-commits-archive@ambari.apache.org Received: (qmail 27307 invoked by uid 500); 4 Dec 2015 13:31:54 -0000 Mailing-List: contact commits-help@ambari.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ambari-dev@ambari.apache.org Delivered-To: mailing list commits@ambari.apache.org Received: (qmail 27298 invoked by uid 99); 4 Dec 2015 13:31:53 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 Dec 2015 13:31:53 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id A6BB1E07D9; Fri, 4 Dec 2015 13:31:53 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: atkach@apache.org To: commits@ambari.apache.org Message-Id: <23c0e1da24dd4ae487a0463586e3c043@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: ambari git commit: AMBARI-14214 Add Service wizard: Browser refresh on "Customize Services page" hides recommendation message and link. (atkach) Date: Fri, 4 Dec 2015 13:31:53 +0000 (UTC) Repository: ambari Updated Branches: refs/heads/trunk a8649b0f0 -> 78bfef831 AMBARI-14214 Add Service wizard: Browser refresh on "Customize Services page" hides recommendation message and link. (atkach) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/78bfef83 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/78bfef83 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/78bfef83 Branch: refs/heads/trunk Commit: 78bfef83197fd77029d4ead5b6eaf3254f97d173 Parents: a8649b0 Author: Andrii Tkach Authored: Fri Dec 4 15:31:38 2015 +0200 Committer: Andrii Tkach Committed: Fri Dec 4 15:31:38 2015 +0200 ---------------------------------------------------------------------- .../controllers/main/service/add_controller.js | 5 ++++ ambari-web/app/mixins/common/serverValidator.js | 28 +------------------- ambari-web/app/routes/add_service_routes.js | 9 ++++--- ambari-web/app/utils/blueprint.js | 4 +-- ambari-web/test/utils/blueprint_test.js | 9 +++---- 5 files changed, 18 insertions(+), 37 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/78bfef83/ambari-web/app/controllers/main/service/add_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/service/add_controller.js b/ambari-web/app/controllers/main/service/add_controller.js index 634aa07..1f8133d 100644 --- a/ambari-web/app/controllers/main/service/add_controller.js +++ b/ambari-web/app/controllers/main/service/add_controller.js @@ -126,6 +126,7 @@ App.AddServiceController = App.WizardController.extend(App.AddSecurityConfigs, { }); self.loadServiceConfigGroups(); self.loadServiceConfigProperties(); + self.loadCurrentHostGroups(); }); return dfd.promise(); } @@ -153,6 +154,10 @@ App.AddServiceController = App.WizardController.extend(App.AddSecurityConfigs, { }); }, + loadCurrentHostGroups: function () { + this.set("content.recommendationsHostGroups", this.getDBProperty('recommendationsHostGroups')); + }, + /** * Load services data. Will be used at Select services(step4) step */ http://git-wip-us.apache.org/repos/asf/ambari/blob/78bfef83/ambari-web/app/mixins/common/serverValidator.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/mixins/common/serverValidator.js b/ambari-web/app/mixins/common/serverValidator.js index 7cfc918..b3fb3ad 100644 --- a/ambari-web/app/mixins/common/serverValidator.js +++ b/ambari-web/app/mixins/common/serverValidator.js @@ -191,15 +191,7 @@ App.ServerValidatorMixin = Em.Mixin.create({ if (this.get('configValidationFailed')) { this.warnUser(deferred); } else { - if (this.get('isInstaller')) { - this.runServerSideValidation(deferred); - } else { - // on Service Configs page we need to load all hosts with componnets - this.getAllHostsWithComponents().then(function(data) { - self.set('content.recommendationsHostGroups', blueprintUtils.generateHostGroups(App.get('allHostNames'), self.mapHostsToComponents(data.items))); - self.runServerSideValidation(deferred); - }); - } + this.runServerSideValidation(deferred); } return deferred; }, @@ -215,24 +207,6 @@ App.ServerValidatorMixin = Em.Mixin.create({ }, /** - * Generate array similar to App.HostComponent which will be used to - * create blueprint hostGroups object as well. - * - * @param {Object[]} jsonData - * @returns {Em.Object[]} - */ - mapHostsToComponents: function(jsonData) { - var result = []; - jsonData.forEach(function(item) { - result.push(Em.Object.create({ - componentName: Em.get(item, 'HostRoles.component_name'), - hostName: Em.get(item, 'HostRoles.host_name') - })); - }); - return result; - }, - - /** * @method serverSideValidation * send request to validate configs * @returns {*} http://git-wip-us.apache.org/repos/asf/ambari/blob/78bfef83/ambari-web/app/routes/add_service_routes.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/routes/add_service_routes.js b/ambari-web/app/routes/add_service_routes.js index 32e9b70..f305b0c 100644 --- a/ambari-web/app/routes/add_service_routes.js +++ b/ambari-web/app/routes/add_service_routes.js @@ -192,9 +192,12 @@ module.exports = App.WizardRoute.extend({ wizardStep6Controller.showValidationIssuesAcceptBox(function () { addServiceController.saveSlaveComponentHosts(wizardStep6Controller); addServiceController.get('content').set('serviceConfigProperties', null); - addServiceController.setDBProperty('serviceConfigProperties', null); - addServiceController.setDBProperty('groupsToDelete', []); - addServiceController.setDBProperty('recommendationsConfigs', null); + addServiceController.setDBProperties({ + serviceConfigProperties: null, + groupsToDelete: null, + recommendationsHostGroups: wizardStep6Controller.get('content.recommendationsHostGroups'), + recommendationsConfigs: null + }); router.get('wizardStep7Controller').set('recommendationsConfigs', null); router.get('wizardStep7Controller').clearDependentConfigs(); router.transitionTo('step4'); http://git-wip-us.apache.org/repos/asf/ambari/blob/78bfef83/ambari-web/app/utils/blueprint.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/utils/blueprint.js b/ambari-web/app/utils/blueprint.js index ea908d1..84071ab 100644 --- a/ambari-web/app/utils/blueprint.js +++ b/ambari-web/app/utils/blueprint.js @@ -414,8 +414,8 @@ module.exports = { App.SlaveComponent.find().forEach(function (c) { hostsMap = this._generateHostMap(hostsMap, c.get('hostNames'), c.get('componentName')); }, this); - App.HostComponent.find().forEach(function (c) { - hostsMap = this._generateHostMap(hostsMap, [c.get('hostName')], c.get('componentName')); + App.MasterComponent.find().forEach(function (c) { + hostsMap = this._generateHostMap(hostsMap, c.get('hostNames'), c.get('componentName')); }, this); return hostsMap; } http://git-wip-us.apache.org/repos/asf/ambari/blob/78bfef83/ambari-web/test/utils/blueprint_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/utils/blueprint_test.js b/ambari-web/test/utils/blueprint_test.js index 8fa3bcf..5364bb9 100644 --- a/ambari-web/test/utils/blueprint_test.js +++ b/ambari-web/test/utils/blueprint_test.js @@ -401,18 +401,17 @@ describe('utils/blueprint', function() { hostNames: ["host2", "host3"] }) ]); - sinon.stub(App.HostComponent, 'find').returns([ + sinon.stub(App.MasterComponent, 'find').returns([ Em.Object.create({ componentName: "C3", - hostName: "host3", - isMaster: true + hostNames: ["host3"] }) ]); }); afterEach(function() { App.ClientComponent.find.restore(); App.SlaveComponent.find.restore(); - App.HostComponent.find.restore(); + App.MasterComponent.find.restore(); }); it("generate components to host map", function() { @@ -444,4 +443,4 @@ describe('utils/blueprint', function() { }); }); }); -}); \ No newline at end of file +});