Updated Branches: refs/heads/trunk bb2f8aef4 -> b945179bd
AMBARI-3550. "Install, Start and Test" step. Retry error. (onechiporenko) Project: http://git-wip-us.apache.org/repos/asf/incubator-ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ambari/commit/b945179b Tree: http://git-wip-us.apache.org/repos/asf/incubator-ambari/tree/b945179b Diff: http://git-wip-us.apache.org/repos/asf/incubator-ambari/diff/b945179b Branch: refs/heads/trunk Commit: b945179bd73080ad2d79437b4966656dfc0d6495 Parents: bb2f8ae Author: Oleg Nechiporenko <[email protected]> Authored: Fri Oct 18 19:17:51 2013 +0300 Committer: Oleg Nechiporenko <[email protected]> Committed: Fri Oct 18 19:21:25 2013 +0300 ---------------------------------------------------------------------- .../controllers/main/service/add_controller.js | 4 +- ambari-web/app/controllers/wizard.js | 57 ++++++++++++++++++++ ambari-web/app/utils/ajax.js | 9 ++++ 3 files changed, 68 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/b945179b/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 04f34cb..9a37bfb 100644 --- a/ambari-web/app/controllers/main/service/add_controller.js +++ b/ambari-web/app/controllers/main/service/add_controller.js @@ -222,7 +222,7 @@ App.AddServiceController = App.WizardController.extend({ loadServiceConfigProperties: function() { this._super(); - if (this.get('currentStep') > 1) { + if (this.get('currentStep') > 1 && this.get('currentStep') < 6) { this.set('content.skipConfigStep', this.skipConfigStep()); this.get('isStepDisabled').findProperty('step', 4).set('value', this.get('content.skipConfigStep')); } @@ -230,7 +230,7 @@ App.AddServiceController = App.WizardController.extend({ saveServiceConfigProperties: function(stepController) { this._super(stepController); - if (this.get('currentStep') > 1) { + if (this.get('currentStep') > 1 && this.get('currentStep') < 6) { this.set('content.skipConfigStep', this.skipConfigStep()); this.get('isStepDisabled').findProperty('step', 4).set('value', this.get('content.skipConfigStep')); } http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/b945179b/ambari-web/app/controllers/wizard.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/wizard.js b/ambari-web/app/controllers/wizard.js index 2488c4c..65e44a9 100644 --- a/ambari-web/app/controllers/wizard.js +++ b/ambari-web/app/controllers/wizard.js @@ -286,6 +286,29 @@ App.WizardController = Em.Controller.extend({ }; data = JSON.stringify(data); break; + case 'addServiceController': + 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); + } + else { + name = 'wizard.install_services.installer_controller.not_is_retry'; + data = '{"RequestInfo": {"context" :"' + Em.I18n.t('requestInfo.installServices') + '"}, "Body": {"ServiceInfo": {"state": "INSTALLED"}}}'; + } + break; case 'installerController': default: if (isRetry) { @@ -311,6 +334,40 @@ App.WizardController = Em.Controller.extend({ }); }, + /** + * List of failed to install HostComponents while adding Service + */ + failedHostComponents: [], + + getFailedHostComponents: function() { + App.ajax.send({ + name: 'wizard.install_services.add_service_controller.get_failed_host_components', + sender: this, + success: 'getFailedHostComponentsSuccessCallback', + error: 'getFailedHostComponentsErrorCallback' + }); + }, + + /** + * Parse all failed components and filter out installed earlier components (based on selected to install services) + * @param {Object} json + */ + getFailedHostComponentsSuccessCallback: function(json) { + var allFailed = json.items.filterProperty('HostRoles.state', 'INSTALL_FAILED'); + var currentFailed = []; + var selectedServices = App.db.getService().filterProperty('isInstalled', false).filterProperty('isSelected', true).mapProperty('serviceName'); + allFailed.forEach(function(failed) { + if (selectedServices.contains(failed.component[0].ServiceComponentInfo.service_name)) { + currentFailed.push(failed.HostRoles.component_name); + } + }); + this.set('failedHostComponents', currentFailed); + }, + + getFailedHostComponentsErrorCallback: function(request, ajaxOptions, error) { + console.warn(error); + }, + installServicesSuccessCallback: function (jsonData) { var installStartTime = new Date().getTime(); console.log("TRACE: In success function for the installService call"); http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/b945179b/ambari-web/app/utils/ajax.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/utils/ajax.js b/ambari-web/app/utils/ajax.js index a0cad02..2946e64 100644 --- a/ambari-web/app/utils/ajax.js +++ b/ambari-web/app/utils/ajax.js @@ -889,6 +889,15 @@ var urls = { }; } }, + 'wizard.install_services.add_service_controller.get_failed_host_components': { + 'real': '/clusters/{clusterName}/host_components?fields=HostRoles/state,component/ServiceComponentInfo/service_name', + 'mock': '', + 'format': function (data, opt) { + return { + async: false + }; + } + }, 'wizard.service_components': { 'real': '{stackUrl}/stackServices?fields=StackServices', 'mock': '/data/wizard/stack/hdp/version/{stackVersion}.json',
