Преглед изворни кода

AMBARI-3550. "Install, Start and Test" step. Retry error. (onechiporenko)

Oleg Nechiporenko пре 11 година
родитељ
комит
b945179bd7

+ 2 - 2
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'));
     }

+ 57 - 0
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");

+ 9 - 0
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',