You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ab...@apache.org on 2015/09/09 14:27:22 UTC

ambari git commit: AMBARI-13041 UI should send user_names/user_groups to recommendation api. (ababiichuk)

Repository: ambari
Updated Branches:
  refs/heads/trunk 74dc9474b -> 7716a8eb0


AMBARI-13041 UI should send user_names/user_groups to recommendation api. (ababiichuk)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/7716a8eb
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/7716a8eb
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/7716a8eb

Branch: refs/heads/trunk
Commit: 7716a8eb0e3f3da6efe44ec7ee9e4f7c8c69295f
Parents: 74dc947
Author: aBabiichuk <ab...@cybervisiontech.com>
Authored: Wed Sep 9 11:40:13 2015 +0300
Committer: aBabiichuk <ab...@cybervisiontech.com>
Committed: Wed Sep 9 15:27:18 2015 +0300

----------------------------------------------------------------------
 .../app/controllers/wizard/step8_controller.js  | 10 +----
 .../mixins/common/configs/enhanced_configs.js   | 22 +++++-----
 ambari-web/app/mixins/common/serverValidator.js | 32 +++++++--------
 ambari-web/app/views/common/controls_view.js    | 42 ++++++++------------
 4 files changed, 47 insertions(+), 59 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/7716a8eb/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 722a9b6..dff09a8 100644
