ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexantone...@apache.org
Subject [1/3] ambari git commit: AMBARI-13892. SLAVE component with cardinality 0+ gets auto-selected
Date Fri, 13 Nov 2015 18:33:54 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk a75e81c31 -> 883c77f1f


AMBARI-13892. SLAVE component with cardinality 0+ gets auto-selected


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

Branch: refs/heads/trunk
Commit: 883c77f1f60b8e23113f854a69d5641247aa88b7
Parents: 68a31b2
Author: Alex Antonenko <hiveww@gmail.com>
Authored: Fri Nov 13 20:09:09 2015 +0200
Committer: Alex Antonenko <hiveww@gmail.com>
Committed: Fri Nov 13 20:33:48 2015 +0200

----------------------------------------------------------------------
 .../controllers/main/service/add_controller.js  | 88 +-------------------
 1 file changed, 3 insertions(+), 85 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/883c77f1/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 2a12bc2..53b9db5 100644
--- a/ambari-web/app/controllers/main/service/add_controller.js
+++ b/ambari-web/app/controllers/main/service/add_controller.js
@@ -109,7 +109,8 @@ App.AddServiceController = App.WizardController.extend(App.AddSecurityConfigs,
{
           this.loadHosts().done(function () {
             self.loadServices();
             self.loadClients();
-            self.loadSlaveComponentHosts();//depends on loadServices
+            if(self.get("content.slaveComponentHosts.length"))
+              self.loadSlaveComponentHosts();//depends on loadServices
             dfd.resolve();
           });
           return dfd.promise();
@@ -334,96 +335,13 @@ 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 (stepController) {
+  saveClients: function () {
     var clients = [];
     var serviceComponents = App.StackServiceComponent.find();
     this.get('content.services').filterProperty('isSelected').filterProperty('isInstalled',false).forEach(function
(_service) {


Mime
View raw message