Browse Source

AMBARI-16975. HS2 Interactive not shown on summary page after enabling HS Interactive (Blueprint deployment). (jaimin)

Jaimin Jetly 9 years ago
parent
commit
6e679b3db4

+ 21 - 0
ambari-web/app/mixins/main/service/configs/component_actions_by_configs.js

@@ -156,6 +156,7 @@ App.ComponentActionsByConfigs = Em.Mixin.create({
         var context = Em.I18n.t('requestInfo.start').format(displayStr);
         var context = Em.I18n.t('requestInfo.start').format(displayStr);
         var batches =[];
         var batches =[];
         this.setRefreshYarnQueueRequest(batches);
         this.setRefreshYarnQueueRequest(batches);
+        this.setCreateComponentRequest(batches, hostComponents);
         batches.push(this.getCreateHostComponentsRequest(_hostName, hostComponents));
         batches.push(this.getCreateHostComponentsRequest(_hostName, hostComponents));
         batches.push(this.getInstallHostComponentsRequest(_hostName, hostComponents));
         batches.push(this.getInstallHostComponentsRequest(_hostName, hostComponents));
         batches.push(this.getStartHostComponentsRequest(_hostName, masterHostComponents, context));
         batches.push(this.getStartHostComponentsRequest(_hostName, masterHostComponents, context));
@@ -293,6 +294,26 @@ App.ComponentActionsByConfigs = Em.Mixin.create({
     }
     }
   },
   },
 
 
+  /**
+   * Add `Create component` as a request in the batched API call
+   * @param batches  {Array}
+   * @param hostComponents {Array}
+   * @private
+   * @method {setCreateComponentRequest}
+   */
+  setCreateComponentRequest: function(batches, hostComponents) {
+    hostComponents.forEach(function(_componentName){
+      var serviceName = App.StackServiceComponent.find().findProperty('componentName',  _componentName).get('serviceName');
+      var serviceComponents = App.Service.find().findProperty('serviceName', serviceName).get('serviceComponents');
+      if (!serviceComponents.contains(_componentName)) {
+        batches.push({
+          "type": 'POST',
+          "uri": App.get('apiPrefix') + "/clusters/" + App.get('clusterName') + "/services/" + serviceName + "/components/" + _componentName
+        });
+      }
+    });
+  },
+
   /**
   /**
    * Add `Refresh YARN Queue` as a request in the batched API call
    * Add `Refresh YARN Queue` as a request in the batched API call
    * @param batches  {Array}
    * @param batches  {Array}