--- a/ambari-web/app/controllers/wizard/step8_controller.js
+++ b/ambari-web/app/controllers/wizard/step8_controller.js
@@ -345,19 +345,11 @@ App.WizardStep8Controller = Em.Controller.extend(App.AddSecurityConfigs, App.wiz
   loadConfigs: function () {
     //storedConfigs contains custom configs as well
     var configs = this.get('content.serviceConfigProperties');
-    /*if (configs.someProperty('name', 'hive_database')) {
-      configs = this.removeHiveConfigs(configs);
-    }
-    if (configs.someProperty('name', 'oozie_database')) {
-      configs = this.removeOozieConfigs(configs);
-    }*/
     configs.forEach(function (_config) {
       _config.value = (typeof _config.value === "boolean") ? _config.value.toString() : _config.value;
     });
-    var mappedConfigs = App.config.excludeUnsupportedConfigs(this.get('configMapping'), this.get('selectedServices').mapProperty('serviceName'));
-    var uiConfigs = this.loadUiSideConfigs(mappedConfigs);
     var customGroupConfigs = [];
-    var allConfigs = configs.concat(uiConfigs).filter(function (config) {
+    var allConfigs = configs.filter(function (config) {
       if (config.group) {
         customGroupConfigs.push(config);
         return false;

http://git-wip-us.apache.org/repos/asf/ambari/blob/7716a8eb/ambari-web/app/mixins/common/configs/enhanced_configs.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/common/configs/enhanced_configs.js b/ambari-web/app/mixins/common/configs/enhanced_configs.js
index 2c2f13b..a6be130 100644
--- a/ambari-web/app/mixins/common/configs/enhanced_configs.js
+++ b/ambari-web/app/mixins/common/configs/enhanced_configs.js
@@ -167,6 +167,11 @@ App.EnhancedConfigsMixin = Em.Mixin.create({
     var cleanDependencies = this.get('_dependentConfigValues').reject(function(c) {
       return serviceNames.contains(c.serviceName);
     }, this);
+    this.get('stepConfigs').filter(function(s) {
+      return serviceNames.contains(s.get('serviceName'));
+    }).forEach(function(s) {
+      s.get('configs').setEach('isNotSaved', false);
+    });
     this.set('_dependentConfigValues', cleanDependencies);
   },
 
@@ -185,6 +190,7 @@ App.EnhancedConfigsMixin = Em.Mixin.create({
       }
     });
     var cleanDependencies = this.get('_dependentConfigValues').reject(function(item) {
+      if ('hadoop.proxyuser'.contains(Em.get(item, 'name'))) return false;
       if (installedServices.contains(Em.get(item, 'serviceName'))) {
         var stackProperty = App.StackConfigProperty.find().findProperty("name", item.propertyName);
         var parentConfigs = stackProperty && stackProperty.get('propertyDependsOn');
@@ -273,15 +279,13 @@ App.EnhancedConfigsMixin = Em.Mixin.create({
         hosts: this.get('hostNames'),
         services: this.get('serviceNames')
       };
-      if (App.get('isClusterSupportsEnhancedConfigs')) {
-        if (changedConfigs) {
-          dataToSend.recommend = 'configuration-dependencies';
-          dataToSend.changed_configurations = changedConfigs;
-        }
-        if (!configGroup.get('isDefault') && configGroup.get('hosts.length') > 0) {
-          var configGroups = this.buildConfigGroupJSON(this.get('selectedService.configs'), configGroup);
-          recommendations.config_groups = [configGroups];
-        }
+      if (changedConfigs) {
+        dataToSend.recommend = 'configuration-dependencies';
+        dataToSend.changed_configurations = changedConfigs;
+      }
+      if (!configGroup.get('isDefault') && configGroup.get('hosts.length') > 0) {
+        var configGroups = this.buildConfigGroupJSON(this.get('selectedService.configs'), configGroup);
+        recommendations.config_groups = [configGroups];
       }
       dataToSend.recommendations = recommendations;
       return App.ajax.send({

http://git-wip-us.apache.org/repos/asf/ambari/blob/7716a8eb/ambari-web/app/mixins/common/serverValidator.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/common/serverValidator.js b/ambari-web/app/mixins/common/serverValidator.js
index 7b41689..fd98ace 100644
--- a/ambari-web/app/mixins/common/serverValidator.js
+++ b/ambari-web/app/mixins/common/serverValidator.js
@@ -121,23 +121,23 @@ App.ServerValidatorMixin = Em.Mixin.create({
     }
     var recommendations = this.get('hostGroups');
     // send user's input based on stored configurations
-    if (this.get('content.serviceConfigProperties.length')) {
-      recommendations.blueprint.configurations = blueprintUtils.buildConfigsJSON(this.get('services'), this.get('stepConfigs'));
-    }
-    // for add service send configurations for installed services on first transition to Customize Services step
-    if (!this.get('content.serviceConfigProperties.length') && this.get('wizardController.name') === 'addServiceController') {
-      recommendations.blueprint.configurations = blueprintUtils.buildConfigsJSON(this.get('services'), this.get('stepConfigs').filter(function(serviceConfigs) {
-        return self.get('installedServiceNames').contains(serviceConfigs.get('serviceName'));
-      }));
-      // include cluster-env site to recommendations call
-      var miscService = this.get('services').findProperty('serviceName', 'MISC');
-      if (miscService) {
-        var miscConfigs = blueprintUtils.buildConfigsJSON([miscService], [this.get('stepConfigs').findProperty('serviceName', 'MISC')]);
-        var clusterEnv = App.permit(miscConfigs, 'cluster-env');
-        if (!App.isEmptyObject(clusterEnv)) {
-          $.extend(recommendations.blueprint.configurations, clusterEnv);
-        }
+    recommendations.blueprint.configurations = blueprintUtils.buildConfigsJSON(this.get('services'), this.get('stepConfigs'));
+
+    // include cluster-env site to recommendations call
+    var miscService = this.get('services').findProperty('serviceName', 'MISC');
+    if (miscService) {
+      var miscConfigs = blueprintUtils.buildConfigsJSON([miscService], [this.get('stepConfigs').findProperty('serviceName', 'MISC')]);
+      var clusterEnv = App.permit(miscConfigs, 'cluster-env');
+      if (!App.isEmptyObject(clusterEnv)) {
+        $.extend(recommendations.blueprint.configurations, clusterEnv);
       }
+      /** add user properties from misc tabs to proper filename **/
+      this.get('stepConfigs').findProperty('serviceName', 'MISC').get('configs').forEach(function(config) {
+        var tag = App.config.getConfigTagFromFileName(config.get('filename'));
+        if (recommendations.blueprint.configurations[tag] && tag != 'cluster-env') {
+          recommendations.blueprint.configurations[tag].properties[config.get('name')] = config.get('value');
+        }
+      })
     }
 
     return App.ajax.send({

http://git-wip-us.apache.org/repos/asf/ambari/blob/7716a8eb/ambari-web/app/views/common/controls_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/controls_view.js b/ambari-web/app/views/common/controls_view.js
index 5bcb164..672ca16 100644
--- a/ambari-web/app/views/common/controls_view.js
+++ b/ambari-web/app/views/common/controls_view.js
@@ -95,13 +95,16 @@ App.SupportsDependentConfigs = Ember.Mixin.create({
       var controller = this.get('controller');
       var type = App.config.getConfigTagFromFileName(config.get('filename'));
       var p = App.StackConfigProperty.find(App.config.configId(name, type));
-      if (p && p.get('propertyDependedBy.length') > 0) {
-        return controller.getRecommendationsForDependencies([{
-          "type": type,
-          "name": name
-        }], false, function() {
-          controller.removeCurrentFromDependentList(config, saveRecommended);
-        });
+       if ((p && p.get('propertyDependedBy.length') > 0 || p.get('displayType') === 'user') && config.get('oldValue') !== config.get('value')) {
+         var old = config.get('oldValue');
+         config.set('oldValue', config.get('value'));
+         return controller.getRecommendationsForDependencies([{
+           "type": type,
+           "name": name,
+           "old_value": Em.isNone(old) ? config.get('initialValue') : old
+         }], false, function() {
+           controller.removeCurrentFromDependentList(config, saveRecommended);
+         });
       } else {
         controller.removeCurrentFromDependentList(config, saveRecommended);
       }
@@ -168,18 +171,15 @@ App.ServiceConfigTextField = Ember.TextField.extend(App.ServiceConfigPopoverSupp
   classNameBindings: 'textFieldClassName',
   placeholderBinding: 'serviceConfig.savedValue',
 
-  keyPress: function (event) {
-    if (event.keyCode == 13) {
-      return false;
-    }
+  onValueUpdate: function () {
     var self = this;
     delay(function(){
       self.sendRequestRorDependentConfigs(self.get('serviceConfig'));
     }, 500);
-  },
+  }.observes('serviceConfig.value'),
+
   //Set editDone true for last edited config text field parameter
   focusOut: function () {
-    this.sendRequestRorDependentConfigs(this.get('serviceConfig'));
     this.get('serviceConfig').set("editDone", true);
   },
   //Set editDone false for all current category config text field parameter
@@ -212,17 +212,12 @@ App.ServiceConfigTextFieldWithUnit = Ember.View.extend(App.ServiceConfigPopoverS
   classNames: ['input-append', 'with-unit'],
   placeholderBinding: 'serviceConfig.savedValue',
 
-  //Set editDone true for last edited config text field parameter
-  focusOut: function () {
-    this.sendRequestRorDependentConfigs(this.get('serviceConfig'));
-  },
-
-  keyPress: function (event) {
+  onValueUpdate: function () {
     var self = this;
     delay(function(){
       self.sendRequestRorDependentConfigs(self.get('serviceConfig'));
     }, 500);
-  },
+  }.observes('serviceConfig.value'),
 
   templateName: require('templates/wizard/controls_service_config_textfield_with_unit')
 });
@@ -276,16 +271,13 @@ App.ServiceConfigPasswordField = Ember.TextField.extend({
  */
 App.ServiceConfigTextArea = Ember.TextArea.extend(App.ServiceConfigPopoverSupport, App.ServiceConfigCalculateId, App.SupportsDependentConfigs, {
 
-  focusOut: function () {
-    this.sendRequestRorDependentConfigs(this.get('serviceConfig'));
-  },
 
-  keyPress: function (event) {
+  onValueUpdate: function () {
     var self = this;
     delay(function(){
       self.sendRequestRorDependentConfigs(self.get('serviceConfig'));
     }, 500);
-  },
+  }.observes('serviceConfig.value'),
 
   valueBinding: 'serviceConfig.value',
   rows: 4,