You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ab...@apache.org on 2015/04/22 14:34:19 UTC

[1/2] ambari git commit: AMBARI-10654 Modifying capacity scheduler settings makes it blank. (ababiichuk)

Repository: ambari
Updated Branches:
  refs/heads/trunk f59e5af5a -> d539ffbb2


AMBARI-10654 Modifying capacity scheduler settings makes it blank. (ababiichuk)


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

Branch: refs/heads/trunk
Commit: 3bc8fc43766f4a5db480060e3d545c7ab0f2d7fd
Parents: f59e5af
Author: aBabiichuk <ab...@cybervisiontech.com>
Authored: Wed Apr 22 15:12:44 2015 +0300
Committer: aBabiichuk <ab...@cybervisiontech.com>
Committed: Wed Apr 22 15:12:44 2015 +0300

----------------------------------------------------------------------
 ambari-web/app/utils/config.js       |  1 +
 ambari-web/test/utils/config_test.js | 17 +++++++++++++----
 2 files changed, 14 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/3bc8fc43/ambari-web/app/utils/config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/config.js b/ambari-web/app/utils/config.js
index be50419..4b84872 100644
--- a/ambari-web/app/utils/config.js
+++ b/ambari-web/app/utils/config.js
@@ -1400,6 +1400,7 @@ App.config = Em.Object.create({
             filename: filename,
             isFinal: configsTextarea.get('isFinal'),
             isNotDefaultValue: configsTextarea.get('isNotDefaultValue'),
+            isRequiredByAgent: configsTextarea.get('isRequiredByAgent'),
             group: null
           }));
         }

http://git-wip-us.apache.org/repos/asf/ambari/blob/3bc8fc43/ambari-web/test/utils/config_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/utils/config_test.js b/ambari-web/test/utils/config_test.js
index 6a4563c..bd97b1c 100644
--- a/ambari-web/test/utils/config_test.js
+++ b/ambari-web/test/utils/config_test.js
@@ -134,28 +134,32 @@ describe('App.config', function () {
         configs: [Em.Object.create({
           "name": "capacity-scheduler",
           "value": "config1=value1",
-          "filename": "capacity-scheduler.xml"
+          "filename": "capacity-scheduler.xml",
+          "isRequiredByAgent": true
         })]
       },
       {
         configs: [Em.Object.create({
           "name": "capacity-scheduler",
           "value": "config1=value1\nconfig2=value2\n",
-          "filename": "capacity-scheduler.xml"
+          "filename": "capacity-scheduler.xml",
+          "isRequiredByAgent": false
         })]
       },
       {
         configs: [Em.Object.create({
           "name": "capacity-scheduler",
           "value": "config1=value1,value2\n",
-          "filename": "capacity-scheduler.xml"
+          "filename": "capacity-scheduler.xml",
+          "isRequiredByAgent": true
         })]
       },
       {
         configs: [Em.Object.create({
           "name": "capacity-scheduler",
           "value": "config1=value1 config2=value2\n",
-          "filename": "capacity-scheduler.xml"
+          "filename": "capacity-scheduler.xml",
+          "isRequiredByAgent": false
         })]
       }
     ];
@@ -165,6 +169,7 @@ describe('App.config', function () {
       expect(result.length).to.equal(1);
       expect(result[0].value).to.equal('value1');
       expect(result[0].name).to.equal('config1');
+      expect(result[0].isRequiredByAgent).to.be.true;
     });
     it('config1=value1\\nconfig2=value2\\n to two configs', function () {
       var result = App.config.textareaIntoFileConfigs.call(App.config, testData[1].configs, filename);
@@ -173,16 +178,20 @@ describe('App.config', function () {
       expect(result[0].name).to.equal('config1');
       expect(result[1].value).to.equal('value2');
       expect(result[1].name).to.equal('config2');
+      expect(result[0].isRequiredByAgent).to.be.false;
+      expect(result[1].isRequiredByAgent).to.be.false;
     });
     it('config1=value1,value2\n to one config', function () {
       var result = App.config.textareaIntoFileConfigs.call(App.config, testData[2].configs, filename);
       expect(result.length).to.equal(1);
       expect(result[0].value).to.equal('value1,value2');
       expect(result[0].name).to.equal('config1');
+      expect(result[0].isRequiredByAgent).to.be.true;
     });
     it('config1=value1 config2=value2 to two configs', function () {
       var result = App.config.textareaIntoFileConfigs.call(App.config, testData[3].configs, filename);
       expect(result.length).to.equal(1);
+      expect(result[0].isRequiredByAgent).to.be.false;
     });
   });
 


[2/2] ambari git commit: AMBARI-10601 Going to HBase enhanced configs page causes config change (additional). (ababiichuk)

Posted by ab...@apache.org.
AMBARI-10601 Going to HBase enhanced configs page causes config change (additional). (ababiichuk)


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

Branch: refs/heads/trunk
Commit: d539ffbb27dc652d403aae6611e097aec3190f00
Parents: 3bc8fc4
Author: aBabiichuk <ab...@cybervisiontech.com>
Authored: Wed Apr 22 15:32:30 2015 +0300
Committer: aBabiichuk <ab...@cybervisiontech.com>
Committed: Wed Apr 22 15:32:30 2015 +0300

----------------------------------------------------------------------
 .../convert_unit_widget_view_mixin.js           |  1 +
 ambari-web/app/models/service_config.js         |  6 ++++
 .../configs/widgets/list_config_widget_view.js  | 12 +++++---
 ambari-web/app/views/common/controls_view.js    |  2 +-
 .../widgets/list_config_widget_view_test.js     | 30 ++++++++++++++++----
 5 files changed, 41 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/d539ffbb/ambari-web/app/mixins/unit_convert/convert_unit_widget_view_mixin.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/unit_convert/convert_unit_widget_view_mixin.js b/ambari-web/app/mixins/unit_convert/convert_unit_widget_view_mixin.js
