Prechádzať zdrojové kódy

AMBARI-10502. Toggle widget with depended_by not making call to /recommendations (onechiporenko)

Oleg Nechiporenko 10 rokov pred
rodič
commit
cfdb955bd3

+ 2 - 1
ambari-web/app/mixins/common/configs/enhanced_configs.js

@@ -348,11 +348,12 @@ App.EnhancedConfigsMixin = Em.Mixin.create({
   /**
    * get array of config objects for current service depends on config group
    * for default group - it will be current stepConfigs
-   * for not default group - overriden property in case there is such property in group
+   * for not default group - overridden property in case there is such property in group
    * otherwise - property from default group
    * @param stepConfigs
    * @returns {Object[]}
    * @private
+   * @method _getConfigsByGroup
    */
   _getConfigsByGroup: function(stepConfigs) {
     if (this.get('selectedConfigGroup.isDefault') || this.get('controller.name') === 'wizardStep7Controller') {

+ 3 - 0
ambari-web/app/views/common/configs/widgets/combo_config_widget_view.js

@@ -103,6 +103,8 @@ 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'));
   },
 
   /**
@@ -110,6 +112,7 @@ App.ComboConfigWidgetView = App.ConfigWidgetView.extend({
    * @method restoreValue
    */
   restoreValue: function() {
+    this._super();
     this.setConfigValue({ context: this.get('config.defaultValue') });
   }
 

+ 2 - 0
ambari-web/app/views/common/configs/widgets/list_config_widget_view.js

@@ -219,6 +219,8 @@ 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;
   },
 

+ 0 - 10
ambari-web/app/views/common/configs/widgets/slider_config_widget_view.js

@@ -163,16 +163,6 @@ App.SliderConfigWidgetView = App.ConfigWidgetView.extend({
     this.removeObserver('mirrorStep', this, this.changeBoundaries);
   },
 
-  /**
-   * view class for text box that is used with slider widget
-   * @type {Em.TextField}
-   */
-  MirrorValueView: Em.TextField.extend({
-    focusOut: function() {
-      this.get('parentView').sendRequestRorDependentConfigs(this.get('parentView.config'));
-    }
-  }),
-
   /**
    * Check if <code>mirrorValue</code> was updated by user
    * Validate it. If value is correct, set it to slider and config.value

+ 2 - 0
ambari-web/app/views/common/configs/widgets/time_interval_spinner_view.js

@@ -193,6 +193,8 @@ App.TimeIntervalSpinnerView = App.ConfigWidgetView.extend({
    */
   setConfigValue: function() {
     this.set('config.value', this.configValueByWidget(this.get('content')));
+    this.get('controller').removeCurrentFromDependentList(this.get('config'));
+    this.sendRequestRorDependentConfigs(this.get('config'));
   },
 
   /**

+ 2 - 0
ambari-web/app/views/common/configs/widgets/toggle_config_widget_view.js

@@ -91,6 +91,8 @@ App.ToggleConfigWidgetView = App.ConfigWidgetView.extend({
         handleWidth: 85,
         onSwitchChange: function (event, state) {
           self.set('switcherValue', state);
+          self.get('controller').removeCurrentFromDependentList(self.get('config'));
+          self.sendRequestRorDependentConfigs(self.get('config'));
         }
       });
       this.set('switcher', switcher);

+ 5 - 5
ambari-web/app/views/common/controls_view.js

@@ -122,7 +122,7 @@ App.SupportsDependentConfigs = Ember.Mixin.create({
 });
 
 /**
- * mixin set class that serve as unique element identificator,
+ * mixin set class that serve as unique element identifier,
  * id not used in order to avoid collision with ember ids
  */
 App.ServiceConfigCalculateId = Ember.Mixin.create({
@@ -152,14 +152,14 @@ App.ServiceConfigTextField = Ember.TextField.extend(App.ServiceConfigPopoverSupp
     }
   },
   //Set editDone true for last edited config text field parameter
-  focusOut: function (event) {
+  focusOut: function () {
     if (this.get('serviceConfig.isNotDefaultValue')) {
       this.sendRequestRorDependentConfigs(this.get('serviceConfig'));
     }
     this.get('serviceConfig').set("editDone", true);
   },
   //Set editDone false for all current category config text field parameter
-  focusIn: function (event) {
+  focusIn: function () {
     if (!this.get('serviceConfig.isOverridden') && !this.get('serviceConfig.isComparison')) {
       this.get("parentView.categoryConfigsAll").setEach("editDone", false);
     }
@@ -187,7 +187,7 @@ App.ServiceConfigTextFieldWithUnit = Ember.View.extend(App.ServiceConfigPopoverS
   placeholderBinding: 'serviceConfig.defaultValue',
 
   //Set editDone true for last edited config text field parameter
-  focusOut: function (event) {
+  focusOut: function () {
     if (this.get('serviceConfig.isNotDefaultValue')) {
       this.sendRequestRorDependentConfigs(this.get('serviceConfig'));
     }
@@ -775,7 +775,7 @@ App.ServiceConfigMasterHostView = Ember.View.extend(App.ServiceConfigHostPopover
 
 /**
  * text field property view that enables possibility
- * for check connectio
+ * for check connection
  * @type {*}
  */
 App.checkConnectionView = App.ServiceConfigTextField.extend({

+ 3 - 0
ambari-web/test/views/common/configs/widgets/time_interval_spinner_view_test.js

@@ -23,6 +23,9 @@ describe('App.TimeIntervalSpinnerView', function () {
 
   beforeEach(function () {
     view = App.TimeIntervalSpinnerView.create({
+      controller: Em.Object.create({
+        removeCurrentFromDependentList: Em.K
+      }),
       initPopover: Em.K,
       checkErrors: Em.K
     });