AMBARI-11533. Add Host Wizard Configuration Page confusing with duplicate HDFS lines (alexantonenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/f4db0142 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/f4db0142 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/f4db0142 Branch: refs/heads/trunk Commit: f4db0142840e1948005fd57dba4d9736600cf7d6 Parents: e5339f3 Author: Alex Antonenko <[email protected]> Authored: Fri May 29 18:10:54 2015 +0300 Committer: Alex Antonenko <[email protected]> Committed: Fri May 29 22:30:04 2015 +0300 ---------------------------------------------------------------------- .../app/controllers/main/host/add_controller.js | 23 ++++++++++++-------- .../main/host/add_controller_test.js | 11 ++++++++-- 2 files changed, 23 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/f4db0142/ambari-web/app/controllers/main/host/add_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/host/add_controller.js b/ambari-web/app/controllers/main/host/add_controller.js index 39e1def..3f2c0f9 100644 --- a/ambari-web/app/controllers/main/host/add_controller.js +++ b/ambari-web/app/controllers/main/host/add_controller.js @@ -122,7 +122,7 @@ App.AddHostController = App.WizardController.extend({ this.set('content.services', App.StackService.find()); }, - /** + /** * Load slave component hosts data for using in required step controllers * TODO move to mixin */ @@ -264,15 +264,20 @@ App.AddHostController = App.WizardController.extend({ var configGroups = this.get('content.configGroups').filterProperty('ConfigGroup.tag', serviceName); var configGroupsNames = configGroups.mapProperty('ConfigGroup.group_name'); var defaultGroupName = service.get('displayName') + ' Default'; + var selectedService = selectedServices.findProperty('serviceId', serviceName); configGroupsNames.unshift(defaultGroupName); - selectedServices.push({ - serviceId: serviceName, - displayName: service.get('displayName'), - hosts: slave.hosts.mapProperty('hostName'), - configGroupsNames: configGroupsNames, - configGroups: configGroups, - selectedConfigGroup: defaultGroupName - }); + if (selectedService) { + Em.set(selectedService, 'hosts', Em.getWithDefault(selectedService, 'hosts', []).concat(slave.hosts.mapProperty('hostName')).uniq()); + } else { + selectedServices.push({ + serviceId: serviceName, + displayName: service.get('displayName'), + hosts: slave.hosts.mapProperty('hostName'), + configGroupsNames: configGroupsNames, + configGroups: configGroups, + selectedConfigGroup: defaultGroupName + }); + } } } }, this); http://git-wip-us.apache.org/repos/asf/ambari/blob/f4db0142/ambari-web/test/controllers/main/host/add_controller_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/controllers/main/host/add_controller_test.js b/ambari-web/test/controllers/main/host/add_controller_test.js index 4333e08..826a415 100644 --- a/ambari-web/test/controllers/main/host/add_controller_test.js +++ b/ambari-web/test/controllers/main/host/add_controller_test.js @@ -912,15 +912,22 @@ describe('App.AddHostController', function () { {hostName: 'host1'} ], componentName: 'C1' + }, + { + hosts: [ + {hostName: 'host2'} + ], + componentName: 'C2' } ]); expect(controller.loadServiceConfigGroupsBySlaves(selectedServices)).to.be.true; - expect(selectedServices).to.eql([ + expect(selectedServices.toArray()).to.eql([ { "serviceId": "S1", "displayName": "s1", "hosts": [ - "host1" + "host1", + "host2" ], "configGroupsNames": [ "s1 Default",
