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 1b31878492318ca9af1d7f592ee37aaabf74c724..8d2ea3a15d49ce6b3a4ad7406da253b0aa61e539 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 @@ -88,6 +88,7 @@ export class ServiceGroupDetailsDialogComponent implements OnInit { serviceGroupDomains: [], extension: '', status: SearchTableEntityStatus.NEW, + extensionStatus: SearchTableEntityStatus.UPDATED, }; if (this.lookups.cachedApplicationConfig) { @@ -131,6 +132,8 @@ export class ServiceGroupDetailsDialogComponent implements OnInit { this.extensionObserver.subscribe((res: ServiceGroupValidationRo) => { this.dialogForm.get('extension').setValue(res.extension); this.current.extension = res.extension; + // store to initial data - so for next time there will be no need to retrieve data again from server! + this.data.row.extension = res.extension; }); } @@ -218,9 +221,8 @@ export class ServiceGroupDetailsDialogComponent implements OnInit { this.current.participantIdentifier = this.dialogForm.value['participantIdentifier']; this.current.participantScheme = this.dialogForm.value['participantScheme']; } else { - - this.current.extensionStatus = this.extensionChanged()? - SearchTableEntityStatus.UPDATED:SearchTableEntityStatus.PERSISTED; + this.current.extensionStatus = + SearchTableEntityStatus.UPDATED; } this.current.users = this.dialogForm.value['users']; this.current.extension = this.dialogForm.value['extension']; @@ -267,7 +269,7 @@ export class ServiceGroupDetailsDialogComponent implements OnInit { } extensionChanged():boolean { - return this.current.extension !== this.dialogForm.value['extension'].toString(); + return !this.isEqual(this.current.extension, this.dialogForm.value['extension'].toString()); } onExtensionDelete() { @@ -348,4 +350,12 @@ export class ServiceGroupDetailsDialogComponent implements OnInit { }) : null; } + isEqual(val1, val2): boolean { + return (this.isEmpty(val1) && this.isEmpty(val2) + || val1 === val2); + } + + isEmpty(str): boolean { + return (!str || 0 === str.length); + } } diff --git a/smp-angular/src/app/service-group-edit/service-group-edit-controller.ts b/smp-angular/src/app/service-group-edit/service-group-edit-controller.ts index 96ac25442867b9a89b022070e80ed735bd55d609..ea32ce23d58b4b59a7ef11c1e1bbb4443c9b3c60 100644 --- a/smp-angular/src/app/service-group-edit/service-group-edit-controller.ts +++ b/smp-angular/src/app/service-group-edit/service-group-edit-controller.ts @@ -11,6 +11,8 @@ import {SearchTableEntity} from "../common/search-table/search-table-entity.mode export class ServiceGroupEditController implements SearchTableController { + compareSGProperties = ["extension", "users", "serviceGroupDomains"]; + constructor(public dialog: MatDialog) { } @@ -29,10 +31,10 @@ export class ServiceGroupEditController implements SearchTableController { public delete(row: any) { // set all rows as deleted - let sgRow = row as ServiceGroupEditRo; - sgRow.serviceMetadata.forEach(function(part, index, metaDataList) { + let sgRow = row as ServiceGroupEditRo; + sgRow.serviceMetadata.forEach(function (part, index, metaDataList) { metaDataList[index].status = SearchTableEntityStatus.REMOVED; - metaDataList[index].deleted=true; + metaDataList[index].deleted = true; }); } @@ -61,20 +63,22 @@ export class ServiceGroupEditController implements SearchTableController { public newServiceMetadataRow(): ServiceMetadataEditRo { return { - id:null, + id: null, documentIdentifier: '', documentIdentifierScheme: '', smlSubdomain: '', domainCode: '', - domainId:null, + domainId: null, status: SearchTableEntityStatus.NEW, xmlContentStatus: SearchTableEntityStatus.NEW, }; } - public dataSaved() {} - validateDeleteOperation(rows: Array<SearchTableEntity>){ - return of( this.newValidationResult(true, '') ); + public dataSaved() { + } + + validateDeleteOperation(rows: Array<SearchTableEntity>) { + return of(this.newValidationResult(true, '')); } public newValidationResult(result: boolean, message: string): SearchTableValidationResult { @@ -90,21 +94,15 @@ export class ServiceGroupEditController implements SearchTableController { } isRecordChanged(oldModel, newModel): boolean { - // check if the extension was changed - if (newModel["extensionStatus"]!== SearchTableEntityStatus.PERSISTED){ - return true; - } // check if other properties were changed - for (var property in oldModel) { - if (property === 'extensionStatus'|| - property === 'extension') { - // ignore - continue; - } else { - const isEqual = this.isEqual(newModel[property], oldModel[property]); - if (!isEqual) { - return true; // Property has changed - } + let propSize = this.compareSGProperties.length; + for (let i = 0; i < propSize; i++) { + + let property = this.compareSGProperties[i]; + const isEqual = this.isEqual(newModel[property], oldModel[property]); + if (!isEqual) { + console.log("property: "+property+" changed!"); + return true; // Property has changed } } return false; diff --git a/smp-angular/src/app/user/truststore-edit-dialog/truststore-edit-dialog.component.html b/smp-angular/src/app/user/truststore-edit-dialog/truststore-edit-dialog.component.html index db4bd803db6ac736cb74bb757892e1fa66254704..98f00a2189a5ee04fc9d45b5e3989531606b6033 100644 --- a/smp-angular/src/app/user/truststore-edit-dialog/truststore-edit-dialog.component.html +++ b/smp-angular/src/app/user/truststore-edit-dialog/truststore-edit-dialog.component.html @@ -1,7 +1,19 @@ <h2 mat-dialog-title>{{formTitle}}</h2> <mat-dialog-content style="height:600px;width:1000px"> <mat-card style="height:500px"> - <mat-card-content > + <mat-card-content> + <mat-label style="color: red;font-weight: bold"> + If truststore is empty users certificates are NOT verified if trusted! + </mat-label> + <br/> + <mat-label style="color: red;font-weight: bold"> + Else (if truststore is NOT empty) ALL certificates are verified if issuer or certificate itself is in the + truststore. + <mat-label style="color: red;font-weight: bold"><br/> + </mat-label> + Not trusted certificates cannot access REST services. + </mat-label> + <br/> <ngx-datatable id='truststoreTable_id' class='material striped' @@ -38,10 +50,10 @@ </ngx-datatable> <label class="custom-file-upload"> <input #fileInput type="file" id="custom-file-upload" accept=".cer,.crt,.pem,.der" - (change)="uploadCertificate($event)" > + (change)="uploadCertificate($event)"> <button mat-flat-button color="primary" (click)="fileInput.click()" - >Add certificate + >Add certificate </button> </label>