From f5fc3bb3f3d306a4a9d0a38a6a10f4245b49aa42 Mon Sep 17 00:00:00 2001 From: Joze RIHTARSIC <joze.rihtarsic@ext.ec.europa.eu> Date: Sat, 5 Oct 2019 17:14:52 +0200 Subject: [PATCH] -UI fix domain validation --- .../domain-details-dialog.component.html | 12 ++-- .../src/app/domain/domain.component.css | 6 ++ .../src/app/domain/domain.component.html | 4 ++ .../src/app/domain/domain.component.ts | 60 +++++++++++++++---- ...service-group-details-dialog.component.css | 6 ++ ...ervice-group-details-dialog.component.html | 6 +- .../service-group-details-dialog.component.ts | 35 ++++++++--- .../service-group-edit.component.html | 1 + .../service-group-edit.component.ts | 10 +++- 9 files changed, 111 insertions(+), 29 deletions(-) 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 fdc576dd1..abcf1ec2d 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 @@ -45,8 +45,9 @@ </div> </mat-form-field> <mat-form-field style="width:100%"> - <mat-select placeholder="Response signature Certificate" + <mat-select placeholder="Response signature Certificate (Signature CertAlias)" [formControl]="domainForm.controls['signatureKeyAlias']" name="cert" + matTooltip="Certificate is used for signing REST responses for the domain." id="signatureKeyAlias_id"> <mat-option [value]="''">Choose certificate for signing soap response</mat-option> <mat-option *ngFor="let cert of lookups.cachedCertificateList" [value]="cert.alias"> @@ -79,9 +80,10 @@ </div> </mat-form-field> - <mat-form-field style="width:100%"> + <mat-form-field style="width:100%" matTooltip="Client Certificate used for SML authentication. The SML Client-Cert http Header is also generated from the certificate"> + <mat-select [(value)]="selectedSMLCert" - placeholder="ClientCert Alias" + placeholder="SML ClientCert Alias" [formControl]="domainForm.controls['smlClientKeyCertificate']" name="cert" id="smlClientKeyAlias_id"> @@ -92,8 +94,8 @@ </mat-select> </mat-form-field> - <mat-form-field style="width:100%"> - <input matInput placeholder="ClientCert Header" name="Client certificate" id="smlClientHeader_id" + <mat-form-field style="width:100%" matTooltip="SML Client-Cert http Header used for SML authentication. The header is generated from chosen SML ClientCert Alias"> + <input matInput placeholder="SML ClientCert Header" name="Client certificate" id="smlClientHeader_id" [value]="selectedSMLCert?.blueCoatHeader" maxlength="2000" readonly="true"> </mat-form-field> diff --git a/smp-angular/src/app/domain/domain.component.css b/smp-angular/src/app/domain/domain.component.css index f2fbadf23..49a7bc9fe 100644 --- a/smp-angular/src/app/domain/domain.component.css +++ b/smp-angular/src/app/domain/domain.component.css @@ -18,6 +18,12 @@ color:red; } +/deep/ .domainWarning { + text-decoration: line-through !important; + font-weight: bold; + color:#fada00; +} + /deep/ .deleted { text-decoration: line-through !important; font-weight: bold; diff --git a/smp-angular/src/app/domain/domain.component.html b/smp-angular/src/app/domain/domain.component.html index 6cb7b5838..040bbf05b 100644 --- a/smp-angular/src/app/domain/domain.component.html +++ b/smp-angular/src/app/domain/domain.component.html @@ -13,6 +13,10 @@ > + <ng-template #domainCodeColumnTemplate let-row="row" ngx-datatable-cell-template> + <span [class]='aliasCssForDomainCodeClass(row)' [matTooltip]='getDomainConfigurationWarning(row)' >{{row.domainCode}}</span> + </ng-template> + <ng-template #signKeyColumnTemplate let-row="row" ngx-datatable-cell-template> <span [class]='aliasCssClass(row.signatureKeyAlias, row)'>{{row.signatureKeyAlias}}</span> </ng-template> diff --git a/smp-angular/src/app/domain/domain.component.ts b/smp-angular/src/app/domain/domain.component.ts index e2d78fe72..45042d4d6 100644 --- a/smp-angular/src/app/domain/domain.component.ts +++ b/smp-angular/src/app/domain/domain.component.ts @@ -28,6 +28,7 @@ export class DomainComponent implements OnInit { @ViewChild('rowMetadataAction') rowMetadataAction: TemplateRef<any>; @ViewChild('signKeyColumnTemplate') signKeyColumnTemplate: TemplateRef<any>; @ViewChild('smlKeyColumnTemplate') smlKeyColumnTemplate: TemplateRef<any>; + @ViewChild('domainCodeColumnTemplate') domainCodeColumnTemplate: TemplateRef<any>; @ViewChild('rowActions') rowActions: TemplateRef<any>; @ViewChild('searchTable') searchTable: SearchTableComponent; @@ -65,29 +66,34 @@ export class DomainComponent implements OnInit { this.columnPicker.allColumns = [ { name: 'Domain code', - prop: 'domainCode', - width: 275 + title: "Unique domain code.", + cellTemplate: this.domainCodeColumnTemplate, + width: 250 }, { name: 'SML Domain', + title: "Informative: SML domain name.", prop: 'smlSubdomain', - width: 275 + }, + { + name: 'Signature CertAlias', + title: "Certificate for signing REST responses", + cellTemplate: this.signKeyColumnTemplate, + width: 150 + }, + { name: 'SML SMP Id', + title: "SMP identifier for SML integration", prop: 'smlSmpId', - width: 120 + width: 150 }, { - name: 'ClientCert Alias', + name: 'SML ClientCert Alias', cellTemplate: this.smlKeyColumnTemplate, - }, - - { - name: 'Signature CertAlias', - cellTemplate: this.signKeyColumnTemplate, - width: 120 + width: 150 }, { name: 'Is SML Registered', @@ -97,12 +103,12 @@ export class DomainComponent implements OnInit { { name: 'SML BueCoat Auth.', prop: 'smlBlueCoatAuth', - width: 120 + width: 130 }, ]; this.columnPicker.selectedColumns = this.columnPicker.allColumns.filter(col => { - return ['Domain code', 'SML Domain', 'SML SMP Id', 'ClientCert Alias', 'Signature CertAlias', 'Is SML Registered', 'SML BueCoat Auth.'].indexOf(col.name) != -1 + return ['Domain code', 'SML Domain', 'Signature CertAlias', 'SML SMP Id', 'SML ClientCert Alias', 'Is SML Registered', 'SML BueCoat Auth.'].indexOf(col.name) != -1 }); } @@ -127,6 +133,34 @@ export class DomainComponent implements OnInit { } } + aliasCssForDomainCodeClass(domain) { + let domainWarning = this.getDomainConfigurationWarning(domain) + if (!!domainWarning) { + return 'domainWarning'; + } else if (domain.status === SearchTableEntityStatus.NEW) { + return 'table-row-new'; + } else if (domain.status === SearchTableEntityStatus.UPDATED) { + return 'table-row-updated'; + } else if (domain.status === SearchTableEntityStatus.REMOVED) { + return 'deleted'; + } + } + getDomainConfigurationWarning(domain: DomainRo) { + let msg =null; + if (!domain.signatureKeyAlias) { + msg = "The domain should have a defined signature CertAlias." + } + if (this.lookups.cachedApplicationInfo.smlIntegrationOn) { + if( domain.smlSmpId && (domain.smlClientKeyAlias || domain.smlClientCertHeader)){ + msg = (!msg?"": msg+" ") + "For SML integration the SMP SMP ID and SML client certificate must be defined!" + } + } + return msg; + + } + + + details(row: any) { this.domainController.showDetails(row); } diff --git a/smp-angular/src/app/service-group-edit/service-group-details-dialog/service-group-details-dialog.component.css b/smp-angular/src/app/service-group-edit/service-group-details-dialog/service-group-details-dialog.component.css index 66c5204a6..21005e4e4 100644 --- a/smp-angular/src/app/service-group-edit/service-group-details-dialog/service-group-details-dialog.component.css +++ b/smp-angular/src/app/service-group-edit/service-group-details-dialog/service-group-details-dialog.component.css @@ -6,3 +6,9 @@ -moz-box-sizing: border-box; /* FF1+ */ box-sizing: border-box; /* Chrome, IE8, Opera, Safari 5.1*/ } + +/deep/ .domainWarning { + text-decoration: line-through !important; + font-weight: bold; + color:#fada00; +} diff --git a/smp-angular/src/app/service-group-edit/service-group-details-dialog/service-group-details-dialog.component.html b/smp-angular/src/app/service-group-edit/service-group-details-dialog/service-group-details-dialog.component.html index d01e8c5c7..79ba8b1d5 100644 --- a/smp-angular/src/app/service-group-edit/service-group-details-dialog/service-group-details-dialog.component.html +++ b/smp-angular/src/app/service-group-edit/service-group-details-dialog/service-group-details-dialog.component.html @@ -106,8 +106,10 @@ style="height: 200px; overflow-y: scroll; overflow-x: auto;"> <mat-list-option *ngFor="let domain of lookups.cachedDomainList" [value]='domain' style="max-width: 450px !important; word-wrap: break-word !important; height: auto; min-height: 30px !important;" - [disabled]="!isDomainProperlyConfigured(domain)"> - {{domain.domainCode}} ({{domain.smlSubdomain}}) + [disabled]="!isDomainProperlyConfigured(domain)" + [matTooltip]="getDomainConfigurationWarning(domain)" > + <span [class]="getDomainCodeClass(domain)"> + {{domain.domainCode}} ({{domain.smlSubdomain}})</span> </mat-list-option> </mat-selection-list> </mat-expansion-panel> diff --git a/smp-angular/src/app/service-group-edit/service-group-details-dialog/service-group-details-dialog.component.ts b/smp-angular/src/app/service-group-edit/service-group-details-dialog/service-group-details-dialog.component.ts index 36c01b33c..a811bfc7c 100644 --- a/smp-angular/src/app/service-group-edit/service-group-details-dialog/service-group-details-dialog.component.ts +++ b/smp-angular/src/app/service-group-edit/service-group-details-dialog/service-group-details-dialog.component.ts @@ -146,15 +146,32 @@ export class ServiceGroupDetailsDialogComponent implements OnInit { this.changeDetector.detectChanges() } - isDomainProperlyConfigured(domain: DomainRo) { + + getDomainCodeClass(domain) { + let domainWarning = this.getDomainConfigurationWarning(domain); + if (!!domainWarning) { + return 'domainWarning'; + } + return ""; + } + getDomainConfigurationWarning(domain: DomainRo) { + let msg =null; + if (!domain.signatureKeyAlias) { + msg = "The domain should have a defined signature CertAlias." + } if (this.lookups.cachedApplicationInfo.smlIntegrationOn) { - return domain.smlSmpId && (domain.smlClientKeyAlias || domain.smlClientCertHeader); - } else { - return true; + if( domain.smlSmpId && (domain.smlClientKeyAlias || domain.smlClientCertHeader)){ + msg = (!msg?"": msg+" ") + "For SML integration the SMP SMP ID and SML client certificate must be defined!" + } } - + if(msg) { + msg = msg + " To use domain first fix domain configuration." + } + return msg; + } + isDomainProperlyConfigured(domain: DomainRo){ + return !this.getDomainConfigurationWarning(domain); } - submitForm() { this.checkValidity(this.dialogForm); @@ -187,7 +204,9 @@ export class ServiceGroupDetailsDialogComponent implements OnInit { // we can close the dialog this.dialogRef.close(true); } - }); + }).catch((err) => { + console.log("Error occurred on Validation Extension: " + err); + });; } @@ -312,6 +331,8 @@ export class ServiceGroupDetailsDialogComponent implements OnInit { this.isExtensionValid = true; this.showSpinner = false; } + }).catch((err) => { + console.log("Error occurred on Validation Extension: " + err); }); } diff --git a/smp-angular/src/app/service-group-edit/service-group-edit.component.html b/smp-angular/src/app/service-group-edit/service-group-edit.component.html index 5e64c73e0..6c23e2b13 100644 --- a/smp-angular/src/app/service-group-edit/service-group-edit.component.html +++ b/smp-angular/src/app/service-group-edit/service-group-edit.component.html @@ -73,6 +73,7 @@ [headerHeight]='50' [footerHeight]='50' [rowHeight]='"auto"' + (activate)="onActivateServiceMetadata(row,$event)" [rowClass]="getRowClass"> <ngx-datatable-column [cellTemplate]="rowDomain" name="Domain" maxWidth="250" ></ngx-datatable-column> <ngx-datatable-column prop="documentIdentifierScheme" name="Document identifier scheme" maxWidth="350" ></ngx-datatable-column> diff --git a/smp-angular/src/app/service-group-edit/service-group-edit.component.ts b/smp-angular/src/app/service-group-edit/service-group-edit.component.ts index 0b07f4c12..12d62b358 100644 --- a/smp-angular/src/app/service-group-edit/service-group-edit.component.ts +++ b/smp-angular/src/app/service-group-edit/service-group-edit.component.ts @@ -194,7 +194,13 @@ export class ServiceGroupEditComponent implements OnInit { return encodeURIComponent((!row.participantScheme? '' : row.participantScheme)+'::'+row.participantIdentifier); } - createServiceMetadataURL(row: any, rowSMD: any){ - return encodeURIComponent((!row.participantScheme? '': row.participantScheme)+'::'+row.participantIdentifier)+'/services/'+ encodeURIComponent((!rowSMD.documentIdentifierScheme?'':rowSMD.documentIdentifierScheme)+'::'+rowSMD.documentIdentifier); + createServiceMetadataURL(serviceGroupRow: any, rowSMD: any){ + return encodeURIComponent((!serviceGroupRow.participantScheme? '': serviceGroupRow.participantScheme)+'::'+serviceGroupRow.participantIdentifier)+'/services/'+ encodeURIComponent((!rowSMD.documentIdentifierScheme?'':rowSMD.documentIdentifierScheme)+'::'+rowSMD.documentIdentifier); + } + + onActivateServiceMetadata(serviceGroupRow: any, event) { + if ("dblclick" === event.type) { + this.onEditMetadataRow(serviceGroupRow, event.row); + } } } -- GitLab