Repository: ambari Updated Branches: refs/heads/branch-2.1 4de51625d -> ff8b24020
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/ff8b2402 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ff8b2402 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ff8b2402 Branch: refs/heads/branch-2.1 Commit: ff8b24020c2b86166d8904a25b9589dffc3af3da Parents: 4de5162 Author: aBabiichuk <ababiic...@cybervisiontech.com> Authored: Wed Oct 28 16:57:22 2015 +0200 Committer: aBabiichuk <ababiic...@cybervisiontech.com> Committed: Wed Oct 28 16:57:47 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/ff8b2402/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 7e16acc..3551732 100644 --- a/ambari-web/app/mixins/common/configs/enhanced_configs.js +++ b/ambari-web/app/mixins/common/configs/enhanced_configs.js @@ -469,6 +469,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 if (dependentProperty) { Em.set(dependentProperty, 'value', initialValue); http://git-wip-us.apache.org/repos/asf/ambari/blob/ff8b2402/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 fe69e99..46df3b4 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'));