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-12533 Property '% of Region Servers allocated to Write Buffers' become empty. (ababiichuk)
Date Fri, 24 Jul 2015 17:56:49 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.1 4a878cdb5 -> f419d30ef


AMBARI-12533 Property '% of Region Servers allocated to Write Buffers' become empty. (ababiichuk)


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

Branch: refs/heads/branch-2.1
Commit: f419d30ef63c1e10e032765d068f8c201a05689a
Parents: 4a878cd
Author: aBabiichuk <ababiichuk@hortonworks.com>
Authored: Fri Jul 24 20:42:24 2015 +0300
Committer: aBabiichuk <ababiichuk@hortonworks.com>
Committed: Fri Jul 24 20:56:34 2015 +0300

----------------------------------------------------------------------
 .../configs/objects/service_config_property.js       | 12 +++++++++---
 ambari-web/app/utils/validator.js                    |  9 +++++++++
 ambari-web/test/utils/validator_test.js              | 15 +++++++++++++++
 3 files changed, 33 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/f419d30e/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 bcd007d..db09678 100644
--- a/ambari-web/app/models/configs/objects/service_config_property.js
+++ b/ambari-web/app/models/configs/objects/service_config_property.js
@@ -356,7 +356,9 @@ App.ServiceConfigProperty = Em.Object.extend({
     if (!isError) {
       switch (this.get('displayType')) {
         case 'int':
-          if (!validator.isValidInt(value)) {
+          if (validator.isConfigValueLink(value)) {
+            isError = false;
+          } else if (!validator.isValidInt(value)) {
             this.set('errorMessage', 'Must contain digits only');
             isError = true;
           } else {
@@ -369,7 +371,9 @@ App.ServiceConfigProperty = Em.Object.extend({
           }
           break;
         case 'float':
-          if (!validator.isValidFloat(value)) {
+          if (validator.isConfigValueLink(value)) {
+            isError = false;
+          } else if (!validator.isValidFloat(value)) {
             this.set('errorMessage', 'Must be a valid number');
             isError = true;
           }
@@ -441,7 +445,9 @@ App.ServiceConfigProperty = Em.Object.extend({
           break;
         case 'advanced':
           if(this.get('name')=='javax.jdo.option.ConnectionURL' || this.get('name')=='oozie.service.JPAService.jdbc.url')
{
-            if (validator.isNotTrimmed(value)) {
+            if (validator.isConfigValueLink(value)) {
+              isError = false;
+            } else if (validator.isNotTrimmed(value)) {
               this.set('errorMessage', Em.I18n.t('host.trimspacesValidation'));
               isError = true;
             }

http://git-wip-us.apache.org/repos/asf/ambari/blob/f419d30e/ambari-web/app/utils/validator.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/validator.js b/ambari-web/app/utils/validator.js
index 6ed45fd..4dd967b 100644
--- a/ambari-web/app/utils/validator.js
+++ b/ambari-web/app/utils/validator.js
@@ -59,6 +59,15 @@ module.exports = {
   },
 
   /**
+   * defines if config value looks like link to other config
+   * @param value
+   * @returns {boolean}
+   */
+  isConfigValueLink: function(value) {
+    return /^\${.+}$/.test(value);
+  },
+
+  /**
    * validate directory with slash at the start
    * @param value
    * @returns {boolean}

http://git-wip-us.apache.org/repos/asf/ambari/blob/f419d30e/ambari-web/test/utils/validator_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/utils/validator_test.js b/ambari-web/test/utils/validator_test.js
index 1219250..af1749e 100644
--- a/ambari-web/test/utils/validator_test.js
+++ b/ambari-web/test/utils/validator_test.js
@@ -296,6 +296,21 @@ describe('validator', function () {
       })
     });
   });
+
+  describe('#isConfigValueLink', function() {
+    var tests = [
+      {m:'link valid',i:'${asd}',e:true},
+      {m:'empty link ${} -invalid',i:'${}',e:false},
+      {m:'${ just wrong',i:'${',e:false},
+      {m:'anything  just wrong',i:'anything',e:false}
+    ];
+    tests.forEach(function(test) {
+      it(test.m + ' ', function () {
+        expect(validator.isConfigValueLink(test.i)).to.equal(test.e);
+      })
+    });
+  });
+
   describe('#isValidDataNodeDir(value)', function() {
     var tests = [
       {m:'"dir" - invalid',i:'dir',e:false},


Mime
View raw message