Repository: ambari
Updated Branches:
  refs/heads/trunk 72630f2ed -> c52c40fa1


AMBARI-13605 Ranger authentication method property is not getting updated with 
value from 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/c52c40fa
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/c52c40fa
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/c52c40fa

Branch: refs/heads/trunk
Commit: c52c40fa1f79e2cf3e9398286d6582368cf63d1a
Parents: 72630f2
Author: aBabiichuk <ababiic...@cybervisiontech.com>
Authored: Wed Oct 28 16:57:22 2015 +0200
Committer: aBabiichuk <ababiic...@cybervisiontech.com>
Committed: Wed Oct 28 17:02:20 2015 +0200

----------------------------------------------------------------------
 .../mixins/common/configs/enhanced_configs.js   |  5 +++
 ambari-web/app/views/common/controls_view.js    | 38 +++++++++++---------
 2 files changed, 27 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/c52c40fa/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 d984e7d..49ceb74 100644
--- a/ambari-web/app/mixins/common/configs/enhanced_configs.js
+++ b/ambari-web/app/mixins/common/configs/enhanced_configs.js
@@ -468,6 +468,11 @@ App.EnhancedConfigsMixin = Em.Mixin.create({
           initialValue = validator.isValidFloat(initialValue) ? 
parseFloat(initialValue).toString() : initialValue;
           recommendedValue = validator.isValidFloat(recommendedValue) ? 
parseFloat(recommendedValue).toString() : recommendedValue;
 
+          var groupName = group && Em.get(group, 'name');
+          var dependentProperty = 
this.get('_dependentConfigValues').find(function (dcv) {
+            return dcv.propertyName === propertyName && dcv.fileName === key 
&& dcv.configGroup === groupName;
+          });
+
           if (!updateOnlyBoundaries && 
!parentPropertiesNames.contains(App.config.configId(propertyName, key)) && 
initialValue != recommendedValue) { //on first initial request we don't need to 
change values
             var groupName = group && Em.get(group, 'name');
             var dependentProperty = 
this.get('_dependentConfigValues').find(function (dcv) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/c52c40fa/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 578e975..b305249 100644
--- a/ambari-web/app/views/common/controls_view.js
+++ b/ambari-web/app/views/common/controls_view.js
@@ -515,7 +515,6 @@ App.ServiceConfigRadioButtons = 
Ember.View.extend(App.ServiceConfigCalculateId,
   }.property('serviceConfig.serviceName', 'serviceConfig.value'),
 
   onOptionsChange: function () {
-    this.sendRequestRorDependentConfigs(this.get('serviceConfig'));
     if (this.get('hostNameProperty') && 
!this.get('nonDBRadioButtons').contains(this.get('serviceConfig.name'))) {
       /** if new db is selected host name must be same as master of selected 
service (and can't be changed)**/
       if (this.get('isNewDb')) {
@@ -750,25 +749,22 @@ App.ServiceConfigRadioButtons = 
Ember.View.extend(App.ServiceConfigCalculateId,
   }.property('serviceConfig.options')
 });
 
-App.ServiceConfigRadioButton = Ember.Checkbox.extend({
+App.ServiceConfigRadioButton = 
Ember.Checkbox.extend(App.SupportsDependentConfigs, {
   tagName: 'input',
   attributeBindings: ['type', 'name', 'value', 'checked', 'disabled'],
   checked: false,
+  clicked: false,
   type: 'radio',
   name: null,
   value: null,
 
   didInsertElement: function () {
-    console.debug('App.ServiceConfigRadioButton.didInsertElement');
-    if (this.get('parentView.serviceConfig.value') === this.get('value')) {
-      console.debug(this.get('name') + ":" + this.get('value') + ' is 
checked');
-      this.set('checked', true);
-    }
+    this.set('checked', this.get('parentView.serviceConfig.value') === 
this.get('value'));
   },
 
   click: function () {
+    this.set('clicked', true);
     this.set('checked', true);
-    console.debug('App.ServiceConfigRadioButton.click');
     this.onChecked();
   },
 
@@ -776,16 +772,26 @@ App.ServiceConfigRadioButton = Ember.Checkbox.extend({
     // Wrapping the call with Ember.run.next prevents a problem where setting 
isVisible on component
     // causes JS error due to re-rendering.  For example, this occurs when 
switching the Config Group
     // in Service Config page
-    Em.run.next(this, function() {
-      console.debug('App.ServiceConfigRadioButton.onChecked');
-      this.set('parentView.serviceConfig.value', this.get('value'));
-      var components = this.get('parentView.serviceConfig.options');
-      if (components && components.someProperty('foreignKeys')) {
-        this.get('controller.stepConfigs').findProperty('serviceName', 
this.get('parentView.serviceConfig.serviceName')).propertyDidChange('errorCount');
-      }
-    });
+    if (this.get('clicked')) {
+      
this.sendRequestRorDependentConfigs(this.get('parentView.serviceConfig'));
+      Em.run.next(this, function() {
+        console.debug('App.ServiceConfigRadioButton.onChecked');
+        this.set('parentView.serviceConfig.value', this.get('value'));
+        var components = this.get('parentView.serviceConfig.options');
+        if (components && components.someProperty('foreignKeys')) {
+          this.get('controller.stepConfigs').findProperty('serviceName', 
this.get('parentView.serviceConfig.serviceName')).propertyDidChange('errorCount');
+        }
+        this.set('clicked', false);
+      });
+    }
   }.observes('checked'),
 
+  updateCheck: function() {
+    if (!this.get('clicked')) {
+      this.set('checked', this.get('parentView.serviceConfig.value') === 
this.get('value'));
+    }
+  }.observes('parentView.serviceConfig.value'),
+
   disabled: function () {
     return !this.get('parentView.serviceConfig.isEditable') ||
       !['addServiceController', 
'installerController'].contains(this.get('controller.wizardController.name')) 
&& /^New\s\w+\sDatabase$/.test(this.get('value'));

Reply via email to