diff --git a/ui-ngx/src/app/modules/home/components/widget/config/basic/gauge/digital-simple-gauge-basic-config.component.ts b/ui-ngx/src/app/modules/home/components/widget/config/basic/gauge/digital-simple-gauge-basic-config.component.ts index e0ca65cdea..6d837f476c 100644 --- a/ui-ngx/src/app/modules/home/components/widget/config/basic/gauge/digital-simple-gauge-basic-config.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/config/basic/gauge/digital-simple-gauge-basic-config.component.ts @@ -30,7 +30,7 @@ import { getTimewindowConfig, setTimewindowConfig } from '@home/components/widget/config/timewindow-config-panel.component'; -import { formatValue, isDefined, isUndefined } from '@core/utils'; +import { formatValue, isDefined, isDefinedAndNotNull, isNumeric, isUndefined } from '@core/utils'; import { Component } from '@angular/core'; import { convertLevelColorsSettingsToColorProcessor, @@ -189,11 +189,10 @@ export class DigitalSimpleGaugeBasicConfigComponent extends BasicWidgetConfigCom private maxValueValidation(): ValidatorFn { return (control: AbstractControl): ValidationErrors | null => { - const value: string = control.value; - if (value) { - if (value < control.parent?.get('minValue').value) { - return {maxValue: true}; - } + const value: number = control.value; + const minValue = control.parent?.get('minValue').value; + if (isNumeric(value) && isDefinedAndNotNull(minValue) && value < minValue) { + return {maxValue: true}; } return null; }; diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/gauge/digital-gauge-widget-settings.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/gauge/digital-gauge-widget-settings.component.ts index ff22abd28a..fe7eeb7305 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/gauge/digital-gauge-widget-settings.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/gauge/digital-gauge-widget-settings.component.ts @@ -37,7 +37,7 @@ import { digitalGaugeLayoutTranslations, DigitalGaugeType } from '@home/components/widget/lib/digital-gauge.models'; -import { formatValue, isDefined } from '@core/utils'; +import { formatValue, isDefined, isDefinedAndNotNull, isNumeric } from '@core/utils'; import { ColorSettings, ColorType, @@ -218,11 +218,10 @@ export class DigitalGaugeWidgetSettingsComponent extends WidgetSettingsComponent private maxValueValidation(): ValidatorFn { return (control: AbstractControl): ValidationErrors | null => { - const value: string = control.value; - if (value) { - if (value < control.parent?.get('minValue').value) { - return {maxValue: true}; - } + const value: number = control.value; + const minValue = control.parent?.get('minValue').value; + if (isNumeric(value) && isDefinedAndNotNull(minValue) && value < minValue) { + return {maxValue: true}; } return null; };