You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by wu...@apache.org on 2022/11/17 09:25:23 UTC

[ambari] branch trunk updated: AMBARI-25481: Customize Widget Threshold validation issue (#3529)

This is an automated email from the ASF dual-hosted git repository.

wuzhiguo pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 7e9140cabb AMBARI-25481: Customize Widget Threshold validation issue (#3529)
7e9140cabb is described below

commit 7e9140cabb41729dbfc1f67cab380bded2f5c72c
Author: Yu Hou <52...@qq.com>
AuthorDate: Thu Nov 17 17:25:18 2022 +0800

    AMBARI-25481: Customize Widget Threshold validation issue (#3529)
---
 ambari-web/app/mixins/main/dashboard/widgets/editable.js       |  6 +++---
 .../app/mixins/main/dashboard/widgets/editable_with_limit.js   |  4 ++--
 .../mixins/main/dashboard/widgets/single_numeric_threshold.js  |  2 +-
 .../views/common/modal_popups/edit_dashboard_widget_popup.js   | 10 +++++-----
 4 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/ambari-web/app/mixins/main/dashboard/widgets/editable.js b/ambari-web/app/mixins/main/dashboard/widgets/editable.js
index 482ff6af37..bd518fb936 100644
--- a/ambari-web/app/mixins/main/dashboard/widgets/editable.js
+++ b/ambari-web/app/mixins/main/dashboard/widgets/editable.js
@@ -27,8 +27,8 @@ App.EditableWidgetMixin = Em.Mixin.create({
 
       sliderHandlersManager: App.EditDashboardWidgetPopup.DoubleHandlers.create({
         maxValue: 'infinity',
-        thresholdMin: this.get('thresholdMin'),
-        thresholdMax: this.get('thresholdMax')
+        thresholdMin: Number(this.get('thresholdMin')),
+        thresholdMax: Number(this.get('thresholdMax'))
       }),
 
       sliderDisabled: true,
@@ -39,4 +39,4 @@ App.EditableWidgetMixin = Em.Mixin.create({
     });
   }
 
-});
\ No newline at end of file
+});
diff --git a/ambari-web/app/mixins/main/dashboard/widgets/editable_with_limit.js b/ambari-web/app/mixins/main/dashboard/widgets/editable_with_limit.js
index 1cb96df857..abf49f74d7 100644
--- a/ambari-web/app/mixins/main/dashboard/widgets/editable_with_limit.js
+++ b/ambari-web/app/mixins/main/dashboard/widgets/editable_with_limit.js
@@ -31,8 +31,8 @@ App.EditableWithLimitWidgetMixin = Em.Mixin.create({
 
       sliderHandlersManager: App.EditDashboardWidgetPopup.DoubleHandlers.create({
         maxValue: parseFloat(this.get('maxValue')),
-        thresholdMin: this.get('thresholdMin'),
-        thresholdMax: this.get('thresholdMax')
+        thresholdMin: Number(this.get('thresholdMin')),
+        thresholdMax: Number(this.get('thresholdMax'))
       })
 
     });
diff --git a/ambari-web/app/mixins/main/dashboard/widgets/single_numeric_threshold.js b/ambari-web/app/mixins/main/dashboard/widgets/single_numeric_threshold.js
index 36172b7850..643576a8d0 100644
--- a/ambari-web/app/mixins/main/dashboard/widgets/single_numeric_threshold.js
+++ b/ambari-web/app/mixins/main/dashboard/widgets/single_numeric_threshold.js
@@ -29,7 +29,7 @@ App.SingleNumericThresholdMixin = Em.Mixin.create({
       widgetView: this,
 
       sliderHandlersManager: App.EditDashboardWidgetPopup.SingleHandler.create({
-        thresholdMin: this.get('thresholdMin'),
+        thresholdMin: Number(this.get('thresholdMin')),
         maxValue: parseFloat(this.get('maxValue'))
       }),
 
diff --git a/ambari-web/app/views/common/modal_popups/edit_dashboard_widget_popup.js b/ambari-web/app/views/common/modal_popups/edit_dashboard_widget_popup.js
index 7ea1b32206..20ee51e14a 100644
--- a/ambari-web/app/views/common/modal_popups/edit_dashboard_widget_popup.js
+++ b/ambari-web/app/views/common/modal_popups/edit_dashboard_widget_popup.js
@@ -157,10 +157,10 @@ const DoubleHandlers = SingleHandler.extend({
    * @type {string}
    */
   thresholdMinErrorMessage: function () {
-    var thresholdMin = this.get('thresholdMin');
-    var thresholdMax = this.get('thresholdMax');
-    var maxValue = this.get('maxValue');
-    var minValue = this.get('minValue');
+    var thresholdMin = Number(this.get('thresholdMin'));
+    var thresholdMax = Number(this.get('thresholdMax'));
+    var maxValue = Number(this.get('maxValue'));
+    var minValue = Number(this.get('minValue'));
     if (!isValidFloat(thresholdMin) || thresholdMin > maxValue || thresholdMin < minValue) {
       return Em.I18n.t('dashboard.widgets.error.invalid').format(minValue, maxValue);
     }
@@ -433,4 +433,4 @@ App.EditDashboardWidgetPopup.reopenClass({
   SingleHandler,
   DoubleHandlers,
   EditDashboardWidgetPopupBody
-});
\ No newline at end of file
+});


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@ambari.apache.org
For additional commands, e-mail: commits-help@ambari.apache.org