You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by at...@apache.org on 2019/01/31 13:05:58 UTC

[ambari] branch branch-2.7 updated: AMBARI-25052 Unable to Add Services Due to toMapByProperty()

This is an automated email from the ASF dual-hosted git repository.

atkach pushed a commit to branch branch-2.7
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/branch-2.7 by this push:
     new cae21ed  AMBARI-25052 Unable to Add Services Due to toMapByProperty()
cae21ed is described below

commit cae21ed69763612560e8a3a280b250db874c93dd
Author: Andrii Tkach <at...@apache.org>
AuthorDate: Wed Dec 19 10:40:23 2018 +0200

    AMBARI-25052 Unable to Add Services Due to toMapByProperty()
---
 ambari-web/app/controllers/main/service/add_controller.js | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/ambari-web/app/controllers/main/service/add_controller.js b/ambari-web/app/controllers/main/service/add_controller.js
index 1100417..2f3e664 100644
--- a/ambari-web/app/controllers/main/service/add_controller.js
+++ b/ambari-web/app/controllers/main/service/add_controller.js
@@ -233,12 +233,11 @@ App.AddServiceController = App.WizardController.extend(App.AddSecurityConfigs, {
    * @param stepController App.WizardStep5Controller
    */
   saveMasterComponentHosts: function (stepController) {
-    var obj = stepController.get('selectedServicesMasters');
     var masterComponentHosts = [];
-    var installedComponents = App.HostComponent.find();
+    var installedComponentsMap = App.HostComponent.find().toArray().toMapByProperty('componentName');
 
-    obj.forEach(function (_component) {
-      var installedComponent = installedComponents.findProperty('componentName', _component.component_name);
+    stepController.get('selectedServicesMasters').forEach(function (_component) {
+      var installedComponent = installedComponentsMap[_component.component_name];
       masterComponentHosts.push({
         display_name: _component.display_name,
         component: _component.component_name,
@@ -252,7 +251,7 @@ App.AddServiceController = App.WizardController.extend(App.AddSecurityConfigs, {
     this.setDBProperty('masterComponentHosts', masterComponentHosts);
     this.set('content.masterComponentHosts', masterComponentHosts);
 
-    this.set('content.skipMasterStep', this.get('content.masterComponentHosts').everyProperty('isInstalled', true));
+    this.set('content.skipMasterStep', masterComponentHosts.everyProperty('isInstalled', true));
     this.get('isStepDisabled').findProperty('step', 2).set('value', this.get('content.skipMasterStep'));
   },