AMBARI-15038 Alert definitions: Percentage params get validation errors when they shouldn't (Joe Wang via rzang)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/f18601c7 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/f18601c7 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/f18601c7 Branch: refs/heads/branch-dev-patch-upgrade Commit: f18601c7c786945e0da8883e59b65686338ee2c9 Parents: d036fc0 Author: Richard Zang <rz...@apache.org> Authored: Tue Feb 16 11:11:54 2016 -0800 Committer: Richard Zang <rz...@apache.org> Committed: Tue Feb 16 11:11:54 2016 -0800 ---------------------------------------------------------------------- ambari-web/app/models/alerts/alert_config.js | 4 ++-- ambari-web/test/models/alerts/alert_config_test.js | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/f18601c7/ambari-web/app/models/alerts/alert_config.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/models/alerts/alert_config.js b/ambari-web/app/models/alerts/alert_config.js index c86b19a..867b45a 100644 --- a/ambari-web/app/models/alerts/alert_config.js +++ b/ambari-web/app/models/alerts/alert_config.js @@ -532,7 +532,7 @@ App.AlertConfigProperties.Parameters = { value = String(value).trim(); value = parseFloat(value); - return !isNaN(value) && value > 0 && value <= 100; + return !isNaN(value) && value > 0; }.property('value') }) @@ -622,7 +622,7 @@ App.AlertConfigProperties.Thresholds = { return false; } - return this.get('showInputForValue') ? !isNaN(value) && value > 0 && value <= 100 : true; + return this.get('showInputForValue') ? !isNaN(value) && value > 0 : true; }.property('displayValue', 'showInputForValue'), /** http://git-wip-us.apache.org/repos/asf/ambari/blob/f18601c7/ambari-web/test/models/alerts/alert_config_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/models/alerts/alert_config_test.js b/ambari-web/test/models/alerts/alert_config_test.js index 4b788f8..56f1577 100644 --- a/ambari-web/test/models/alerts/alert_config_test.js +++ b/ambari-web/test/models/alerts/alert_config_test.js @@ -104,13 +104,13 @@ describe('App.AlertConfigProperties', function () { {value: 'abc', expected: false}, {value: 'g1', expected: false}, {value: '1g', expected: false}, - {value: '123', expected: false}, + {value: '123', expected: true}, {value: '23', expected: true}, - {value: '123.8', expected: false}, + {value: '123.8', expected: true}, {value: '5.8', expected: true}, - {value: 123, expected: false}, + {value: 123, expected: true}, {value: 23, expected: true}, - {value: 123.8, expected: false}, + {value: 123.8, expected: true}, {value: 5.8, expected: true} ]).forEach(function (test) { it('value: ' + JSON.stringify(test.value) + ' ;result - ' + test.expected, function () {