ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ababiic...@apache.org
Subject ambari git commit: AMBARI-13041 UI should send user_names/user_groups to recommendation api. (ababiichuk)
Date Wed, 09 Sep 2015 12:27:58 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.1 b17a99687 -> 2c28f2bc4


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/2c28f2bc
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/2c28f2bc
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/2c28f2bc

Branch: refs/heads/branch-2.1
Commit: 2c28f2bc49e59f679d2f0a722eae616ccfa68405
Parents: b17a996
Author: aBabiichuk <ababiichuk@cybervisiontech.com>
Authored: Wed Sep 9 11:40:13 2015 +0300
Committer: aBabiichuk <ababiichuk@cybervisiontech.com>
Committed: Wed Sep 9 15:27:56 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/2c28f2bc/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 fe24f2a..0be2b44 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/2c28f2bc/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 0fb9539..bd659f4 100644
--- a/ambari-web/app/mixins/common/configs/enhanced_configs.js
+++ b/ambari-web/app/mixins/common/configs/enhanced_configs.js
@@ -166,6 +166,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);
   },
 
@@ -184,6 +189,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');
@@ -272,15 +278,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/2c28f2bc/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/2c28f2bc/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 4b671d4..769e631 100644
--- a/ambari-web/app/views/common/controls_view.js
+++ b/ambari-web/app/views/common/controls_view.js
@@ -94,13 +94,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);
       }
@@ -167,18 +170,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
@@ -211,17 +211,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')
 });
@@ -275,16 +270,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,


Mime
View raw message