AMBARI-7059. FE: Adding Sqoop service right after install doesnt auto-select Client. (Max Shepel via akovalenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/f2f5dff2 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/f2f5dff2 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/f2f5dff2 Branch: refs/heads/branch-alerts-dev Commit: f2f5dff25143545c6ab542ab0d62c7fc61ea418a Parents: 6bd0394 Author: Aleksandr Kovalenko <akovale...@hortonworks.com> Authored: Thu Aug 28 18:09:43 2014 +0300 Committer: Aleksandr Kovalenko <akovale...@hortonworks.com> Committed: Thu Aug 28 18:09:43 2014 +0300 ---------------------------------------------------------------------- .../controllers/main/service/add_controller.js | 24 +++++++++++--------- .../app/controllers/wizard/step8_controller.js | 12 ++++++---- ambari-web/app/routes/add_host_routes.js | 2 ++ ambari-web/app/routes/add_service_routes.js | 2 ++ ambari-web/app/routes/installer.js | 2 ++ .../main/service/add_controller_test.js | 10 ++++++++ 6 files changed, 36 insertions(+), 16 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/f2f5dff2/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 52bd41b..cce1f5f 100644 --- a/ambari-web/app/controllers/main/service/add_controller.js +++ b/ambari-web/app/controllers/main/service/add_controller.js @@ -391,18 +391,20 @@ App.AddServiceController = App.WizardController.extend({ */ installAdditionalClients: function () { this.get('content.additionalClients').forEach(function (c) { - var queryStr = 'HostRoles/component_name='+ c.componentName + '&HostRoles/host_name.in(' + c.hostNames.join() + ')'; - App.ajax.send({ - name: 'common.host_component.update', - sender: this, - data: { - query: queryStr, - context: 'Install ' + App.format.role(c.componentName), - HostRoles: { - state: 'INSTALLED' + if (c.hostNames.length > 0) { + var queryStr = 'HostRoles/component_name='+ c.componentName + '&HostRoles/host_name.in(' + c.hostNames.join() + ')'; + App.ajax.send({ + name: 'common.host_component.update', + sender: this, + data: { + query: queryStr, + context: 'Install ' + App.format.role(c.componentName), + HostRoles: { + state: 'INSTALLED' + } } - } - }); + }); + } }, this); } }); http://git-wip-us.apache.org/repos/asf/ambari/blob/f2f5dff2/ambari-web/app/controllers/wizard/step8_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/wizard/step8_controller.js b/ambari-web/app/controllers/wizard/step8_controller.js index 7eef55e..4396432 100644 --- a/ambari-web/app/controllers/wizard/step8_controller.js +++ b/ambari-web/app/controllers/wizard/step8_controller.js @@ -1285,11 +1285,13 @@ App.WizardStep8Controller = Em.Controller.extend(App.AddSecurityConfigs, { }, this); }, this); hostNames = hostNames.uniq(); - this.get('content.additionalClients').pushObject({hostNames: hostNames, componentName: _clientName}); - // If a dependency for being co-hosted is derived between existing client and selected new master but that - // dependency is already satisfied in the cluster then disregard the derived dependency - this.removeClientsFromList(_clientName, hostNames); - this.registerHostsToComponent(hostNames, _clientName); + if (hostNames.length > 0) { + this.get('content.additionalClients').pushObject({hostNames: hostNames, componentName: _clientName}); + // If a dependency for being co-hosted is derived between existing client and selected new master but that + // dependency is already satisfied in the cluster then disregard the derived dependency + this.removeClientsFromList(_clientName, hostNames); + this.registerHostsToComponent(hostNames, _clientName); + } } }, this); }, http://git-wip-us.apache.org/repos/asf/ambari/blob/f2f5dff2/ambari-web/app/routes/add_host_routes.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/routes/add_host_routes.js b/ambari-web/app/routes/add_host_routes.js index e4ae41f..ff281a9 100644 --- a/ambari-web/app/routes/add_host_routes.js +++ b/ambari-web/app/routes/add_host_routes.js @@ -154,11 +154,13 @@ module.exports = App.WizardRoute.extend({ next: function (router, context) { var addHostController = router.get('addHostController'); var wizardStep3Controller = router.get('wizardStep3Controller'); + var wizardStep6Controller = router.get('wizardStep6Controller'); addHostController.saveConfirmedHosts(wizardStep3Controller); addHostController.saveClients(); addHostController.setDBProperty('bootStatus', true); addHostController.setDBProperty('slaveComponentHosts', undefined); + wizardStep6Controller.set('isClientsSet', false); router.transitionTo('step3'); }, /** http://git-wip-us.apache.org/repos/asf/ambari/blob/f2f5dff2/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 45b28b7..4e4b83e 100644 --- a/ambari-web/app/routes/add_service_routes.js +++ b/ambari-web/app/routes/add_service_routes.js @@ -137,8 +137,10 @@ module.exports = App.WizardRoute.extend({ next: function (router) { var addServiceController = router.get('addServiceController'); var wizardStep5Controller = router.get('wizardStep5Controller'); + var wizardStep6Controller = router.get('wizardStep6Controller'); addServiceController.saveMasterComponentHosts(wizardStep5Controller); addServiceController.setDBProperty('slaveComponentHosts', undefined); + wizardStep6Controller.set('isClientsSet', false); router.transitionTo('step3'); } }), http://git-wip-us.apache.org/repos/asf/ambari/blob/f2f5dff2/ambari-web/app/routes/installer.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/routes/installer.js b/ambari-web/app/routes/installer.js index fa10e6b..0ca109a 100644 --- a/ambari-web/app/routes/installer.js +++ b/ambari-web/app/routes/installer.js @@ -272,9 +272,11 @@ module.exports = Em.Route.extend({ next: function (router) { var controller = router.get('installerController'); var wizardStep5Controller = router.get('wizardStep5Controller'); + var wizardStep6Controller = router.get('wizardStep6Controller'); controller.saveMasterComponentHosts(wizardStep5Controller); controller.setDBProperty('slaveComponentHosts', undefined); controller.setDBProperty('recommendations', wizardStep5Controller.get('content.recommendations')); + wizardStep6Controller.set('isClientsSet', false); router.transitionTo('step6'); } }), http://git-wip-us.apache.org/repos/asf/ambari/blob/f2f5dff2/ambari-web/test/controllers/main/service/add_controller_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/controllers/main/service/add_controller_test.js b/ambari-web/test/controllers/main/service/add_controller_test.js index 3e9b2cc..b56a875 100644 --- a/ambari-web/test/controllers/main/service/add_controller_test.js +++ b/ambari-web/test/controllers/main/service/add_controller_test.js @@ -34,6 +34,10 @@ describe('App.AddServiceController', function() { componentName: "TEZ_CLIENT", hostNames: ["hostName1", "hostName2"] }, + additionalClientsWithoutHosts: { + componentName: "TEZ_CLIENT", + hostNames: [] + }, RequestInfo: { "context": Em.I18n.t('requestInfo.installHostComponent') + ' ' + App.format.role("TEZ_CLIENT"), "query": "HostRoles/component_name=TEZ_CLIENT&HostRoles/host_name.in(hostName1,hostName2)" @@ -66,6 +70,12 @@ describe('App.AddServiceController', function() { expect(JSON.parse($.ajax.args[0][0].data).Body).to.deep.eql(t.Body); expect(JSON.parse($.ajax.args[0][0].data).RequestInfo).to.eql(t.RequestInfo); }); + + it('should not send request to install client', function () { + addServiceController.set("content.additionalClients", [t.additionalClientsWithoutHosts]); + expect($.ajax.called).to.be.false; + }); + }); });