diff --git a/smp-angular/src/app/domain/domain-details-dialog/domain-details-dialog.component.html b/smp-angular/src/app/domain/domain-details-dialog/domain-details-dialog.component.html index 1b0b309238ba0c2f4b93c3e56113938f3f60e1c6..c6d7615c9d863d154dfd1e11231c298e6ebce3a0 100644 --- a/smp-angular/src/app/domain/domain-details-dialog/domain-details-dialog.component.html +++ b/smp-angular/src/app/domain/domain-details-dialog/domain-details-dialog.component.html @@ -7,8 +7,9 @@ <fieldset style="border: none;"> <mat-form-field style="width:100%"> <input matInput placeholder="Domain Code" name="domainCode" - id="domainCode_id" + id="domainCode_id" #domainCode matTooltip="The SMP's domain code. The code is used in HTTP header 'Domain' when adding service group using the webservice API" + (keypress)="onDomainCodeKey(domainCode.value)" [formControl]="domainForm.controls['domainCode']" maxlength="63" required> <mat-hint align="end">For WS API integration: the Domain property</mat-hint> <div @@ -16,6 +17,11 @@ style="color:red; font-size: 70%"> Domain code must contain only chars and numbers and must be less than 63 chars long. </div> + <div + *ngIf="hitTheCodeLengthLimit" + style="color:darkorange; font-size: 70%"> + Domain code must contain only chars and numbers and must be less than 63 chars long. + </div> <div *ngIf="(!editMode && domainForm.controls['domainCode'].touched || editMode) && domainForm.controls['domainCode'].hasError('notInList')" style="color:red; font-size: 70%"> diff --git a/smp-angular/src/app/domain/domain-details-dialog/domain-details-dialog.component.ts b/smp-angular/src/app/domain/domain-details-dialog/domain-details-dialog.component.ts index e83361472923bd8e511d6d78a6fd59b074afc311..f328f58ede3c56ab2396334bd9a2b94065765673 100644 --- a/smp-angular/src/app/domain/domain-details-dialog/domain-details-dialog.component.ts +++ b/smp-angular/src/app/domain/domain-details-dialog/domain-details-dialog.component.ts @@ -6,9 +6,7 @@ import {AlertMessageService} from "../../common/alert-message/alert-message.serv import {SearchTableEntityStatus} from "../../common/search-table/search-table-entity-status.model"; import {GlobalLookups} from "../../common/global-lookups"; import {CertificateRo} from "../../user/certificate-ro.model"; -import {KeystoreEditDialogComponent} from "../keystore-edit-dialog/keystore-edit-dialog.component"; -import {ServiceGroupDomainEditRo} from "../../service-group-edit/service-group-domain-edit-ro.model"; -import {BreakpointObserver, Breakpoints} from "@angular/cdk/layout"; +import {BreakpointObserver} from "@angular/cdk/layout"; @Component({ selector: 'domain-details-dialog', @@ -23,12 +21,14 @@ export class DomainDetailsDialogComponent { // is part of domain readonly domainCodePattern = '^[a-zA-Z0-9]{1,63}$'; + hitTheCodeLengthLimit: boolean = false; + domainCodeTimeout = null; editMode: boolean; formTitle: string; current: DomainRo & { confirmation?: string }; domainForm: FormGroup; domain; - selectedSMLCert: CertificateRo =null; + selectedSMLCert: CertificateRo = null; notInList(list: string[], exception: string) { @@ -96,31 +96,37 @@ export class DomainDetailsDialogComponent { if (this.current.smlClientKeyAlias) { this.selectedSMLCert = this.lookups.cachedCertificateList.find(crt => crt.alias === this.current.smlClientKeyAlias); - this.domainForm.controls['smlClientKeyCertificate'].setValue(this.selectedSMLCert ); + this.domainForm.controls['smlClientKeyCertificate'].setValue(this.selectedSMLCert); } + } - this.responsive.observe(Breakpoints.Small) - .subscribe(result => { - - if (result.matches) { - console.log("screens matches HandsetLandscape"); - } - - }); + /** + * Show warning if domain code exceed the maxlength. + * @param value + */ + onDomainCodeKey(value: string) { + let code = this.domainForm.value['domainCode']; + this.hitTheCodeLengthLimit = !!code && code.length >= 63; + if (!this.domainCodeTimeout) { + this.domainCodeTimeout = setTimeout(() => { + this.hitTheCodeLengthLimit = false; + this.domainCodeTimeout = null; + }, 2000); + } } submitForm() { this.checkValidity(this.domainForm) // check if empty domain already exists - if(this.current.status === SearchTableEntityStatus.NEW - && !this.domainForm.value['smlSubdomain'] ){ + if (this.current.status === SearchTableEntityStatus.NEW + && !this.domainForm.value['smlSubdomain']) { - var domainWithNullSML = this.lookups.cachedDomainList.filter(function(dmn) { + var domainWithNullSML = this.lookups.cachedDomainList.filter(function (dmn) { return !dmn.smlSubdomain; })[0]; - if(!domainWithNullSML) { + if (!domainWithNullSML) { this.dialogRef.close(true); } else { this.domainForm.controls['smlSubdomain'].setErrors({'blankDomainError': true}); diff --git a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/ui/UITruststoreService.java b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/ui/UITruststoreService.java index 9e6d5f2c6778cdd9f4e8104a3f7a1dcca3f6e352..e64eb6434255bddd571cd432fd5859c0024a55e6 100644 --- a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/ui/UITruststoreService.java +++ b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/ui/UITruststoreService.java @@ -385,7 +385,8 @@ public class UITruststoreService { return loadedTrustStore; } catch (Exception exception) { LOG.error("Could not load truststore:" - + truststoreFile + " Error: " + ExceptionUtils.getRootCauseMessage(exception), exception); + + truststoreFile + + " Error: " + ExceptionUtils.getRootCauseMessage(exception), exception); } return null; }