Repository: ambari Updated Branches: refs/heads/trunk b7cd438a5 -> 087e00b4a
AMBARI-6351 Remove synchronous calls with commands to server. (Max Shepel via atkach) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/087e00b4 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/087e00b4 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/087e00b4 Branch: refs/heads/trunk Commit: 087e00b4ae222d115a95c7fc4b7cf6edb1fb7bd9 Parents: b7cd438 Author: atkach <[email protected]> Authored: Wed Jul 2 14:43:55 2014 +0300 Committer: atkach <[email protected]> Committed: Wed Jul 2 14:43:55 2014 +0300 ---------------------------------------------------------------------- .../app/controllers/main/host/add_controller.js | 5 +- ambari-web/app/controllers/main/host/details.js | 65 +++++++----- .../controllers/main/service/add_controller.js | 59 ++++++----- ambari-web/app/controllers/wizard.js | 6 +- .../app/controllers/wizard/step8_controller.js | 63 ++++++----- .../app/controllers/wizard/step9_controller.js | 105 ++++++++++++------- ambari-web/app/routes/add_host_routes.js | 28 ++--- ambari-web/app/routes/add_service_routes.js | 26 +++-- ambari-web/app/routes/installer.js | 28 ++--- ambari-web/app/utils/ajax/ajax.js | 25 +---- 10 files changed, 232 insertions(+), 178 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/087e00b4/ambari-web/app/controllers/main/host/add_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/host/add_controller.js b/ambari-web/app/controllers/main/host/add_controller.js index c44ab74..c982e2d 100644 --- a/ambari-web/app/controllers/main/host/add_controller.js +++ b/ambari-web/app/controllers/main/host/add_controller.js @@ -394,7 +394,8 @@ App.AddHostController = App.WizardController.extend({ * send request to server in order to install services * @param isRetry */ - installServices: function (isRetry) { + installServices: function (isRetry, callback) { + callback = callback || Em.K; this.set('content.cluster.oldRequestsId', []); var clusterName = this.get('content.cluster.name'); var hostNames = []; @@ -426,7 +427,7 @@ App.AddHostController = App.WizardController.extend({ }, success: 'installServicesSuccessCallback', error: 'installServicesErrorCallback' - }); + }).then(callback, callback); return true; } }); http://git-wip-us.apache.org/repos/asf/ambari/blob/087e00b4/ambari-web/app/controllers/main/host/details.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/host/details.js b/ambari-web/app/controllers/main/host/details.js index e2b7311..5ab7592 100644 --- a/ambari-web/app/controllers/main/host/details.js +++ b/ambari-web/app/controllers/main/host/details.js @@ -266,9 +266,11 @@ App.MainHostDetailsController = Em.Controller.extend({ return Em.I18n.t('hosts.host.deleteComponent.popup.msg1').format(displayName); }.property(), onPrimary: function () { - self._doDeleteHostComponent(component); - self.set('redrawComponents', true); - this.hide(); + var popup = this; + self._doDeleteHostComponent(component, function () { + self.set('redrawComponents', true); + popup.hide(); + }); } }); }, @@ -288,7 +290,8 @@ App.MainHostDetailsController = Em.Controller.extend({ * when components failed to get deleted. * @method _doDeleteHostComponent */ - _doDeleteHostComponent: function (component) { + _doDeleteHostComponent: function (component, callback) { + callback = callback || Em.K; App.ajax.send({ name: (Em.isNone(component)) ? 'host.host_components.delete' : 'host.host_component.delete', sender: this, @@ -298,8 +301,7 @@ App.MainHostDetailsController = Em.Controller.extend({ }, success: '_doDeleteHostComponentSuccessCallback', error: '_doDeleteHostComponentErrorCallback' - }); - return this.get('_deletedHostComponentResult'); + }).then(callback, callback); }, /** @@ -323,11 +325,11 @@ App.MainHostDetailsController = Em.Controller.extend({ * @param {object} errorThrown * @method _doDeleteHostComponentErrorCallback */ - _doDeleteHostComponentErrorCallback: function (xhr, textStatus, errorThrown) { + _doDeleteHostComponentErrorCallback: function (xhr, textStatus, errorThrown, data) { console.log('Error deleting host component'); console.log(textStatus); console.log(errorThrown); - this.set('_deletedHostComponentResult', {xhr: xhr, url: url, method: 'DELETE'}); + this.set('_deletedHostComponentResult', {xhr: xhr, url: data.url, method: 'DELETE'}); }, /** @@ -1491,28 +1493,37 @@ App.MainHostDetailsController = Em.Controller.extend({ self.set('fromDeleteHost', true); var allComponents = self.get('content.hostComponents'); var deleteError = null; - allComponents.forEach(function (component) { + var dfd = $.Deferred(); + var popup = this; + allComponents.forEach(function (component, index) { + var length = allComponents.get('length'); if (!deleteError) { - deleteError = self._doDeleteHostComponent(component); + self._doDeleteHostComponent(component, function () { + deleteError = self.get('_deletedHostComponentResult'); + if (index == length - 1) { + dfd.resolve(); + } + }); + } + }); + dfd.done(function () { + if (!deleteError) { + App.ajax.send({ + name: 'host.delete', + sender: popup, + data: { + hostName: self.get('content.hostName') + }, + success: 'deleteHostSuccessCallback', + error: 'deleteHostErrorCallback' + }); + } + else { + popup.hide(); + deleteError.xhr.responseText = "{\"message\": \"" + deleteError.xhr.statusText + "\"}"; + App.ajax.defaultErrorHandler(deleteError.xhr, deleteError.url, deleteError.method, deleteError.xhr.status); } }); - if (!deleteError) { - App.ajax.send({ - name: 'host.delete', - sender: this, - data: { - hostName: self.get('content.hostName') - }, - success: 'deleteHostSuccessCallback', - error: 'deleteHostErrorCallback' - }); - - } - else { - this.hide(); - deleteError.xhr.responseText = "{\"message\": \"" + deleteError.xhr.statusText + "\"}"; - App.ajax.defaultErrorHandler(deleteError.xhr, deleteError.url, deleteError.method, deleteError.xhr.status); - } }, deleteHostSuccessCallback: function (data) { var dialogSelf = this; http://git-wip-us.apache.org/repos/asf/ambari/blob/087e00b4/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 080aba3..41ea6b1 100644 --- a/ambari-web/app/controllers/main/service/add_controller.js +++ b/ambari-web/app/controllers/main/service/add_controller.js @@ -377,33 +377,22 @@ App.AddServiceController = App.WizardController.extend({ App.router.get('updateController').updateAll(); }, - installServices: function (isRetry) { + installServices: function (isRetry, callback) { this.set('content.cluster.oldRequestsId', []); - var clusterName = this.get('content.cluster.name'); - var data; - var name; this.installAdditionalClients(); if (isRetry) { - this.getFailedHostComponents(); - console.log('failedHostComponents', this.get('failedHostComponents')); - name = 'wizard.install_services.installer_controller.is_retry'; - data = { - "RequestInfo": { - "context" : Em.I18n.t('requestInfo.installComponents'), - "query": "HostRoles/component_name.in(" + this.get('failedHostComponents').join(',') + ")" - }, - "Body": { - "HostRoles": { - "state": "INSTALLED" - } - } - }; - data = JSON.stringify(data); + this.getFailedHostComponents(callback); } else { - name = 'wizard.install_services.installer_controller.not_is_retry'; - data = '{"RequestInfo": {"context" :"' + Em.I18n.t('requestInfo.installServices') + '"}, "Body": {"ServiceInfo": {"state": "INSTALLED"}}}'; + var clusterName = this.get('content.cluster.name'); + var name = 'wizard.install_services.installer_controller.not_is_retry'; + var data = '{"RequestInfo": {"context" :"' + Em.I18n.t('requestInfo.installServices') + '"}, "Body": {"ServiceInfo": {"state": "INSTALLED"}}}'; + this.installServicesRequest(clusterName, name, data, callback); } + }, + + installServicesRequest: function (clusterName, name, data, callback) { + callback = callback || Em.K; App.ajax.send({ name: name, sender: this, @@ -413,7 +402,7 @@ App.AddServiceController = App.WizardController.extend({ }, success: 'installServicesSuccessCallback', error: 'installServicesErrorCallback' - }); + }).then(callback, callback); }, /** @@ -449,13 +438,14 @@ App.AddServiceController = App.WizardController.extend({ */ failedHostComponents: [], - getFailedHostComponents: function() { + getFailedHostComponents: function(callback) { + callback = this.sendInstallServicesRequest(callback); App.ajax.send({ name: 'wizard.install_services.add_service_controller.get_failed_host_components', sender: this, success: 'getFailedHostComponentsSuccessCallback', error: 'getFailedHostComponentsErrorCallback' - }); + }).then(callback, callback); }, /** @@ -476,6 +466,27 @@ App.AddServiceController = App.WizardController.extend({ getFailedHostComponentsErrorCallback: function(request, ajaxOptions, error) { console.warn(error); + }, + + sendInstallServicesRequest: function (callback) { + var name; + var data; + var clusterName = this.get('content.cluster.name'); + console.log('failedHostComponents', this.get('failedHostComponents')); + name = 'wizard.install_services.installer_controller.is_retry'; + data = { + "RequestInfo": { + "context" : Em.I18n.t('requestInfo.installComponents'), + "query": "HostRoles/component_name.in(" + this.get('failedHostComponents').join(',') + ")" + }, + "Body": { + "HostRoles": { + "state": "INSTALLED" + } + } + }; + data = JSON.stringify(data); + this.installServicesRequest(clusterName, name, data, callback); } }); http://git-wip-us.apache.org/repos/asf/ambari/blob/087e00b4/ambari-web/app/controllers/wizard.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/wizard.js b/ambari-web/app/controllers/wizard.js index e3bf94d..2cb6d6b 100644 --- a/ambari-web/app/controllers/wizard.js +++ b/ambari-web/app/controllers/wizard.js @@ -311,14 +311,14 @@ App.WizardController = Em.Controller.extend(App.LocalStorage, { * Invoke installation of selected services to the server and saves the request id returned by the server. * @param isRetry */ - installServices: function (isRetry) { - + installServices: function (isRetry, callback) { // clear requests since we are installing services // and we don't want to get tasks for previous install attempts this.set('content.cluster.oldRequestsId', []); var clusterName = this.get('content.cluster.name'); var data; var name; + callback = callback || Em.K; if (isRetry) { name = 'wizard.install_services.installer_controller.is_retry'; data = '{"RequestInfo": {"context" :"' + Em.I18n.t('requestInfo.installComponents') + '"}, "Body": {"HostRoles": {"state": "INSTALLED"}}}'; @@ -337,7 +337,7 @@ App.WizardController = Em.Controller.extend(App.LocalStorage, { }, success: 'installServicesSuccessCallback', error: 'installServicesErrorCallback' - }); + }).then(callback, callback); }, installServicesSuccessCallback: function (jsonData) { http://git-wip-us.apache.org/repos/asf/ambari/blob/087e00b4/ambari-web/app/controllers/wizard/step8_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/wizard/step8_controller.js b/ambari-web/app/controllers/wizard/step8_controller.js index 4c97e41..53de8e4 100644 --- a/ambari-web/app/controllers/wizard/step8_controller.js +++ b/ambari-web/app/controllers/wizard/step8_controller.js @@ -883,30 +883,12 @@ App.WizardStep8Controller = Em.Controller.extend({ // delete any existing clusters to start from a clean slate // before creating a new cluster in install wizard // TODO: modify for multi-cluster support - if (this.get('content.controllerName') == 'installerController' && (!App.get('testMode'))) { - this.deleteClusters(this.getExistingClusterNames()); - } - if (this.get('wizardController').getDBProperty('configsToUpdate')) { - this.updateConfigurations(this.get('wizardController').getDBProperty('configsToUpdate')); - } - this.setLocalRepositories(); - this.createCluster(); - this.createSelectedServices(); - if (this.get('content.controllerName') !== 'addHostController') { - this.createConfigurations(); - this.applyConfigurationsToCluster(); - } - this.createComponents(); - this.registerHostsToCluster(); - if (App.get('supports.hostOverridesInstaller')) { - this.createConfigurationGroups(); + var clusterNames = this.getExistingClusterNames(); + if (this.get('content.controllerName') == 'installerController' && (!App.get('testMode')) && clusterNames.length) { + this.deleteClusters(clusterNames); + } else { + this.deleteClustersSuccessCallback(null, null, {isLast: true}); } - this.createMasterHostComponents(); - this.createSlaveAndClientsHostComponents(); - this.createAdditionalHostComponents(); - - this.set('ajaxQueueLength', this.get('ajaxRequestsQueue.queue.length')); - this.get('ajaxRequestsQueue').start(); }, /** @@ -954,18 +936,47 @@ App.WizardStep8Controller = Em.Controller.extend({ * @method deleteClusters */ deleteClusters: function (clusterNames) { - clusterNames.forEach(function (clusterName) { + clusterNames.forEach(function (clusterName, index) { App.ajax.send({ name: 'wizard.step8.delete_cluster', sender: this, data: { - name: clusterName - } + name: clusterName, + isLast: index == clusterNames.length - 1 + }, + success: 'deleteClustersCallback', + error: 'deleteClustersCallback' }); }, this); }, + deleteClustersCallback: function (response, request, data) { + if (data.isLast) { + if (this.get('wizardController').getDBProperty('configsToUpdate')) { + this.updateConfigurations(this.get('wizardController').getDBProperty('configsToUpdate')); + } + this.setLocalRepositories(); + this.createCluster(); + this.createSelectedServices(); + if (this.get('content.controllerName') !== 'addHostController') { + this.createConfigurations(); + this.applyConfigurationsToCluster(); + } + this.createComponents(); + this.registerHostsToCluster(); + if (App.get('supports.hostOverridesInstaller')) { + this.createConfigurationGroups(); + } + this.createMasterHostComponents(); + this.createSlaveAndClientsHostComponents(); + this.createAdditionalHostComponents(); + + this.set('ajaxQueueLength', this.get('ajaxRequestsQueue.queue.length')); + this.get('ajaxRequestsQueue').start(); + } + }, + /** * Updates local repositories for the Ambari server. * @method setLocalRepositories http://git-wip-us.apache.org/repos/asf/ambari/blob/087e00b4/ambari-web/app/controllers/wizard/step9_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/wizard/step9_controller.js b/ambari-web/app/controllers/wizard/step9_controller.js index 181e895..c966e53 100644 --- a/ambari-web/app/controllers/wizard/step9_controller.js +++ b/ambari-web/app/controllers/wizard/step9_controller.js @@ -168,6 +168,39 @@ App.WizardStep9Controller = Em.Controller.extend({ currentOpenTaskRequestId: 0, /** + * True if stage transition is completed. + * On true, polling will be stopped. + * @type {bool}s + */ + parseHostInfo: false, + + isPolling: true, + + changeParseHostInfo: function (value) { + this.set('parseHostInfo', value); + this.parseHostInfoPolling(); + }, + + parseHostInfoPolling: function () { + var self = this; + var result = this.get('parseHostInfo'); + if (!this.get('isPolling')) { + if (this.get('content.cluster.status') === 'INSTALL FAILED') { + this.isAllComponentsInstalled(); + } + return; + } + if (result !== true) { + window.setTimeout(function () { + if (self.get('currentOpenTaskId')) { + self.loadCurrentTaskLog(); + } + self.doPolling(); + }, this.get('POLL_INTERVAL')); + } + }, + + /** * Observer function: Updates {status} field of the controller. * @method updateStatus */ @@ -425,11 +458,11 @@ App.WizardStep9Controller = Em.Controller.extend({ * @return {$.ajax|null} * @method launchStartServices */ - launchStartServices: function () { + launchStartServices: function (callback) { var data = {}; var name = ''; var servicesList = []; - + callback = callback || Em.K; if (this.get('content.controllerName') === 'addHostController') { name = 'wizard.step9.add_host.launch_start_services'; var hostnames = []; @@ -484,7 +517,7 @@ App.WizardStep9Controller = Em.Controller.extend({ }, success: 'launchStartServicesSuccessCallback', error: 'launchStartServicesErrorCallback' - }); + }).then(callback, callback); }, /** @@ -736,20 +769,22 @@ App.WizardStep9Controller = Em.Controller.extend({ * INSTALLED -> STARTED * INSTALLED -> START_FAILED * @param polledData json data retrieved from API - * @returns {bool} true if polling should stop; false otherwise - * @method finishState + * @method setFinishState */ - finishState: function (polledData) { + setFinishState: function (polledData) { if (this.get('content.cluster.status') === 'INSTALLED') { - return this.isServicesStarted(polledData); + this.changeParseHostInfo(this.isServicesStarted(polledData)); + return; } else if (this.get('content.cluster.status') === 'PENDING') { - return this.isServicesInstalled(polledData); + this.setIsServicesInstalled(polledData); + return; } else if (this.get('content.cluster.status') === 'INSTALL FAILED' || this.get('content.cluster.status') === 'START FAILED' || this.get('content.cluster.status') === 'STARTED') { this.set('progress', '100'); - return true; + this.changeParseHostInfo(true); + return; } - return false; + this.changeParseHostInfo(true); }, /** @@ -782,11 +817,10 @@ App.WizardStep9Controller = Em.Controller.extend({ }, /** - * @param polledData Josn data retrieved from API - * @returns {bool} Has "Install All Services" request completed successfully - * @method isServicesInstalled + * @param polledData Json data retrieved from API + * @method setIsServicesInstalled */ - isServicesInstalled: function (polledData) { + setIsServicesInstalled: function (polledData) { var clusterStatus = {}; if (!polledData.someProperty('Tasks.status', 'PENDING') && !polledData.someProperty('Tasks.status', 'QUEUED') && !polledData.someProperty('Tasks.status', 'IN_PROGRESS')) { clusterStatus = { @@ -806,14 +840,20 @@ App.WizardStep9Controller = Em.Controller.extend({ this.set('progress', '34'); if (this.get('content.controllerName') === 'installerController') { this.isAllComponentsInstalled(); + this.saveInstalledHosts(this); + this.changeParseHostInfo(true); + return; } else { - this.launchStartServices(); + var self = this; + this.launchStartServices(function () { + self.saveInstalledHosts(self); + self.changeParseHostInfo(true); + }); + return; } } - this.saveInstalledHosts(this); - return true; } - return false; + this.changeParseHostInfo(false); }, /** @@ -839,11 +879,9 @@ App.WizardStep9Controller = Em.Controller.extend({ /** * Parses the Json data retrieved from API and sets the task on the host of {hosts} array binded to template * @param polledData Json data retrieved from API - * @returns {bool} True if stage transition is completed. - * On true, polling will be stopped. - * @method parseHostInfo + * @method setParseHostInfo */ - parseHostInfo: function (polledData) { + setParseHostInfo: function (polledData) { console.log('TRACE: Entering host info function'); var self = this; var totalProgress = 0; @@ -856,7 +894,8 @@ App.WizardStep9Controller = Em.Controller.extend({ // determine the current install status. // Also, we don't want to keep polling if it is not the // current requestId. - return false; + this.changeParseHostInfo(false); + return; } this.replacePolledData(tasksData); var tasksHostMap = {}; @@ -898,7 +937,7 @@ App.WizardStep9Controller = Em.Controller.extend({ totalProgress = Math.floor(totalProgress / this.get('hosts.length')); this.set('progress', totalProgress.toString()); console.log("INFO: right now the progress is: " + this.get('progress')); - return this.finishState(tasksData); + this.setFinishState(tasksData); }, /** @@ -1010,25 +1049,11 @@ App.WizardStep9Controller = Em.Controller.extend({ * @method getLogsByRequestSuccessCallback */ getLogsByRequestSuccessCallback: function (data, opt, params) { - var self = this; var parsedData = jQuery.parseJSON(data); console.log("TRACE: In success function for the GET logs data"); console.log("TRACE: Step9 -> The value is: ", parsedData); - var result = this.parseHostInfo(parsedData); - if (!params.polling) { - if (this.get('content.cluster.status') === 'INSTALL FAILED') { - this.isAllComponentsInstalled(); - } - return; - } - if (result !== true) { - window.setTimeout(function () { - if (self.get('currentOpenTaskId')) { - self.loadCurrentTaskLog(); - } - self.doPolling(); - }, this.get('POLL_INTERVAL')); - } + this.set('isPolling', params.polling); + this.setParseHostInfo(parsedData); }, /** http://git-wip-us.apache.org/repos/asf/ambari/blob/087e00b4/ambari-web/app/routes/add_host_routes.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/routes/add_host_routes.js b/ambari-web/app/routes/add_host_routes.js index 32d6c57..a33d095 100644 --- a/ambari-web/app/routes/add_host_routes.js +++ b/ambari-web/app/routes/add_host_routes.js @@ -264,12 +264,13 @@ module.exports = App.WizardRoute.extend({ if(App.supports.hostOverrides){ addHostController.applyConfigGroup(); } - addHostController.installServices(); - addHostController.setInfoForStep9(); - // We need to do recovery based on whether we are in Add Host or Installer wizard - addHostController.saveClusterState('ADD_HOSTS_INSTALLING_3'); - wizardStep8Controller.set('servicesInstalled', true); - router.transitionTo('step6'); + addHostController.installServices(false, function () { + addHostController.setInfoForStep9(); + // We need to do recovery based on whether we are in Add Host or Installer wizard + addHostController.saveClusterState('ADD_HOSTS_INSTALLING_3'); + wizardStep8Controller.set('servicesInstalled', true); + router.transitionTo('step6'); + }); } }), @@ -297,13 +298,16 @@ module.exports = App.WizardRoute.extend({ if (wizardStep9Controller.get('showRetry')) { if (wizardStep9Controller.get('content.cluster.status') === 'INSTALL FAILED') { var isRetry = true; - addHostController.installServices(isRetry); - addHostController.setInfoForStep9(); - wizardStep9Controller.resetHostsForRetry(); - // We need to do recovery based on whether we are in Add Host or Installer wizard - addHostController.saveClusterState('ADD_HOSTS_INSTALLING_3'); + addHostController.installServices(isRetry, function () { + addHostController.setInfoForStep9(); + wizardStep9Controller.resetHostsForRetry(); + // We need to do recovery based on whether we are in Add Host or Installer wizard + addHostController.saveClusterState('ADD_HOSTS_INSTALLING_3'); + wizardStep9Controller.navigateStep(); + }); + } else { + wizardStep9Controller.navigateStep(); } - wizardStep9Controller.navigateStep(); } }, unroutePath: function() { http://git-wip-us.apache.org/repos/asf/ambari/blob/087e00b4/ambari-web/app/routes/add_service_routes.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/routes/add_service_routes.js b/ambari-web/app/routes/add_service_routes.js index b292e77..6cd9d9c 100644 --- a/ambari-web/app/routes/add_service_routes.js +++ b/ambari-web/app/routes/add_service_routes.js @@ -249,12 +249,13 @@ module.exports = App.WizardRoute.extend({ next: function (router) { var addServiceController = router.get('addServiceController'); var wizardStep8Controller = router.get('wizardStep8Controller'); - addServiceController.installServices(); - addServiceController.setInfoForStep9(); + addServiceController.installServices(false, function () { + addServiceController.setInfoForStep9(); - addServiceController.saveClusterState('ADD_SERVICES_INSTALLING_3'); - wizardStep8Controller.set('servicesInstalled', true); - router.transitionTo('step6'); + addServiceController.saveClusterState('ADD_SERVICES_INSTALLING_3'); + wizardStep8Controller.set('servicesInstalled', true); + router.transitionTo('step6'); + }); } }), @@ -281,13 +282,16 @@ module.exports = App.WizardRoute.extend({ if (wizardStep9Controller.get('showRetry')) { if (wizardStep9Controller.get('content.cluster.status') === 'INSTALL FAILED') { var isRetry = true; - addServiceController.installServices(isRetry); - addServiceController.setInfoForStep9(); - wizardStep9Controller.resetHostsForRetry(); - // We need to do recovery based on whether we are in Add Host or Installer wizard - addServiceController.saveClusterState('ADD_SERVICES_INSTALLING_3'); + addServiceController.installServices(isRetry, function () { + addServiceController.setInfoForStep9(); + wizardStep9Controller.resetHostsForRetry(); + // We need to do recovery based on whether we are in Add Host or Installer wizard + addServiceController.saveClusterState('ADD_SERVICES_INSTALLING_3'); + wizardStep9Controller.navigateStep(); + }); + } else { + wizardStep9Controller.navigateStep(); } - wizardStep9Controller.navigateStep(); } }, unroutePath: function() { http://git-wip-us.apache.org/repos/asf/ambari/blob/087e00b4/ambari-web/app/routes/installer.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/routes/installer.js b/ambari-web/app/routes/installer.js index 4877a4f..e9c4288 100644 --- a/ambari-web/app/routes/installer.js +++ b/ambari-web/app/routes/installer.js @@ -338,12 +338,13 @@ module.exports = Em.Route.extend({ var installerController = router.get('installerController'); var wizardStep8Controller = router.get('wizardStep8Controller'); // invoke API call to install selected services - installerController.installServices(); - installerController.setInfoForStep9(); - // We need to do recovery based on whether we are in Add Host or Installer wizard - installerController.saveClusterState('CLUSTER_INSTALLING_3'); - wizardStep8Controller.set('servicesInstalled', true); - router.transitionTo('step9'); + installerController.installServices(false, function () { + installerController.setInfoForStep9(); + // We need to do recovery based on whether we are in Add Host or Installer wizard + installerController.saveClusterState('CLUSTER_INSTALLING_3'); + wizardStep8Controller.set('servicesInstalled', true); + router.transitionTo('step9'); + }); } }), @@ -368,13 +369,16 @@ module.exports = Em.Route.extend({ if (wizardStep9Controller.get('showRetry')) { if (wizardStep9Controller.get('content.cluster.status') === 'INSTALL FAILED') { var isRetry = true; - installerController.installServices(isRetry); - installerController.setInfoForStep9(); - wizardStep9Controller.resetHostsForRetry(); - // We need to do recovery based on whether we are in Add Host or Installer wizard - installerController.saveClusterState('CLUSTER_INSTALLING_3'); + installerController.installServices(isRetry, function () { + installerController.setInfoForStep9(); + wizardStep9Controller.resetHostsForRetry(); + // We need to do recovery based on whether we are in Add Host or Installer wizard + installerController.saveClusterState('CLUSTER_INSTALLING_3'); + wizardStep9Controller.navigateStep(); + }); + } else { + wizardStep9Controller.navigateStep(); } - wizardStep9Controller.navigateStep(); } }, unroutePath: function () { http://git-wip-us.apache.org/repos/asf/ambari/blob/087e00b4/ambari-web/app/utils/ajax/ajax.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/utils/ajax/ajax.js b/ambari-web/app/utils/ajax/ajax.js index 49d83b1..b3117a9 100644 --- a/ambari-web/app/utils/ajax/ajax.js +++ b/ambari-web/app/utils/ajax/ajax.js @@ -375,8 +375,7 @@ var urls = { 'mock': '', 'format': function() { return { - type: 'DELETE', - async: false + type: 'DELETE' } } }, @@ -386,8 +385,7 @@ var urls = { 'mock': '', 'format': function() { return { - type: 'DELETE', - async: false + type: 'DELETE' } } }, @@ -409,7 +407,6 @@ var urls = { 'format': function(data) { return { type: 'PUT', - async: false, data: data.data } } @@ -584,12 +581,7 @@ var urls = { 'host.delete': { 'real': '/clusters/{clusterName}/hosts/{hostName}', 'mock': '', - 'type': 'DELETE', - 'format': function() { - return { - async: false - } - } + 'type': 'DELETE' }, 'hosts.metrics': { 'real': '/clusters/{clusterName}/hosts?fields={metricName}', @@ -1189,7 +1181,6 @@ var urls = { 'format': function (data) { return { type: 'PUT', - async: false, data: data.data }; } @@ -1200,7 +1191,6 @@ var urls = { 'format': function (data) { return { type: 'PUT', - async: false, data: data.data }; } @@ -1269,7 +1259,6 @@ var urls = { 'format': function(data) { return { type: 'PUT', - async: false, data: data.data }; } @@ -1280,7 +1269,6 @@ var urls = { 'type': 'PUT', 'format': function (data) { return { - async: false, data: data.data }; } @@ -1291,7 +1279,6 @@ var urls = { 'type': 'PUT', 'format': function (data) { return { - async: false, data: data.data }; } @@ -1330,7 +1317,6 @@ var urls = { 'format': function (data) { var d = { type: 'PUT', - async: false, data: data.data }; if (App.testMode) { @@ -1345,7 +1331,6 @@ var urls = { 'format': function (data) { var d = { type: 'PUT', - async: false, data: data.data }; if (App.testMode) { @@ -1360,7 +1345,6 @@ var urls = { 'format': function (data) { return { type: 'PUT', - async: false, data: data.data }; } @@ -1382,8 +1366,7 @@ var urls = { 'mock': '', 'format': function() { return { - type: 'DELETE', - async: false + type: 'DELETE' }; } },
