You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by jl...@apache.org on 2015/11/10 18:10:57 UTC

ambari git commit: AMBARI-12575 UI should allow to set same values for config and it's override without any errors. (ababiicuk)

Repository: ambari
Updated Branches:
  refs/heads/branch-2.1 3dfdb6c61 -> d3219265a


AMBARI-12575 UI should allow to set same values for config and it's override without any errors. (ababiicuk)

Conflicts:
	ambari-web/app/models/configs/objects/service_config_property.js


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

Branch: refs/heads/branch-2.1
Commit: d3219265af0132edd6ec5109a56cf2ce7c319810
Parents: 3dfdb6c
Author: aBabiichuk <ab...@cybervisiontech.com>
Authored: Wed Jul 29 14:02:58 2015 +0300
Committer: Jayush Luniya <jl...@hortonworks.com>
Committed: Tue Nov 10 09:10:36 2015 -0800

----------------------------------------------------------------------
 ambari-web/app/messages.js                      |   1 -
 .../configs/objects/service_config_property.js  |  71 +---------
 .../objects/service_config_property_test.js     | 136 -------------------
 .../widgets/list_config_widget_view_test.js     |  17 ---
 4 files changed, 1 insertion(+), 224 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/d3219265/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index eba1551..496a759 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -432,7 +432,6 @@ Em.I18n.translations = {
   'users.userName.validationFail': 'Only lowercase letters and numbers are recommended; must start with a letter',
   'host.spacesValidation': 'Cannot contain whitespace',
   'host.trimspacesValidation': 'Cannot contain leading or trailing whitespace',
-  'config.override.valueEqualToParentConfig': 'Configuration overrides must have different value',
 
   'services.hdfs.rebalance.title' : 'HDFS Rebalance',
   'services.ganglia.description':'Ganglia Metrics Collection system',

http://git-wip-us.apache.org/repos/asf/ambari/blob/d3219265/ambari-web/app/models/configs/objects/service_config_property.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/configs/objects/service_config_property.js b/ambari-web/app/models/configs/objects/service_config_property.js
index 4b5bfd9..cd9bb59 100644
--- a/ambari-web/app/models/configs/objects/service_config_property.js
+++ b/ambari-web/app/models/configs/objects/service_config_property.js
@@ -505,10 +505,6 @@ App.ServiceConfigProperty = Em.Object.extend({
       }
     }
 
-    if (!isError) {
-      isError = this._validateOverrides();
-    }
-
     if (!isWarn || isError) { // Errors get priority
       this.set('warnMessage', '');
       this.set('warn', false);
@@ -522,6 +518,7 @@ App.ServiceConfigProperty = Em.Object.extend({
     } else {
       this.set('error', true);
     }
+<<<<<<< HEAD
   }.observes('value', 'isFinal', 'retypedPassword'),
 
   /**
@@ -540,72 +537,6 @@ App.ServiceConfigProperty = Em.Object.extend({
   }.property('displayType', 'name', 'App.isHadoop22Stack'),
 
   /**
-   * Check config overrides and parent config overrides (if exist)
-   * @returns {boolean}
-   * @private
-   * @method _validateOverrides
-   */
-  _validateOverrides: function () {
-    var isError = false;
-    var value = this._getValueForCheck(this.get('value'));
-    var isOriginalSCP = this.get('isOriginalSCP');
-    var supportsFinal = this.get('supportsFinal');
-    var isFinal = this.get('isFinal');
-    var parentSCP = this.get('parentSCP');
-    var overrides = this.get('overrides');
-    if (isOriginalSCP) {
-      if (overrides) {
-        overrides.forEach(function (override) {
-          if (value === this._getValueForCheck(override.get('value'))) {
-            if (supportsFinal) {
-              if (isFinal === override.get('isFinal')) {
-                this.set('errorMessage', Em.I18n.t('config.override.valueEqualToParentConfig'));
-                isError = true;
-              }
-            }
-            else {
-              this.set('errorMessage', Em.I18n.t('config.override.valueEqualToParentConfig'));
-              isError = true;
-            }
-          }
-        }, this);
-      }
-    } else {
-      if (!Em.isNone(parentSCP) && value === this._getValueForCheck(parentSCP.get('value'))) {
-        if (supportsFinal) {
-          if (isFinal === parentSCP.get('isFinal')) {
-            this.set('errorMessage', Em.I18n.t('config.override.valueEqualToParentConfig'));
-            isError = true;
-          }
-        }
-        else {
-          this.set('errorMessage', Em.I18n.t('config.override.valueEqualToParentConfig'));
-          isError = true;
-        }
-      }
-    }
-    return isError;
-  },
-
-  /**
-   * Some values should be little bit changed before checking for overrides values
-   * `directories`-values should be "trimmed" for multiple mew-line symbols
-   * @param {string} value
-   * @returns {string}
-   * @private
-   */
-  _getValueForCheck: function (value) {
-    value = '' + value;
-    switch(this.get('displayType')) {
-      case 'directories':
-        return value.replace(/(\n\r?)+/g, '\n').trim();
-        break;
-      default:
-        return value;
-    }
-  },
-
-  /**
    * Update description for `password`-config
    * Add extra-message about their comparison
    *

http://git-wip-us.apache.org/repos/asf/ambari/blob/d3219265/ambari-web/test/models/configs/objects/service_config_property_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/models/configs/objects/service_config_property_test.js b/ambari-web/test/models/configs/objects/service_config_property_test.js
index bda01a4..58e7eaa 100644
--- a/ambari-web/test/models/configs/objects/service_config_property_test.js
+++ b/ambari-web/test/models/configs/objects/service_config_property_test.js
@@ -474,116 +474,6 @@ describe('App.ServiceConfigProperty', function () {
     });
   });
 
-  describe('#_validateOverrides', function () {
-
-    Em.A([
-      {
-        m: 'original config',
-        e: false,
-        c: {
-          value: 'on',
-          isOriginalSCP: true,
-          supportsFinal: false,
-          isFinal: false,
-          parentSCP: null
-        }
-      },
-      {
-        m: 'not original config, value equal to parent',
-        e: true,
-        c: {
-          value: 'on',
-          isOriginalSCP: false,
-          supportsFinal: false,
-          isFinal: false,
-          parentSCP: App.ServiceConfigProperty.create({
-            value: 'on'
-          })
-        }
-      },
-      {
-        m: 'not original config, isFinal equal to parent',
-        e: false,
-        c: {
-          value: 'on',
-          isOriginalSCP: false,
-          supportsFinal: true,
-          isFinal: false,
-          parentSCP: App.ServiceConfigProperty.create({
-            value: 'off',
-            isFinal: false
-          })
-        }
-      },
-      {
-        m: 'not original config, isFinal equal to parent, but final not supported',
-        e: false,
-        c: {
-          value: 'on',
-          isOriginalSCP: false,
-          supportsFinal: false,
-          isFinal: false,
-          parentSCP: App.ServiceConfigProperty.create({
-            value: 'off',
-            isFinal: false
-          })
-        }
-      },
-      {
-        m: 'not original config, parent override doesn\'t have same value',
-        e: false,
-        c: {
-          value: 'on',
-          isOriginalSCP: false,
-          supportsFinal: true,
-          isFinal: false,
-          parentSCP: App.ServiceConfigProperty.create({
-            value: 'off',
-            isFinal: true,
-            overrides: [
-              App.ServiceConfigProperty.create({
-                value: 'another',
-                isOriginalSCP: false
-              })
-            ]
-          })
-        }
-      },
-      {
-        m: '`directories`-config with almost equal value',
-        e: true,
-        c: {
-          value: "/hadoop/hdfs/data\n\n",
-          displayType: 'directories',
-          supportsFinal: false,
-          isOriginalSCP: false,
-          parentSCP: App.ServiceConfigProperty.create({
-            value: "/hadoop/hdfs/data\n"
-          })
-        }
-      },
-      {
-        m: '`directories`-config with almost equal value (2)',
-        e: true,
-        c: {
-          value: "/hadoop/hdfs/data",
-          displayType: 'directories',
-          supportsFinal: false,
-          isOriginalSCP: false,
-          parentSCP: App.ServiceConfigProperty.create({
-            value: "/hadoop/hdfs/data\n"
-          })
-        }
-      }
-    ]).forEach(function (test) {
-      it(test.m, function () {
-        serviceConfigProperty.reopen(test.c);
-        expect(serviceConfigProperty._validateOverrides()).to.equal(test.e);
-      });
-    });
-
-  });
-
   describe('#undoAvailable', function () {
 
     Em.A([
@@ -619,32 +509,6 @@ describe('App.ServiceConfigProperty', function () {
 
   });
 
-  describe('#_getValueForCheck', function () {
-
-    beforeEach(function () {
-      serviceConfigProperty.setProperties({
-        value: "/hadoop/hdfs/data\n",
-        displayType: 'directories',
-        supportsFinal: false,
-        isOriginalSCP: true,
-        overrides: [
-          Em.Object.create({
-            value: "/hadoop/hdfs/data\n\n"
-          })
-        ]
-      });
-    });
-
-    it('should trim value', function () {
-      expect(serviceConfigProperty._getValueForCheck(serviceConfigProperty.get('value'))).to.equal('/hadoop/hdfs/data');
-    });
-
-    it('should trim value 2', function () {
-      expect(serviceConfigProperty._getValueForCheck(serviceConfigProperty.get('overrides.0.value'))).to.equal('/hadoop/hdfs/data');
-    });
-
-  });
-
   describe('#overrideIsFinalValues', function () {
     it('should be defined as empty array', function () {
       expect(serviceConfigProperty.get('overrideIsFinalValues')).to.eql([]);

http://git-wip-us.apache.org/repos/asf/ambari/blob/d3219265/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 3db2dcb..d72e38e 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
@@ -26,8 +26,6 @@ describe('App.ListConfigWidgetView', function () {
     view = App.ListConfigWidgetView.create({
       initPopover: Em.K,
       config: Em.Object.create({
-        _validateOverrides: App.ServiceConfigProperty.prototype._validateOverrides,
-        _getValueForCheck: App.ServiceConfigProperty.prototype._getValueForCheck,
         validate: App.ServiceConfigProperty.prototype.validate,
         name: 'a.b.c',
         savedValue: '2,1',
@@ -194,21 +192,6 @@ describe('App.ListConfigWidgetView', function () {
       view.get('options').setEach('isSelected', true);
       expect(view.get('config.errorMessage')).to.equal('');
     });
-
-    it('check override', function () {
-
-      view.get('config').setProperties({
-        isOriginalSCP: false,
-        parentSCP: Em.Object.create({
-          value: '2,1',
-          isFinal: false
-        })
-      });
-      view.checkSelectedItemsCount();
-      expect(view.get('config.errorMessage')).to.equal(Em.I18n.t('config.override.valueEqualToParentConfig'));
-
-    });
-
   });
 
 });