You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by nc...@apache.org on 2015/11/18 17:50:59 UTC
[03/50] [abbrv] ambari git commit: Revert "AMBARI-13892. SLAVE
component with cardinality 0+ gets auto-selected"
Revert "AMBARI-13892. SLAVE component with cardinality 0+ gets auto-selected"
This reverts commit a4fb85309ec24c0889ae11079fd9784aa31bdd9b.
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/b6b812c1
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/b6b812c1
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/b6b812c1
Branch: refs/heads/branch-dev-patch-upgrade
Commit: b6b812c1199278e252df95b1a9a2604d8ec61b9a
Parents: 946fe25
Author: Jaimin Jetly <ja...@hortonworks.com>
Authored: Mon Nov 16 14:50:07 2015 -0800
Committer: Jaimin Jetly <ja...@hortonworks.com>
Committed: Mon Nov 16 14:53:51 2015 -0800
----------------------------------------------------------------------
.../controllers/main/service/add_controller.js | 88 +++++++++++++++++++-
1 file changed, 85 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/b6b812c1/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 53b9db5..2a12bc2 100644
--- a/ambari-web/app/controllers/main/service/add_controller.js
+++ b/ambari-web/app/controllers/main/service/add_controller.js
@@ -109,8 +109,7 @@ App.AddServiceController = App.WizardController.extend(App.AddSecurityConfigs, {
this.loadHosts().done(function () {
self.loadServices();
self.loadClients();
- if(self.get("content.slaveComponentHosts.length"))
- self.loadSlaveComponentHosts();//depends on loadServices
+ self.loadSlaveComponentHosts();//depends on loadServices
dfd.resolve();
});
return dfd.promise();
@@ -335,13 +334,96 @@ App.AddServiceController = App.WizardController.extend(App.AddSecurityConfigs, {
});
});
}
+ if (!slaveComponentHosts) {
+ slaveComponentHosts = this.getSlaveComponentHosts();
+ }
this.set("content.slaveComponentHosts", slaveComponentHosts);
},
/**
+ * return slaveComponents bound to hosts
+ * @return {Array}
+ */
+ getSlaveComponentHosts: function () {
+ var components = this.get('slaveComponents');
+ var result = [];
+ var installedServices = App.Service.find().mapProperty('serviceName');
+ var selectedServices = this.get('content.services').filterProperty('isSelected', true).mapProperty('serviceName');
+ var installedComponentsMap = {};
+ var uninstalledComponents = [];
+ var hosts = this.getDBProperty('hosts') || this.get('content.hosts');
+ var masterComponents = App.get('components.masters');
+ var nonMasterComponentHosts = [];
+
+ components.forEach(function (component) {
+ if (installedServices.contains(component.get('serviceName'))) {
+ installedComponentsMap[component.get('componentName')] = [];
+ } else if (selectedServices.contains(component.get('serviceName'))) {
+ uninstalledComponents.push(component);
+ }
+ }, this);
+
+ for (var hostName in hosts) {
+ if (hosts[hostName].isInstalled) {
+ var isMasterComponentHosted = false;
+ hosts[hostName].hostComponents.forEach(function (component) {
+ if (installedComponentsMap[component.HostRoles.component_name]) {
+ installedComponentsMap[component.HostRoles.component_name].push(hostName);
+ }
+ if (masterComponents.contains(component.HostRoles.component_name)) {
+ isMasterComponentHosted = true;
+ }
+ }, this);
+ if (!isMasterComponentHosted) {
+ nonMasterComponentHosts.push(hostName);
+ }
+ }
+ }
+
+ for (var componentName in installedComponentsMap) {
+ var component = {
+ componentName: componentName,
+ displayName: App.format.role(componentName),
+ hosts: [],
+ isInstalled: true
+ };
+ installedComponentsMap[componentName].forEach(function (hostName) {
+ component.hosts.push({
+ group: "Default",
+ hostName: hostName,
+ isInstalled: true
+ });
+ }, this);
+ result.push(component);
+ }
+
+ if (!nonMasterComponentHosts.length) {
+ nonMasterComponentHosts.push(Object.keys(hosts)[0]);
+ }
+ var uninstalledComponentHosts = nonMasterComponentHosts.map(function(_hostName){
+ return {
+ group: "Default",
+ hostName: _hostName,
+ isInstalled: false
+ }
+ });
+ uninstalledComponents.forEach(function (component) {
+ result.push({
+ componentName: component.get('componentName'),
+ displayName: App.format.role(component.get('componentName')),
+ hosts: uninstalledComponentHosts,
+ isInstalled: false
+ })
+ });
+
+ return result;
+ },
+
+ /**
* Generate clients list for selected services and save it to model
+ * @param stepController step4WizardController
*/
- saveClients: function () {
+ saveClients: function (stepController) {
var clients = [];
var serviceComponents = App.StackServiceComponent.find();
this.get('content.services').filterProperty('isSelected').filterProperty('isInstalled',false).forEach(function (_service) {