index 306f552..8f043ee 100644
--- a/ambari-web/app/mixins/unit_convert/convert_unit_widget_view_mixin.js
+++ b/ambari-web/app/mixins/unit_convert/convert_unit_widget_view_mixin.js
@@ -25,6 +25,7 @@ App.ConvertUnitWidgetViewMixin = Em.Mixin.create(App.BaseUnitConvertMixin, {
   /**
    * Get converted value according to widget value format from specified config property value.
    *
+   * @method widgetValueByConfigAttributes
    * @param {String|Number} value - config property value to convert
    * @param {Boolean} [returnObject=false] - returned value should be an array of objects
    * @returns {Number|Object[]}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d539ffbb/ambari-web/app/models/service_config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/service_config.js b/ambari-web/app/models/service_config.js
index 371c128..3af1b10 100644
--- a/ambari-web/app/models/service_config.js
+++ b/ambari-web/app/models/service_config.js
@@ -272,6 +272,12 @@ App.ServiceConfigProperty = Em.Object.extend({
     var supportsFinal = this.get('supportsFinal');
     var isFinal = this.get('isFinal');
     var defaultIsFinal = this.get('defaultIsFinal');
+    // ignore precision difference for configs with type of `float` which value may ends with 0
+    // e.g. between 0.4 and 0.40
+    if (this.get('stackConfigProperty') && this.get('stackConfigProperty.valueAttributes.type') == 'float') {
+      defaultValue = '' + parseFloat(defaultValue);
+      value = '' + parseFloat(value);
+    }
     return (defaultValue != null && value !== defaultValue) || (supportsFinal && isFinal !== defaultIsFinal);
   }.property('value', 'defaultValue', 'isEditable', 'isFinal', 'defaultIsFinal'),
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/d539ffbb/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 2132734..7e38f75 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
@@ -136,7 +136,7 @@ App.ListConfigWidgetView = App.ConfigWidgetView.extend({
       options.pushObject(configOption.create({
         value: entryValue.value,
         label: entryValue.label || entryValue.value,
-        description: entryValue.description
+        description: entryValue.description || ''
       }));
     });
     this.set('options', options);
@@ -202,8 +202,8 @@ App.ListConfigWidgetView = App.ConfigWidgetView.extend({
    */
   parseCardinality: function () {
     var cardinality = this.get('config.stackConfigProperty.valueAttributes.selection_cardinality');
-    this.set('allowedToSelect', numberUtils.getCardinalityValue(cardinality, true));
-    this.set('neededToSelect', numberUtils.getCardinalityValue(cardinality, false));
+    this.set('allowedToSelect', numberUtils.getCardinalityValue(cardinality, true) || 1);
+    this.set('neededToSelect', numberUtils.getCardinalityValue(cardinality, false) || 1);
   },
 
   /**
@@ -233,12 +233,16 @@ App.ListConfigWidgetView = App.ConfigWidgetView.extend({
   },
 
   /**
-   * Just a small checkbox-wrapper with improved click-handler
+   * Just a small checkbox-wrapper with modified click-handler
    * Should call <code>parentView.toggleOption</code>
    * User may click on the checkbox or on the link which wraps it, but action in both cases should be the same (<code>toggleOption</code>)
    * @type {Em.Checkbox}
    */
   checkBoxWithoutAction: Em.Checkbox.extend({
+    init: function() {
+      this._super();
+      this.off('change', this, this._updateElementValue);
+    },
     _updateElementValue: function () {
       var option = this.get('parentView.options').findProperty('value', this.get('value'));
       this.get('parentView').toggleOption({context: option});

http://git-wip-us.apache.org/repos/asf/ambari/blob/d539ffbb/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 0f2271f..4b8b31e 100644
--- a/ambari-web/app/views/common/controls_view.js
+++ b/ambari-web/app/views/common/controls_view.js
@@ -67,7 +67,7 @@ App.SupportsDependentConfigs = Ember.Mixin.create({
    */
   keyUp: function() {
     if (App.get('supports.enhancedConfigs')) {
-      this.get('controller').removeCurrentFromDependentList(this.get('serviceConfig'));
+      this.get('controller').removeCurrentFromDependentList(this.get('serviceConfig') || this.get('config'));
     }
   },
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/d539ffbb/ambari-web/test/views/common/configs/widgets/list_config_widget_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/configs/widgets/list_config_widget_view_test.js b/ambari-web/test/views/common/configs/widgets/list_config_widget_view_test.js
index 4d21b5d..47db1c9 100644
--- a/ambari-web/test/views/common/configs/widgets/list_config_widget_view_test.js
+++ b/ambari-web/test/views/common/configs/widgets/list_config_widget_view_test.js
@@ -33,11 +33,31 @@ describe('App.ListConfigWidgetView', function () {
         stackConfigProperty: Em.Object.create({
           valueAttributes: {
             entries: [
-              {value: '1', label: 'first label', description: '1'},
-              {value: '2', label: 'second label', description: '2'},
-              {value: '3', label: 'third label', description: '3'},
-              {value: '4', label: '4th label', description: '4'},
-              {value: '5', label: '5th label', description: '5'}
+              {
+                value: '1',
+                label: 'first label',
+                description: '1'
+              },
+              {
+                value: '2',
+                label: 'second label',
+                description: '2'
+              },
+              {
+                value: '3',
+                label: 'third label',
+                description: '3'
+              },
+              {
+                value: '4',
+                label: '4th label',
+                description: '4'
+              },
+              {
+                value: '5',
+                label: '4th label',
+                description: '5'
+              }
             ],
             selection_cardinality: '3'
           }