diff --git a/ui-ngx/src/app/shared/components/time-unit-input.component.html b/ui-ngx/src/app/shared/components/time-unit-input.component.html
index 94accb6c7b..1edb3361e1 100644
--- a/ui-ngx/src/app/shared/components/time-unit-input.component.html
+++ b/ui-ngx/src/app/shared/components/time-unit-input.component.html
@@ -22,7 +22,7 @@
@if (labelText && !inlineField) {
{{ labelText }}
}
-
+
diff --git a/ui-ngx/src/app/shared/components/time-unit-input.component.ts b/ui-ngx/src/app/shared/components/time-unit-input.component.ts
index 63439fac14..95e5a3f8e1 100644
--- a/ui-ngx/src/app/shared/components/time-unit-input.component.ts
+++ b/ui-ngx/src/app/shared/components/time-unit-input.component.ts
@@ -120,6 +120,8 @@ export class TimeUnitInputComponent implements ControlValueAccessor, Validator,
[TimeUnit.SECONDS, SECOND/SECOND],
]);
+ minValueValidator = 0;
+
private modelValue: number;
private propagateChange: (value: any) => void = () => {};
@@ -144,8 +146,9 @@ export class TimeUnitInputComponent implements ControlValueAccessor, Validator,
);
}
if (isDefinedAndNotNull(this.minTime)) {
+ this.minValueValidator = this.minValue;
validators.push((control: AbstractControl) =>
- Validators.min(Math.ceil(this.minTime / this.timeIntervalsInSec.get(this.timeInputForm.get('timeUnit').value)))(control)
+ Validators.min(this.minValueValidator)(control)
);
}
@@ -160,6 +163,9 @@ export class TimeUnitInputComponent implements ControlValueAccessor, Validator,
this.timeInputForm.get('timeUnit').valueChanges.pipe(
takeUntilDestroyed(this.destroyRef)
).subscribe(() => {
+ if (isDefinedAndNotNull(this.minTime)) {
+ this.minValueValidator = this.minValue;
+ }
this.timeInputForm.get('time').updateValueAndValidity({onlySelf: true});
this.timeInputForm.get('time').markAsTouched({onlySelf: true});
});
@@ -171,6 +177,10 @@ export class TimeUnitInputComponent implements ControlValueAccessor, Validator,
});
}
+ get minValue(): number {
+ return Math.ceil(this.minTime / this.timeIntervalsInSec.get(this.timeInputForm.get('timeUnit').value));
+ }
+
get hasError(): string {
if (this.timeInputForm.get('time').hasError('required') && this.requiredText) {
return this.requiredText;
@@ -194,6 +204,9 @@ export class TimeUnitInputComponent implements ControlValueAccessor, Validator,
this.timeInputForm.get('time').updateValueAndValidity({emitEvent: false});
}
}
+ if (propName === 'minTime') {
+ this.minValueValidator = isDefinedAndNotNull(this.minTime) ? this.minValue : 0;
+ }
}
}
}