Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit 05ad8003 authored by Joze RIHTARSIC's avatar Joze RIHTARSIC
Browse files

add warning when domain code hits the max length

parent 3e4d6c99
No related branches found
No related tags found
No related merge requests found
......@@ -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%">
......
......@@ -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});
......
......@@ -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;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment