You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by jg...@apache.org on 2018/06/15 19:09:03 UTC

[ambari] branch branch-feature-AMBARI-14714-mpack-advisor updated: [AMBARI-24115] Install all services and start all services with a single request each

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

jgolieb pushed a commit to branch branch-feature-AMBARI-14714-mpack-advisor
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/branch-feature-AMBARI-14714-mpack-advisor by this push:
     new 8de12f5  [AMBARI-24115] Install all services and start all services with a single request each
8de12f5 is described below

commit 8de12f50ed831cdbd75c6868831f746568c3c7a9
Author: Jason Golieb <jg...@hortonworks.com>
AuthorDate: Fri Jun 15 11:34:18 2018 -0400

    [AMBARI-24115] Install all services and start all services with a single request each
---
 ambari-web/app/controllers/wizard.js               | 22 ++++-------
 .../app/controllers/wizard/step9_controller.js     | 44 +++++++---------------
 ambari-web/app/utils/ajax/ajax.js                  |  3 +-
 ambari-web/test/controllers/wizard_test.js         |  3 +-
 4 files changed, 24 insertions(+), 48 deletions(-)

diff --git a/ambari-web/app/controllers/wizard.js b/ambari-web/app/controllers/wizard.js
index 01d150b..ca5891f 100644
--- a/ambari-web/app/controllers/wizard.js
+++ b/ambari-web/app/controllers/wizard.js
@@ -553,21 +553,13 @@ App.WizardController = Em.Controller.extend(App.LocalStorage, App.ThemesMappingM
     };
     this.saveClusterStatus(clusterStatus);
 
-    const serviceGroups = this.get('content.serviceGroups');
-    
-    const installPromises = serviceGroups.map(sg => {
-      data.serviceGroupName = sg;
-
-      return App.ajax.send({
-        name: isRetry ? 'common.host_components.update' : 'common.services.update',
-        sender: this,
-        data: data,
-        success: 'installServicesSuccessCallback',
-        error: 'installServicesErrorCallback'
-      })
-    })
-
-    $.when(...installPromises).then(callback, callback);
+    return App.ajax.send({
+      name: isRetry ? 'common.host_components.update' : 'common.services.update.all',
+      sender: this,
+      data: data,
+      success: 'installServicesSuccessCallback',
+      error: 'installServicesErrorCallback'
+    }).then(callback, callback);
   },
 
   installServicesSuccessCallback: function (jsonData) {
diff --git a/ambari-web/app/controllers/wizard/step9_controller.js b/ambari-web/app/controllers/wizard/step9_controller.js
index 6e87ad6..99455e4 100644
--- a/ambari-web/app/controllers/wizard/step9_controller.js
+++ b/ambari-web/app/controllers/wizard/step9_controller.js
@@ -508,7 +508,6 @@ App.WizardStep9Controller = App.WizardStepController.extend(App.ReloadPopupMixin
           success: 'launchStartServicesSuccessCallback',
           error: 'launchStartServicesErrorCallback'
         }).then(callback, callback);
-        break;
       case 'addServiceController':
         var servicesList = this.get('content.services').filterProperty('isSelected').filterProperty('isInstalled', false).mapProperty('serviceName');
         if (servicesList.contains('OOZIE')) {
@@ -520,21 +519,13 @@ App.WizardStep9Controller = App.WizardStepController.extend(App.ReloadPopupMixin
           "urlParams": "ServiceInfo/state=INSTALLED&ServiceInfo/service_name.in(" + servicesList.join(",") + ")&params/run_smoke_test=true&params/reconfigure_client=false"
         };
 
-        serviceGroups = this.get('content.serviceGroups');
-        promises = serviceGroups.map(sg => {
-          data.serviceGroupName = sg;
-
-          return App.ajax.send({
-            name: 'common.services.update', //TODO: This should change to use common.services.update.all when that is implemented on the back end.
-            sender: this,
-            data: data,
-            success: 'launchStartServicesSuccessCallback',
-            error: 'launchStartServicesErrorCallback'
-          })
-        })
-
-        return $.when(...promises).then(callback, callback);
-        break;
+        return App.ajax.send({
+          name: 'common.services.update.all',
+          sender: this,
+          data: data,
+          success: 'launchStartServicesSuccessCallback',
+          error: 'launchStartServicesErrorCallback'
+        }).then(callback, callback);
       default:
         data = {
           "context": Em.I18n.t("requestInfo.startServices"),
@@ -542,20 +533,13 @@ App.WizardStep9Controller = App.WizardStepController.extend(App.ReloadPopupMixin
           "urlParams": "ServiceInfo/state=INSTALLED&params/run_smoke_test=" + !this.get('skipServiceChecks') + "&params/reconfigure_client=false"
         };
 
-        serviceGroups = this.get('content.serviceGroups');
-        promises = serviceGroups.map(sg => {
-          data.serviceGroupName = sg;
-
-          return App.ajax.send({
-            name: 'common.services.update', //TODO: This should change to use common.services.update.all when that is implemented on the back end.
-            sender: this,
-            data: data,
-            success: 'launchStartServicesSuccessCallback',
-            error: 'launchStartServicesErrorCallback'
-          })
-        })
-
-        return $.when(...promises).then(callback, callback);
+        return App.ajax.send({
+          name: 'common.services.update.all',
+          sender: this,
+          data: data,
+          success: 'launchStartServicesSuccessCallback',
+          error: 'launchStartServicesErrorCallback'
+        }).then(callback, callback);
     }
 
     if (App.get('testMode')) {
diff --git a/ambari-web/app/utils/ajax/ajax.js b/ambari-web/app/utils/ajax/ajax.js
index 0bcf2af..521bb02 100644
--- a/ambari-web/app/utils/ajax/ajax.js
+++ b/ambari-web/app/utils/ajax/ajax.js
@@ -57,7 +57,8 @@ var urls = {
   },
 
   'common.services.update.all' : {
-    'real': '/clusters/{clusterName}/servicegroups?{urlParams}',
+    //'real': '/clusters/{clusterName}/servicegroups?{urlParams}', //this is the new endpoint that should really be used for this but it isn't ready yet
+    'real': '/clusters/{clusterName}/services?{urlParams}', //this is the deprecated endpoint we have to use for now
     'format': function (data) {
       return {
         type: 'PUT',
diff --git a/ambari-web/test/controllers/wizard_test.js b/ambari-web/test/controllers/wizard_test.js
index 0f1896c..93f336d 100644
--- a/ambari-web/test/controllers/wizard_test.js
+++ b/ambari-web/test/controllers/wizard_test.js
@@ -770,8 +770,7 @@ describe('App.WizardController', function () {
         ]
       }));
       wizardController.installServices(true);
-      expect(App.ajax.send.calledThrice).to.be.true;
-      expect($.when.calledOnce).to.be.true;
+      expect(App.ajax.send.calledOnce).to.be.true;
       expect(res).to.be.eql({
         "status": "PENDING"
       });

-- 
To stop receiving notification emails like this one, please contact
jgolieb@apache.org.