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-10585 Checkboxes in the DependedConfigsPopup become unchecked part2. (ababiichuk)
Date Mon, 20 Apr 2015 12:56:15 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk e5cfe183f -> 6f33889d9


AMBARI-10585 Checkboxes in the DependedConfigsPopup become unchecked part2. (ababiichuk)


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

Branch: refs/heads/trunk
Commit: 6f33889d91a1714cf27b66992bae8796fa606a3c
Parents: e5cfe18
Author: aBabiichuk <ababiichuk@cybervisiontech.com>
Authored: Mon Apr 20 15:42:10 2015 +0300
Committer: aBabiichuk <ababiichuk@cybervisiontech.com>
Committed: Mon Apr 20 15:42:10 2015 +0300

----------------------------------------------------------------------
 .../mixins/common/configs/enhanced_configs.js   | 24 ++++++++++++--------
 .../widgets/checkbox_config_widget_view.js      |  1 -
 .../configs/widgets/combo_config_widget_view.js |  1 -
 .../configs/widgets/config_widget_view.js       |  1 -
 .../configs/widgets/list_config_widget_view.js  |  1 -
 .../widgets/slider_config_widget_view.js        |  1 -
 .../widgets/time_interval_spinner_view.js       |  1 -
 .../widgets/toggle_config_widget_view.js        |  2 --
 ambari-web/app/views/common/controls_view.js    | 10 ++++++--
 .../common/configs/enhanced_configs_test.js     |  2 +-
 10 files changed, 23 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/6f33889d/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 c027c93..a08d991 100644
