ambari git commit: AMBARI-14987: assign_master_component.js does not show recommendations while adding master component for a service which is already installed (mithmatt via jaoki)

2016-02-25 Thread jaoki
Repository: ambari
Updated Branches:
  refs/heads/branch-2.2 a57c458c3 -> b0a714937


AMBARI-14987: assign_master_component.js does not show recommendations while 
adding master component for a service which is already installed (mithmatt via 
jaoki)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/b0a71493
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/b0a71493
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/b0a71493

Branch: refs/heads/branch-2.2
Commit: b0a7149373d48e2c7b4cce06b0b26a6d1c87b0ec
Parents: a57c458
Author: Jun Aoki 
Authored: Thu Feb 25 14:11:54 2016 -0800
Committer: Jun Aoki 
Committed: Thu Feb 25 14:11:54 2016 -0800

--
 ambari-web/app/mixins/wizard/assign_master_components.js  | 10 +++---
 .../test/mixins/wizard/assign_master_components_test.js   |  2 +-
 2 files changed, 4 insertions(+), 8 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/b0a71493/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 62efdac..efcb02e 100644
--- a/ambari-web/app/mixins/wizard/assign_master_components.js
+++ b/ambari-web/app/mixins/wizard/assign_master_components.js
@@ -761,19 +761,15 @@ App.AssignMasterComponents = Em.Mixin.create({
 var hostsForHostGroup = {};
 
 
recommendations.blueprint_cluster_binding.host_groups.forEach(function(hostGroup)
 {
-  hostsForHostGroup[hostGroup.name] = hostGroup.hosts.map(function(host) {
-return host.fqdn;
-  });
+  hostsForHostGroup[hostGroup.name] = hostGroup.hosts.mapProperty('fqdn');
 });
 
 recommendations.blueprint.host_groups.forEach(function (hostGroup) {
-  var components = hostGroup.components.map(function (component) {
-return component.name;
-  });
+  var components = hostGroup.components.mapProperty('name');
   components.forEach(function (componentName) {
 var hostList = recommendedHostsForComponent[componentName] || [];
 var hostNames = hostsForHostGroup[hostGroup.name] || [];
-Array.prototype.push.apply(hostList, hostNames);
+hostList.pushObjects(hostNames);
 recommendedHostsForComponent[componentName] = hostList;
   });
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/b0a71493/ambari-web/test/mixins/wizard/assign_master_components_test.js
--
diff --git a/ambari-web/test/mixins/wizard/assign_master_components_test.js 
b/ambari-web/test/mixins/wizard/assign_master_components_test.js
index a3ffb22..d8ccd66 100644
--- a/ambari-web/test/mixins/wizard/assign_master_components_test.js
+++ b/ambari-web/test/mixins/wizard/assign_master_components_test.js
@@ -93,7 +93,7 @@ describe('App.AssignMasterComponents', function () {
 "c2": ["h1", "h2", "h4"]
   };
 
-  
expect(c.get('content.recommendedHostsForComponents')).to.deep.equal(expected);
+  
expect(JSON.stringify(c.get('content.recommendedHostsForComponents'))).to.equal(JSON.stringify(expected));
 });
   });
 



ambari git commit: AMBARI-14987: assign_master_component.js does not show recommendations while adding master component for a service which is already installed (mithmatt via jaoki)

2016-02-25 Thread jaoki
Repository: ambari
Updated Branches:
  refs/heads/trunk 1df953d68 -> f495bbc02


AMBARI-14987: assign_master_component.js does not show recommendations while 
adding master component for a service which is already installed (mithmatt via 
jaoki)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/f495bbc0
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/f495bbc0
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/f495bbc0

Branch: refs/heads/trunk
Commit: f495bbc02e462981720956b5e61ec102f746728f
Parents: 1df953d
Author: Jun Aoki 
Authored: Thu Feb 25 14:11:19 2016 -0800
Committer: Jun Aoki 
Committed: Thu Feb 25 14:11:19 2016 -0800

--
 ambari-web/app/mixins/wizard/assign_master_components.js  | 10 +++---
 .../test/mixins/wizard/assign_master_components_test.js   |  2 +-
 2 files changed, 4 insertions(+), 8 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/f495bbc0/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 645c996..c1c4d0e 100644
--- a/ambari-web/app/mixins/wizard/assign_master_components.js
+++ b/ambari-web/app/mixins/wizard/assign_master_components.js
@@ -754,19 +754,15 @@ App.AssignMasterComponents = Em.Mixin.create({
 var hostsForHostGroup = {};
 
 
recommendations.blueprint_cluster_binding.host_groups.forEach(function(hostGroup)
 {
-  hostsForHostGroup[hostGroup.name] = hostGroup.hosts.map(function(host) {
-return host.fqdn;
-  });
+  hostsForHostGroup[hostGroup.name] = hostGroup.hosts.mapProperty('fqdn');
 });
 
 recommendations.blueprint.host_groups.forEach(function (hostGroup) {
-  var components = hostGroup.components.map(function (component) {
-return component.name;
-  });
+  var components = hostGroup.components.mapProperty('name');
   components.forEach(function (componentName) {
 var hostList = recommendedHostsForComponent[componentName] || [];
 var hostNames = hostsForHostGroup[hostGroup.name] || [];
-Array.prototype.push.apply(hostList, hostNames);
+hostList.pushObjects(hostNames);
 recommendedHostsForComponent[componentName] = hostList;
   });
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/f495bbc0/ambari-web/test/mixins/wizard/assign_master_components_test.js
--
diff --git a/ambari-web/test/mixins/wizard/assign_master_components_test.js 
b/ambari-web/test/mixins/wizard/assign_master_components_test.js
index a3ffb22..d8ccd66 100644
--- a/ambari-web/test/mixins/wizard/assign_master_components_test.js
+++ b/ambari-web/test/mixins/wizard/assign_master_components_test.js
@@ -93,7 +93,7 @@ describe('App.AssignMasterComponents', function () {
 "c2": ["h1", "h2", "h4"]
   };
 
-  
expect(c.get('content.recommendedHostsForComponents')).to.deep.equal(expected);
+  
expect(JSON.stringify(c.get('content.recommendedHostsForComponents'))).to.equal(JSON.stringify(expected));
 });
   });
 



[11/33] ambari git commit: AMBARI-14987: assign_master_component.js does not show recommendations while adding master component for a service which is already installed (mithmatt via jaoki)

2016-02-18 Thread ncole
AMBARI-14987: assign_master_component.js does not show recommendations while 
adding master component for a service which is already installed (mithmatt via 
jaoki)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/e4800e1c
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/e4800e1c
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/e4800e1c

Branch: refs/heads/branch-dev-patch-upgrade
Commit: e4800e1c97709e8218989080fceb0df406e744ea
Parents: 529c588
Author: Jun Aoki 
Authored: Tue Feb 16 16:43:39 2016 -0800
Committer: Jun Aoki 
Committed: Tue Feb 16 16:43:39 2016 -0800

--
 ambari-web/app/assets/test/tests.js |   1 +
 .../mixins/wizard/assign_master_components.js   |  58 ++-
 .../wizard/assign_master_components_test.js | 154 +++
 3 files changed, 212 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/e4800e1c/ambari-web/app/assets/test/tests.js
--
diff --git a/ambari-web/app/assets/test/tests.js 
b/ambari-web/app/assets/test/tests.js
index 44fb4f4..0695d06 100644
--- a/ambari-web/app/assets/test/tests.js
+++ b/ambari-web/app/assets/test/tests.js
@@ -157,6 +157,7 @@ var files = [
   'test/mixins/main/service/configs/config_overridable_test',
   'test/mixins/routers/redirections_test',
   'test/mixins/wizard/addSeccurityConfigs_test',
+  'test/mixins/wizard/assign_master_components_test',
   'test/mixins/wizard/wizard_menu_view_test',
   'test/mixins/wizard/wizardProgressPageController_test',
   'test/mixins/wizard/wizardEnableDone_test',

http://git-wip-us.apache.org/repos/asf/ambari/blob/e4800e1c/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 a2440a4..645c996 100644
--- a/ambari-web/app/mixins/wizard/assign_master_components.js
+++ b/ambari-web/app/mixins/wizard/assign_master_components.js
@@ -95,6 +95,22 @@ App.AssignMasterComponents = Em.Mixin.create({
   showInstalledMastersFirst: false,
 
   /**
+   * Map of component name to list of hostnames for that component
+   * format:
+   * {
+   *   NAMENODE: [
+   * 'c6401.ambari.apache.org'
+   *   ],
+   *   DATANODE: [
+   * 'c6402.ambari.apache.org',
+   * 'c6403.ambari.apache.org',
+   *   ]
+   * }
+   * @type {Object}
+   */
+  recommendedHostsForComponents: {},
+
+  /**
* Array of servicesMasters objects, that will be shown on the 
page
* Are filtered using mastersToShow
* @type {Array}
@@ -731,7 +747,31 @@ App.AssignMasterComponents = Em.Mixin.create({
* @method loadRecommendationsSuccessCallback
*/
   loadRecommendationsSuccessCallback: function (data) {
-this.set('content.recommendations', data.resources[0].recommendations);
+var recommendations = data.resources[0].recommendations;
+this.set('content.recommendations', recommendations);
+
+var recommendedHostsForComponent = {};
+var hostsForHostGroup = {};
+
+
recommendations.blueprint_cluster_binding.host_groups.forEach(function(hostGroup)
 {
+  hostsForHostGroup[hostGroup.name] = hostGroup.hosts.map(function(host) {
+return host.fqdn;
+  });
+});
+
+recommendations.blueprint.host_groups.forEach(function (hostGroup) {
+  var components = hostGroup.components.map(function (component) {
+return component.name;
+  });
+  components.forEach(function (componentName) {
+var hostList = recommendedHostsForComponent[componentName] || [];
+var hostNames = hostsForHostGroup[hostGroup.name] || [];
+Array.prototype.push.apply(hostList, hostNames);
+recommendedHostsForComponent[componentName] = hostList;
+  });
+});
+
+this.set('content.recommendedHostsForComponents', 
recommendedHostsForComponent);
   },
 
   /**
@@ -817,6 +857,21 @@ App.AssignMasterComponents = Em.Mixin.create({
* @returns {*}
*/
   getHostForMaster: function (master, allMasters) {
+var masterHostList = [];
+
+allMasters.forEach(function (component) {
+  if (component.component_name === master) {
+masterHostList.push(component.selectedHost);
+  }
+});
+
+var recommendedHostsForMaster = 
this.get('content.recommendedHostsForComponents')[master] || [];
+for (var k = 0; k < recommendedHostsForMaster.length; k++) {
+  if(!masterHostList.contains(recommendedHostsForMaster[k])) {
+return recommendedHostsForMaster[k];
+  }
+}
+
 var usedHosts = allMasters.filterProperty('component_name', 
master).mapProperty('selectedHost');
 var allHosts = this.get('hosts');
 for (var

ambari git commit: AMBARI-14987: assign_master_component.js does not show recommendations while adding master component for a service which is already installed (mithmatt via jaoki)

2016-02-16 Thread jaoki
Repository: ambari
Updated Branches:
  refs/heads/trunk 529c588ad -> e4800e1c9


AMBARI-14987: assign_master_component.js does not show recommendations while 
adding master component for a service which is already installed (mithmatt via 
jaoki)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/e4800e1c
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/e4800e1c
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/e4800e1c

Branch: refs/heads/trunk
Commit: e4800e1c97709e8218989080fceb0df406e744ea
Parents: 529c588
Author: Jun Aoki 
Authored: Tue Feb 16 16:43:39 2016 -0800
Committer: Jun Aoki 
Committed: Tue Feb 16 16:43:39 2016 -0800

--
 ambari-web/app/assets/test/tests.js |   1 +
 .../mixins/wizard/assign_master_components.js   |  58 ++-
 .../wizard/assign_master_components_test.js | 154 +++
 3 files changed, 212 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/e4800e1c/ambari-web/app/assets/test/tests.js
--
diff --git a/ambari-web/app/assets/test/tests.js 
b/ambari-web/app/assets/test/tests.js
index 44fb4f4..0695d06 100644
--- a/ambari-web/app/assets/test/tests.js
+++ b/ambari-web/app/assets/test/tests.js
@@ -157,6 +157,7 @@ var files = [
   'test/mixins/main/service/configs/config_overridable_test',
   'test/mixins/routers/redirections_test',
   'test/mixins/wizard/addSeccurityConfigs_test',
+  'test/mixins/wizard/assign_master_components_test',
   'test/mixins/wizard/wizard_menu_view_test',
   'test/mixins/wizard/wizardProgressPageController_test',
   'test/mixins/wizard/wizardEnableDone_test',

http://git-wip-us.apache.org/repos/asf/ambari/blob/e4800e1c/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 a2440a4..645c996 100644
--- a/ambari-web/app/mixins/wizard/assign_master_components.js
+++ b/ambari-web/app/mixins/wizard/assign_master_components.js
@@ -95,6 +95,22 @@ App.AssignMasterComponents = Em.Mixin.create({
   showInstalledMastersFirst: false,
 
   /**
+   * Map of component name to list of hostnames for that component
+   * format:
+   * {
+   *   NAMENODE: [
+   * 'c6401.ambari.apache.org'
+   *   ],
+   *   DATANODE: [
+   * 'c6402.ambari.apache.org',
+   * 'c6403.ambari.apache.org',
+   *   ]
+   * }
+   * @type {Object}
+   */
+  recommendedHostsForComponents: {},
+
+  /**
* Array of servicesMasters objects, that will be shown on the 
page
* Are filtered using mastersToShow
* @type {Array}
@@ -731,7 +747,31 @@ App.AssignMasterComponents = Em.Mixin.create({
* @method loadRecommendationsSuccessCallback
*/
   loadRecommendationsSuccessCallback: function (data) {
-this.set('content.recommendations', data.resources[0].recommendations);
+var recommendations = data.resources[0].recommendations;
+this.set('content.recommendations', recommendations);
+
+var recommendedHostsForComponent = {};
+var hostsForHostGroup = {};
+
+
recommendations.blueprint_cluster_binding.host_groups.forEach(function(hostGroup)
 {
+  hostsForHostGroup[hostGroup.name] = hostGroup.hosts.map(function(host) {
+return host.fqdn;
+  });
+});
+
+recommendations.blueprint.host_groups.forEach(function (hostGroup) {
+  var components = hostGroup.components.map(function (component) {
+return component.name;
+  });
+  components.forEach(function (componentName) {
+var hostList = recommendedHostsForComponent[componentName] || [];
+var hostNames = hostsForHostGroup[hostGroup.name] || [];
+Array.prototype.push.apply(hostList, hostNames);
+recommendedHostsForComponent[componentName] = hostList;
+  });
+});
+
+this.set('content.recommendedHostsForComponents', 
recommendedHostsForComponent);
   },
 
   /**
@@ -817,6 +857,21 @@ App.AssignMasterComponents = Em.Mixin.create({
* @returns {*}
*/
   getHostForMaster: function (master, allMasters) {
+var masterHostList = [];
+
+allMasters.forEach(function (component) {
+  if (component.component_name === master) {
+masterHostList.push(component.selectedHost);
+  }
+});
+
+var recommendedHostsForMaster = 
this.get('content.recommendedHostsForComponents')[master] || [];
+for (var k = 0; k < recommendedHostsForMaster.length; k++) {
+  if(!masterHostList.contains(recommendedHostsForMaster[k])) {
+return recommendedHostsForMaster[k];
+  }
+}
+
 var usedHosts = allMasters.filterProperty('component_name', 
master).mapProperty('select

ambari git commit: AMBARI-14987: assign_master_component.js does not show recommendations while adding master component for a service which is already installed (mithmatt via jaoki)

2016-02-16 Thread jaoki
Repository: ambari
Updated Branches:
  refs/heads/branch-2.2 2daca3ca6 -> 94129bbc8


AMBARI-14987: assign_master_component.js does not show recommendations while 
adding master component for a service which is already installed (mithmatt via 
jaoki)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/94129bbc
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/94129bbc
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/94129bbc

Branch: refs/heads/branch-2.2
Commit: 94129bbc8289647c3e1b9e0d21d84f5d156d13ca
Parents: 2daca3c
Author: Jun Aoki 
Authored: Tue Feb 16 16:42:32 2016 -0800
Committer: Jun Aoki 
Committed: Tue Feb 16 16:42:32 2016 -0800

--
 ambari-web/app/assets/test/tests.js |   1 +
 .../mixins/wizard/assign_master_components.js   |  58 ++-
 .../wizard/assign_master_components_test.js | 154 +++
 3 files changed, 212 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/94129bbc/ambari-web/app/assets/test/tests.js
--
diff --git a/ambari-web/app/assets/test/tests.js 
b/ambari-web/app/assets/test/tests.js
index 9d5cbc1..25c3f43 100644
--- a/ambari-web/app/assets/test/tests.js
+++ b/ambari-web/app/assets/test/tests.js
@@ -157,6 +157,7 @@ var files = ['test/init_model_test',
   'test/mixins/main/service/configs/widget_popover_support_test',
   'test/mixins/routers/redirections_test',
   'test/mixins/wizard/addSeccurityConfigs_test',
+  'test/mixins/wizard/assign_master_components_test',
   'test/mixins/wizard/wizard_menu_view_test',
   'test/mixins/wizard/wizardProgressPageController_test',
   'test/mixins/wizard/wizardEnableDone_test',

http://git-wip-us.apache.org/repos/asf/ambari/blob/94129bbc/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 f6d1b1a..62efdac 100644
--- a/ambari-web/app/mixins/wizard/assign_master_components.js
+++ b/ambari-web/app/mixins/wizard/assign_master_components.js
@@ -95,6 +95,22 @@ App.AssignMasterComponents = Em.Mixin.create({
   showInstalledMastersFirst: false,
 
   /**
+   * Map of component name to list of hostnames for that component
+   * format:
+   * {
+   *   NAMENODE: [
+   * 'c6401.ambari.apache.org'
+   *   ],
+   *   DATANODE: [
+   * 'c6402.ambari.apache.org',
+   * 'c6403.ambari.apache.org',
+   *   ]
+   * }
+   * @type {Object}
+   */
+  recommendedHostsForComponents: {},
+
+  /**
* Array of servicesMasters objects, that will be shown on the 
page
* Are filtered using mastersToShow
* @type {Array}
@@ -738,7 +754,31 @@ App.AssignMasterComponents = Em.Mixin.create({
* @method loadRecommendationsSuccessCallback
*/
   loadRecommendationsSuccessCallback: function (data) {
-this.set('content.recommendations', data.resources[0].recommendations);
+var recommendations = data.resources[0].recommendations;
+this.set('content.recommendations', recommendations);
+
+var recommendedHostsForComponent = {};
+var hostsForHostGroup = {};
+
+
recommendations.blueprint_cluster_binding.host_groups.forEach(function(hostGroup)
 {
+  hostsForHostGroup[hostGroup.name] = hostGroup.hosts.map(function(host) {
+return host.fqdn;
+  });
+});
+
+recommendations.blueprint.host_groups.forEach(function (hostGroup) {
+  var components = hostGroup.components.map(function (component) {
+return component.name;
+  });
+  components.forEach(function (componentName) {
+var hostList = recommendedHostsForComponent[componentName] || [];
+var hostNames = hostsForHostGroup[hostGroup.name] || [];
+Array.prototype.push.apply(hostList, hostNames);
+recommendedHostsForComponent[componentName] = hostList;
+  });
+});
+
+this.set('content.recommendedHostsForComponents', 
recommendedHostsForComponent);
   },
 
   /**
@@ -820,6 +860,21 @@ App.AssignMasterComponents = Em.Mixin.create({
* @returns {*}
*/
   getHostForMaster: function (master, allMasters) {
+var masterHostList = [];
+
+allMasters.forEach(function (component) {
+  if (component.component_name === master) {
+masterHostList.push(component.selectedHost);
+  }
+});
+
+var recommendedHostsForMaster = 
this.get('content.recommendedHostsForComponents')[master] || [];
+for (var k = 0; k < recommendedHostsForMaster.length; k++) {
+  if(!masterHostList.contains(recommendedHostsForMaster[k])) {
+return recommendedHostsForMaster[k];
+  }
+}
+
 var usedHosts = allMasters.filterProperty('componen