ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jai...@apache.org
Subject ambari git commit: Revert "Revert "AMBARI-12575 UI should allow to set same values for config and it's override without any errors. (ababiicuk)""
Date Tue, 10 Nov 2015 20:38:03 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.1 7c837a1f4 -> aac2e715c


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

This reverts commit 7c837a1f4d5d4875c85a705e58b92713b955b4d7.


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

Branch: refs/heads/branch-2.1
Commit: aac2e715c8f2121c6d5fb2ce205941437e4b3893
Parents: 7c837a1
Author: Jaimin Jetly <jaimin@hortonworks.com>
Authored: Tue Nov 10 12:37:42 2015 -0800
Committer: Jaimin Jetly <jaimin@hortonworks.com>
Committed: Tue Nov 10 12:37:42 2015 -0800

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


http://git-wip-us.apache.org/repos/asf/ambari/blob/aac2e715/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/aac2e715/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..bca0ed2 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);
@@ -540,72 +536,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/aac2e715/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/aac2e715/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'));
-
-    });
-
   });
 
 });


Mime
View raw message