From 7131141686c7bac7b94aca0b3d5d66c3dc4c50d9 Mon Sep 17 00:00:00 2001 From: RIHTARSIC Joze <joze.rihtarsic@ext.ec.europa.eu> Date: Tue, 2 May 2023 15:08:11 +0200 Subject: [PATCH] Fix duplicate domain validation error --- .../admin-domain/domain-panel/domain-panel.component.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/smp-angular/src/app/system-settings/admin-domain/domain-panel/domain-panel.component.ts b/smp-angular/src/app/system-settings/admin-domain/domain-panel/domain-panel.component.ts index 9fded1fc6..6d6735d2e 100644 --- a/smp-angular/src/app/system-settings/admin-domain/domain-panel/domain-panel.component.ts +++ b/smp-angular/src/app/system-settings/admin-domain/domain-panel/domain-panel.component.ts @@ -18,7 +18,7 @@ export class DomainPanelComponent implements BeforeLeaveGuard { @Output() onSaveBasicDataEvent: EventEmitter<DomainRo> = new EventEmitter(); @Output() onDiscardNew: EventEmitter<any> = new EventEmitter(); - readonly warningTimeout: number = 50000; + readonly warningTimeout: number = 3000; readonly domainCodePattern = '^[a-zA-Z0-9]{1,63}$'; readonly domainVisibilityOptions = Object.keys(VisibilityEnum) .map(el => { @@ -60,8 +60,15 @@ export class DomainPanelComponent implements BeforeLeaveGuard { * @param value */ onFieldKeyPressed(controlName: string, showTheWarningReference: string) { + + if (this.domainForm.controls['domainCode'].hasError('pattern')) { + // already visible error - skip the length validation + return; + } + let value = this.domainForm.get(controlName).value + if (!!value && value.length >= 63 && !this.fieldWarningTimeoutMap[showTheWarningReference]) { this.fieldWarningTimeoutMap[showTheWarningReference] = setTimeout(() => { this.fieldWarningTimeoutMap[showTheWarningReference] = null; -- GitLab