Browse Source

AMBARI-25481: Customize Widget Threshold validation issue (#3529)

Yu Hou 3 năm trước cách đây
mục cha
commit
7e9140cabb

+ 3 - 3
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({
     });
   }
 
-});
+});

+ 2 - 2
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'))
       })
 
     });

+ 1 - 1
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'))
       }),
 

+ 5 - 5
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
-});
+});