--- a/ambari-web/app/mixins/common/configs/enhanced_configs.js
+++ b/ambari-web/app/mixins/common/configs/enhanced_configs.js
@@ -157,12 +157,13 @@ App.EnhancedConfigsMixin = Em.Mixin.create({
    * @method removeCurrentFromDependentList
    */
   removeCurrentFromDependentList: function (config) {
-    var current = this.get('_dependentConfigValues').filterProperty('propertyName', config.get('name')).findProperty('fileName',
App.config.getConfigTagFromFileName(config.get('filename')));
+    var current = this.get('_dependentConfigValues').find(function(dependentConfig) {
+      return Em.get(dependentConfig, 'propertyName') == config.get('name') && Em.get(dependentConfig,
'fileName') == App.config.getConfigTagFromFileName(config.get('filename'))
+    });
     if (current) {
       Em.setProperties(current, {
           'saveRecommended': false,
-          'saveRecommendedDefault': false,
-          'value': config.get('value')
+          'saveRecommendedDefault': false
         });
     }
   },
@@ -409,27 +410,30 @@ App.EnhancedConfigsMixin = Em.Mixin.create({
       for (var propertyName in configs[key].properties) {
         /**  if property exists and has value **/
         var cp = configProperties.findProperty('name', propertyName);
-        var value = cp && cp.get('value');
+        var defaultValue = cp && cp.get('defaultValue');
 
-        if (!Em.isNone(value)) {
-          if (!updateOnlyBoundaries) { //on first initial request we don't need to change
values
+        if (!Em.isNone(defaultValue)) {
+          if (!updateOnlyBoundaries && Em.isArray(parentConfigs) && parentConfigs.length)
{ //on first initial request we don't need to change values
             var dependentProperty = this.get('_dependentConfigValues').findProperty('propertyName',
propertyName);
             if (dependentProperty) {
-              if (value != configs[key].properties[propertyName]) {
-                Em.set(dependentProperty, 'value', value);
+              if (defaultValue != configs[key].properties[propertyName]) {
                 Em.set(dependentProperty, 'recommendedValue', configs[key].properties[propertyName]);
                 Em.set(dependentProperty, 'saveRecommended', true);
                 Em.set(dependentProperty, 'parentConfigs', dependentProperty.parentConfigs.concat(parentPropertiesNames).uniq());
+              } else if (defaultValue === configs[key].properties[propertyName]) {
+                /** if recommended value same as default we shouldn't show it in popup **/
+                cp.set('value', defaultValue);
+                this.get('_dependentConfigValues').removeObject(dependentProperty);
               }
             } else {
-              if (value != configs[key].properties[propertyName]) {
+              if (defaultValue != configs[key].properties[propertyName] && !parentConfigs.mapProperty('name').contains(propertyName))
{
                 this.get('_dependentConfigValues').pushObject({
                   saveRecommended: true,
                   saveRecommendedDefault: true,
                   fileName: key,
                   propertyName: propertyName,
                   configGroup: group ? group.get('name') : service.get('displayName') + "
Default",
-                  value: value,
+                  value: defaultValue,
                   parentConfigs: parentPropertiesNames,
                   serviceName: serviceName,
                   allowChangeGroup: serviceName != this.get('content.serviceName') &&
!this.get('selectedConfigGroup.isDefault'),

http://git-wip-us.apache.org/repos/asf/ambari/blob/6f33889d/ambari-web/app/views/common/configs/widgets/checkbox_config_widget_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/widgets/checkbox_config_widget_view.js b/ambari-web/app/views/common/configs/widgets/checkbox_config_widget_view.js
index 4419605..7acd382 100644
--- a/ambari-web/app/views/common/configs/widgets/checkbox_config_widget_view.js
+++ b/ambari-web/app/views/common/configs/widgets/checkbox_config_widget_view.js
@@ -47,7 +47,6 @@ App.CheckboxConfigWidgetView = App.ConfigWidgetView.extend({
     focusIn: function() {},
     toggleValue: function() {
       this._super();
-      this.get('controller').removeCurrentFromDependentList(this.get('serviceConfig'));
       this.sendRequestRorDependentConfigs(this.get('serviceConfig'));
     }.observes('checked')
   }),

http://git-wip-us.apache.org/repos/asf/ambari/blob/6f33889d/ambari-web/app/views/common/configs/widgets/combo_config_widget_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/widgets/combo_config_widget_view.js b/ambari-web/app/views/common/configs/widgets/combo_config_widget_view.js
index e5aaadb..bbeb99b 100644
--- a/ambari-web/app/views/common/configs/widgets/combo_config_widget_view.js
+++ b/ambari-web/app/views/common/configs/widgets/combo_config_widget_view.js
@@ -103,7 +103,6 @@ App.ComboConfigWidgetView = App.ConfigWidgetView.extend({
   setConfigValue: function(e) {
     this.set('config.value', e.context);
     this.set('content.value', this.generateWidgetValue(e.context));
-    this.get('controller').removeCurrentFromDependentList(this.get('config'));
     this.sendRequestRorDependentConfigs(this.get('config'));
   },
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/6f33889d/ambari-web/app/views/common/configs/widgets/config_widget_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/widgets/config_widget_view.js b/ambari-web/app/views/common/configs/widgets/config_widget_view.js
index fbbf0d1..5a2566f 100644
--- a/ambari-web/app/views/common/configs/widgets/config_widget_view.js
+++ b/ambari-web/app/views/common/configs/widgets/config_widget_view.js
@@ -127,7 +127,6 @@ App.ConfigWidgetView = Em.View.extend(App.SupportsDependentConfigs, App.WidgetPo
   restoreValue: function () {
     var self = this;
     this.set('config.value', this.get('config.defaultValue'));
-    this.get('controller').removeCurrentFromDependentList(this.get('config'));
     this.sendRequestRorDependentConfigs(this.get('config')).done(function() {
       self.restoreDependentConfigs(self.get('config'));
     });

http://git-wip-us.apache.org/repos/asf/ambari/blob/6f33889d/ambari-web/app/views/common/configs/widgets/list_config_widget_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/widgets/list_config_widget_view.js b/ambari-web/app/views/common/configs/widgets/list_config_widget_view.js
index 18cd348..2132734 100644
--- a/ambari-web/app/views/common/configs/widgets/list_config_widget_view.js
+++ b/ambari-web/app/views/common/configs/widgets/list_config_widget_view.js
@@ -219,7 +219,6 @@ App.ListConfigWidgetView = App.ConfigWidgetView.extend({
     option.set('order', orderCounter);
     option.toggleProperty('isSelected');
     this.incrementProperty('orderCounter');
-    this.get('controller').removeCurrentFromDependentList(this.get('config'));
     this.sendRequestRorDependentConfigs(this.get('config'));
     return false;
   },

http://git-wip-us.apache.org/repos/asf/ambari/blob/6f33889d/ambari-web/app/views/common/configs/widgets/slider_config_widget_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/widgets/slider_config_widget_view.js b/ambari-web/app/views/common/configs/widgets/slider_config_widget_view.js
index 228f6e2..fe0981d 100644
--- a/ambari-web/app/views/common/configs/widgets/slider_config_widget_view.js
+++ b/ambari-web/app/views/common/configs/widgets/slider_config_widget_view.js
@@ -300,7 +300,6 @@ App.SliderConfigWidgetView = App.ConfigWidgetView.extend({
        * action to run sendRequestRorDependentConfigs when
        * we have changed config value within slider
        */
-      self.get('controller').removeCurrentFromDependentList(self.get('config'));
       self.sendRequestRorDependentConfigs(self.get('config'));
     });
     this.set('slider', slider);

http://git-wip-us.apache.org/repos/asf/ambari/blob/6f33889d/ambari-web/app/views/common/configs/widgets/time_interval_spinner_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/widgets/time_interval_spinner_view.js b/ambari-web/app/views/common/configs/widgets/time_interval_spinner_view.js
index d3e8f7e..a4653de 100644
--- a/ambari-web/app/views/common/configs/widgets/time_interval_spinner_view.js
+++ b/ambari-web/app/views/common/configs/widgets/time_interval_spinner_view.js
@@ -194,7 +194,6 @@ App.TimeIntervalSpinnerView = App.ConfigWidgetView.extend({
    */
   setConfigValue: function() {
     this.set('config.value', '' + this.configValueByWidget(this.get('content')));
-    this.get('controller').removeCurrentFromDependentList(this.get('config'));
   },
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/6f33889d/ambari-web/app/views/common/configs/widgets/toggle_config_widget_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/widgets/toggle_config_widget_view.js b/ambari-web/app/views/common/configs/widgets/toggle_config_widget_view.js
index f95d070..7a78c6b 100644
--- a/ambari-web/app/views/common/configs/widgets/toggle_config_widget_view.js
+++ b/ambari-web/app/views/common/configs/widgets/toggle_config_widget_view.js
@@ -126,7 +126,6 @@ App.ToggleConfigWidgetView = App.ConfigWidgetView.extend({
         onSwitchChange: function (event, state) {
           self.set('switcherValue', state);
           if (!self.get('skipRequestForDependencies')) {
-            self.get('controller').removeCurrentFromDependentList(self.get('config'));
             self.sendRequestRorDependentConfigs(self.get('config'));
           }
         }
@@ -160,7 +159,6 @@ App.ToggleConfigWidgetView = App.ConfigWidgetView.extend({
     this.get('switcher').bootstrapSwitch('toggleState', value);
     this.set('skipRequestForDependencies', false);
     this.set('switcherValue', value);
-    this.get('controller').removeCurrentFromDependentList(this.get('config'));
   },
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/6f33889d/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 c042a76..0f2271f 100644
--- a/ambari-web/app/views/common/controls_view.js
+++ b/ambari-web/app/views/common/controls_view.js
@@ -76,18 +76,24 @@ App.SupportsDependentConfigs = Ember.Mixin.create({
    * and in case there was changes shows popup with info about changed configs
    *
    * @param {App.ServiceConfigProperty} config
+   * @param {function} complete
    * @returns {$.Deferred}
    */
   sendRequestRorDependentConfigs: function(config) {
     if (App.get('supports.enhancedConfigs') && ['mainServiceInfoConfigsController','wizardStep7Controller'].contains(this.get('controller.name')))
{
       var name = config.get('name');
+      var controller = this.get('controller');
       var type = App.config.getConfigTagFromFileName(config.get('filename'));
       var p = App.StackConfigProperty.find(name + '_' + type);
       if (p && p.get('propertyDependedBy.length') > 0) {
-        return this.get('controller').getRecommendationsForDependencies([{
+        return controller.getRecommendationsForDependencies([{
           "type": type,
           "name": name
-        }]);
+        }], false, function() {
+          controller.removeCurrentFromDependentList(config);
+        });
+      } else {
+        controller.removeCurrentFromDependentList(config);
       }
     }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/6f33889d/ambari-web/test/mixins/common/configs/enhanced_configs_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mixins/common/configs/enhanced_configs_test.js b/ambari-web/test/mixins/common/configs/enhanced_configs_test.js
index bc88a9f..4b0e141 100644
--- a/ambari-web/test/mixins/common/configs/enhanced_configs_test.js
+++ b/ambari-web/test/mixins/common/configs/enhanced_configs_test.js
@@ -37,7 +37,7 @@ describe('App.EnhancedConfigsMixin', function() {
         saveRecommendedDefault: false,
         propertyName: 'p1',
         fileName: 'f1',
-        value: 'v2'
+        value: 'v1'
       });
     });
   });


Mime
View raw message