Ver Fonte

AMBARI-7182. HDFS should be successfully added on storm+zk cluster. (jaimin)

Jaimin Jetly há 10 anos atrás
pai
commit
5986ad5fc5
1 ficheiros alterados com 20 adições e 3 exclusões
  1. 20 3
      ambari-web/app/controllers/main/service/add_controller.js

+ 20 - 3
ambari-web/app/controllers/main/service/add_controller.js

@@ -241,6 +241,8 @@ App.AddServiceController = App.WizardController.extend({
     var installedComponentsMap = {};
     var uninstalledComponents = [];
     var hosts = this.get('content.hosts');
+    var masterComponents = App.get('components.masters');
+    var nonMasterComponentHosts = [];
 
     components.forEach(function (component) {
       if (installedServices.contains(component.get('serviceName'))) {
@@ -252,11 +254,18 @@ App.AddServiceController = App.WizardController.extend({
 
     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);
+        }
       }
     }
 
@@ -277,13 +286,21 @@ App.AddServiceController = App.WizardController.extend({
       result.push(component);
     }
 
+    if (!nonMasterComponentHosts.length) {
+      nonMasterComponentHosts.push(Object.keys(this.get('content.hosts'))[0]);
+    }
+    var uninstalledComponentHosts =  nonMasterComponentHosts.map(function(_hostName){
+      return {
+        group: "Default",
+        hostName: _hostName,
+        isInstalled: false
+      }
+    });
     uninstalledComponents.forEach(function (component) {
-      var hosts = jQuery.extend(true, [], result.findProperty('componentName', 'DATANODE').hosts);
-      hosts.setEach('isInstalled', false);
       result.push({
         componentName: component.get('componentName'),
         displayName: App.format.role(component.get('componentName')),
-        hosts: hosts,
+        hosts: uninstalledComponentHosts,
         isInstalled: false
       })
     });