ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From onechipore...@apache.org
Subject ambari git commit: AMBARI-20338. Alert Definition Name with brackets marked as invalid (onechiporenko)
Date Tue, 07 Mar 2017 11:13:13 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 bf25d310f -> b9451a4b8


AMBARI-20338. Alert Definition Name with brackets marked as invalid (onechiporenko)


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

Branch: refs/heads/branch-2.5
Commit: b9451a4b87ab680219d1790d7b2a091e9c330da0
Parents: bf25d31
Author: Oleg Nechiporenko <onechiporenko@apache.org>
Authored: Tue Mar 7 12:24:31 2017 +0200
Committer: Oleg Nechiporenko <onechiporenko@apache.org>
Committed: Tue Mar 7 13:13:06 2017 +0200

----------------------------------------------------------------------
 ambari-web/app/messages.js              |  2 +-
 ambari-web/app/utils/validator.js       |  2 +-
 ambari-web/test/utils/validator_test.js | 22 ++++++++++++++++++++++
 3 files changed, 24 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/b9451a4b/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 6684f32..83cc85c 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -1123,7 +1123,7 @@ Em.I18n.translations = {
   'alerts.definition.name': 'Alert Definition Name',
   'alerts.saveChanges': 'You have unsaved changes',
 
-  'alert.definition.name.invalid': 'Invalid input. Only alphanumerics, underscores, hyphens,
percentage and spaces are allowed.',
+  'alert.definition.name.invalid': 'Invalid input. Only alphanumerics, underscores, hyphens,
percentage, brackets and spaces are allowed. Value should be less than 255 symbols.',
   'alerts.definition.details.enable': 'Enable',
   'alerts.definition.details.disable': 'Disable',
   'alerts.definition.details.enableDisable': 'Enable / Disable',

http://git-wip-us.apache.org/repos/asf/ambari/blob/b9451a4b/ambari-web/app/utils/validator.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/validator.js b/ambari-web/app/utils/validator.js
index 774215b..dd3d6c0 100644
--- a/ambari-web/app/utils/validator.js
+++ b/ambari-web/app/utils/validator.js
@@ -322,7 +322,7 @@ module.exports = {
    * @returns {boolean}
    */
   isValidAlertName: function(value) {
-    var alertNameRegex = /^[\s0-9a-z_\-%]+$/i;
+    var alertNameRegex = /^[\s0-9a-z_\-%\(\)]+$/i;
     return alertNameRegex.test(value);
   },
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/b9451a4b/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 f0167da..2cb7750 100644
--- a/ambari-web/test/utils/validator_test.js
+++ b/ambari-web/test/utils/validator_test.js
@@ -500,4 +500,26 @@ describe('validator', function () {
       })
     });
   });
+
+  describe('#isValidAlertName', function () {
+
+    [
+      {v: '', e: false},
+      {v: 'a', e: true},
+      {v: 'a b', e: true},
+      {v: '/', e: false},
+      {v: '/>1', e: false},
+      {v: 'a 1%', e: true},
+      {v: 'a (b)', e: true}
+    ].forEach(function (test) {
+
+      it(test.m || test.v, function () {
+        expect(validator.isValidAlertName(test.v)).to.be.equal(test.e);
+      })
+
+    });
+
+
+  });
+
 });


Mime
View raw message