Browse Source

AMBARI-19701. Provide minimal call context from UI when making stack advisor calls. (rzang via yusaku)

Yusaku Sako 8 years ago
parent
commit
4c9ebb590b
1 changed files with 20 additions and 1 deletions
  1. 20 1
      ambari-web/app/mixins/common/configs/enhanced_configs.js

+ 20 - 1
ambari-web/app/mixins/common/configs/enhanced_configs.js

@@ -194,7 +194,7 @@ App.EnhancedConfigsMixin = Em.Mixin.create(App.ConfigWithOverrideRecommendationP
       } else {
         delete recommendations.config_groups;
       }
-
+      this.setUserContext(dataToSend);
       if (stepConfigs.someProperty('serviceName', 'MISC')) {
         recommendations.blueprint.configurations = blueprintUtils.buildConfigsJSON(stepConfigs);
         dataToSend.recommendations = recommendations;
@@ -241,6 +241,25 @@ App.EnhancedConfigsMixin = Em.Mixin.create(App.ConfigWithOverrideRecommendationP
     });
   },
 
+  setUserContext: function(dataToSend) {
+    var controllerName = this.get('content.controllerName');
+    var changes = dataToSend.changed_configurations;
+    if (changes) {
+      dataToSend['user-context'] = {"operation" : "EditConfig"};
+    } else {
+      if (!controllerName) {
+        dataToSend['user-context'] = {"operation" : "RecommendAttribute"};
+      } else if (controllerName == 'addServiceController') {
+        dataToSend['user-context'] = {
+          "operation" : "AddService",
+          "operation_details" : (this.get('content.services')|| []).filterProperty('isSelected').filterProperty('isInstalled', false).mapProperty('serviceName').join(',')
+        };
+      } else if (controllerName == 'installerController'){
+        dataToSend['user-context'] = {"operation" : "ClusterCreate"};
+      }
+    }
+  },
+
   /**
    * Defines if there is any changes made by user.
    * Check all properties except recommended properties from popup