diff --git a/smp-angular/src/app/app.module.ts b/smp-angular/src/app/app.module.ts index bf46efcb2aac7688d5e1672ed16356d28b9063d5..0cbb4aa4d767ee8d2fd7e66591d1b99ffbc9c4d1 100644 --- a/smp-angular/src/app/app.module.ts +++ b/smp-angular/src/app/app.module.ts @@ -90,11 +90,6 @@ import {SaveDialogComponent} from './common/dialogs/save-dialog/save-dialog.comp import {SearchTableComponent} from './common/search-table/search-table.component'; import {SecurityEventService} from './security/security-event.service'; import {SecurityService} from './security/security.service'; -import {ServiceGroupDetailsDialogComponent} from './service-group-edit/service-group-details-dialog/service-group-details-dialog.component'; -import {ServiceGroupEditComponent} from './service-group-edit/service-group-edit.component'; -import {ServiceGroupExtensionWizardDialogComponent} from './service-group-edit/service-group-extension-wizard-dialog/service-group-extension-wizard-dialog.component'; -import {ServiceGroupMetadataDialogComponent} from './service-group-edit/service-group-metadata-dialog/service-group-metadata-dialog.component'; -import {ServiceGroupSearchComponent} from './service-group-search/service-group-search.component'; import {ServiceMetadataWizardDialogComponent} from './service-group-edit/service-metadata-wizard-dialog/service-metadata-wizard-dialog.component'; import {SidenavComponent} from './window/sidenav/sidenav.component'; import {SmlIntegrationService} from "./system-settings/domain/sml-integration.service"; @@ -144,6 +139,7 @@ import {SmpWarningPanelComponent} from "./common/components/smp-warning-panel/sm import {ManageMembersDialogComponent} from "./common/dialogs/manage-members-dialog/manage-members-dialog.component"; import {HttpErrorHandlerService} from "./common/error/http-error-handler.service"; import {SmpTitledLabelComponent} from "./common/components/smp-titled-label/smp-titled-label.component"; +import {ServiceGroupSearchComponent} from "./service-group-search/service-group-search.component"; @NgModule({ @@ -209,10 +205,6 @@ import {SmpTitledLabelComponent} from "./common/components/smp-titled-label/smp- RowLimiterComponent, SaveDialogComponent, SearchTableComponent, - ServiceGroupDetailsDialogComponent, - ServiceGroupEditComponent, - ServiceGroupExtensionWizardDialogComponent, - ServiceGroupMetadataDialogComponent, ServiceGroupSearchComponent, ServiceMetadataWizardDialogComponent, SidenavComponent, 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 deleted file mode 100644 index 1a69b5329bf2fd8b2df0cf327071add33a334668..0000000000000000000000000000000000000000 --- a/smp-angular/src/app/service-group-edit/service-group-details-dialog/service-group-details-dialog.component.css +++ /dev/null @@ -1,26 +0,0 @@ -.flex-dialog-content{ - display: flex; justify-content: space-around; - flex-flow: row; - align-items: stretch;height:510px;min-width:950px -} - -#extensionTextArea { - display: block; - margin: 0 auto; - border: #03A9F4 1px solid; - flex-grow: 1; -} - -::ng-deep .domainWarning { - text-decoration: line-through !important; - font-weight: bold; - color:#c6c639; -} - - -.list-form-item .mat-form-field-wrapper { - margin-bottom: -1.25em; - padding: 0; - margin: 0; -} - 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 deleted file mode 100644 index 5c221737894569dac450f58cc3389315a147018b..0000000000000000000000000000000000000000 --- a/smp-angular/src/app/service-group-edit/service-group-details-dialog/service-group-details-dialog.component.html +++ /dev/null @@ -1,181 +0,0 @@ -<h2 mat-dialog-title>{{formTitle}}</h2> -<spinner [show]="showSpinner" [size]="150"></spinner> -<mat-dialog-content [class]="'flex-dialog-content'"> - - <div fxLayout="column" style="flex-grow: 1;"> - <mat-card> - <!-- mat-card-title>Identifier</mat-card-title --> - <mat-card-content> - <mat-form-field style="width:100%"> - <input matInput placeholder="Participant identifier" name="participantIdentifier" - id="participantIdentifier_id" - [formControl]="dialogForm.controls['participantIdentifier']" maxlength="50" required> - <div - *ngIf="(!editMode && dialogForm.controls['participantIdentifier'].touched || editMode) && dialogForm.controls['participantIdentifier'].hasError('required')" - style="color:red; font-size: 70%"> - Participant identifier must not be empty and must be up to 50 characters long. - </div> - <div - *ngIf="(!editMode && dialogForm.controls['participantIdentifier'].hasError('dbExist'))" - style="color:red; font-size: 70%"> - Participant identifier for given scheme is already defined in database! - </div> - </mat-form-field> - - <mat-form-field style="width:100%"> - <input - matInput placeholder="Participant scheme" name="participantScheme" - id="participantScheme_id" - [formControl]="dialogForm.controls['participantScheme']" - maxlength="255"> - <div - *ngIf="(!editMode && dialogForm.controls['participantScheme'].touched || editMode) && dialogForm.controls['participantScheme'].hasError('required')" - style="color:red; font-size: 70%"> - Participant scheme must not be empty. - </div> - <div - *ngIf="(!editMode && dialogForm.controls['participantScheme'].touched || editMode) && - dialogForm.controls['participantScheme'].hasError('pattern')" - style="color:red; font-size: 70%"> - {{participantSchemeMessage}} - </div> - </mat-form-field> - </mat-card-content> - </mat-card> - <mat-card> - <mat-card-content> - <mat-accordion id="accordion_panel_id"> - <mat-expansion-panel *ngIf="securityService.isCurrentUserSMPAdmin()" [expanded]="true" - id="owner_expansion_panel_id"> - <mat-expansion-panel-header id="owner_expansion_header_id"> - <mat-panel-title>Owners* - </mat-panel-title> - <mat-panel-description id="owner_expansion_description_id"> - <div> - Selected user count: {{usersSelected.selectedOptions?.selected.length}} - <div - *ngIf="(!editMode && dialogForm.controls['users'].touched || editMode) && dialogForm.controls['users'].hasError('minSelectedListCount')" - style="color:red; font-size: 70%"> - At least one user (owner) must be selected! - </div> - </div> - </mat-panel-description> - </mat-expansion-panel-header> - <mat-selection-list #usersSelected - [compareWith]="compareUserByUserId" - [formControl]="dialogForm.controls['users']" - style="min-height: 100px; height: 150px; overflow-y: scroll; overflow-x: auto;"> - <!-- // if username is null then there must be an cerificate id! --> - <mat-list-option *ngFor="let user of lookups.cachedServiceGroupOwnerList" [value]='user' - style="max-width: 400px;max-width: 450px !important; word-wrap: break-word !important; height: auto; min-height: 30px !important;"> - {{user.username ? user.username : user.certificate?.certificateId}} - </mat-list-option> - </mat-selection-list> - </mat-expansion-panel> - - <mat-expansion-panel [expanded]="!securityService.isCurrentUserSMPAdmin()" id="domain_expansion_panel_id"> - <mat-expansion-panel-header id="domain_expansion_header_id"> - <mat-panel-title>Domains*</mat-panel-title> - <mat-panel-description id="domain_expansion_description_id"> - <div> - Selected domain count: {{domainSelector.selectedOptions?.selected.length}} - <div - *ngIf="(!editMode && dialogForm.controls['serviceGroupDomains'].touched || editMode) - && dialogForm.controls['serviceGroupDomains'].hasError('minSelectedListCount')" - style="color:red; font-size: 70%"> - At least one domain must be selected! - </div> - <div - *ngIf="(!editMode && dialogForm.controls['serviceGroupDomains'].touched || editMode) - && dialogForm.controls['serviceGroupDomains'].hasError('multiDomainError')" - style="color:red; font-size: 70%"> - SMP is in participant single domain mode! Only one domain must be selected. - </div> - - - </div> - </mat-panel-description> - </mat-expansion-panel-header> - <mat-selection-list #domainSelector - [compareWith]="compareDomain" - [formControl]="dialogForm.controls['serviceGroupDomains']" - (selectionChange)="onDomainSelectionChanged($event)" - style="min-height: 100px; height: 150px; overflow-y: scroll; overflow-x: auto;"> - <mat-list-option *ngFor="let domain of lookups.cachedDomainList" [value]='domain' - style="max-width: 400px;max-width: 450px !important; word-wrap: break-word !important; height: auto; min-height: 30px !important;" - > - <label>{{domain.domainCode}} ({{domain.smlSubdomain}})</label> - </mat-list-option> - </mat-selection-list> - </mat-expansion-panel> - </mat-accordion> - </mat-card-content> - </mat-card> - </div> - - <mat-card > - - <mat-card-title>Extension - <div style="font-size:50%"> - Extension is automatically wrapped to root element to form valid XML! No ExtensionWrapper element is needed. - </div> - </mat-card-title> - - <mat-card-content fxLayout="column" style="flex-grow: 1;display: flex; - align-items: stretch;"> - <mat-toolbar class ="mat-elevation-z2"> - <mat-toolbar-row class="smp-toolbar-row"> - <button mat-raised-button color="primary" - matTooltip="Clear the extension content." - matTooltipPosition="below" - (click)="onExtensionDelete()"> - <mat-icon>clear</mat-icon> - <span>Clear</span> - </button> - <button mat-raised-button color="primary" - matTooltip="Opens wizard for adding new Extension. New extension is appended to existing extensions." - matTooltipPosition="below" - (click)="onStartWizardDialog()"> - <mat-icon>add_box</mat-icon> - <span>Extension wizard</span> - </button> - <button mat-raised-button color="primary" - matTooltip="Validate extension by XSD scheme." - matTooltipPosition="below" - (click)="onExtensionValidate()"> - <mat-icon>warning</mat-icon> - <span>Validate</span> - </button> - </mat-toolbar-row> - </mat-toolbar> - <div *ngIf="extensionValidationMessage" - [ngClass]="{ 'alert-message': extensionValidationMessage, 'alert-message-success': isExtensionValid, 'alert-message-error':!isExtensionValid }" - id="alertmessage_id"> - <span class="alert-message-close-button" (click)="clearAlert()">×</span> - {{extensionValidationMessage}} - </div> - - <textarea matInput style="min-height:250px;flex-grow: 2;background-color: #e1e4e8" - id="extensionTextArea" - placeholder="Extension" name="extension" - [formControl]="dialogForm.controls['extension']"></textarea> - - </mat-card-content> - </mat-card> - <div class="required-fields">* required fields</div> -</mat-dialog-content> - - -<mat-dialog-actions> - <button mat-raised-button color="primary" (click)="submitForm()" - [disabled]="!dialogForm.valid"> - <mat-icon>check_circle</mat-icon> - <span>OK</span> - </button> - <button mat-raised-button color="primary" mat-dialog-close> - <mat-icon>cancel</mat-icon> - <span>Cancel</span> - </button> -</mat-dialog-actions> - - diff --git a/smp-angular/src/app/service-group-edit/service-group-details-dialog/service-group-details-dialog.component.spec.ts b/smp-angular/src/app/service-group-edit/service-group-details-dialog/service-group-details-dialog.component.spec.ts deleted file mode 100644 index 7a4a6428bfe10e8f92bfbc1e8b6f069add6ad952..0000000000000000000000000000000000000000 --- a/smp-angular/src/app/service-group-edit/service-group-details-dialog/service-group-details-dialog.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; - -import { ServiceGroupDetailsDialogComponent } from './service-group-details-dialog.component'; - -describe('ServiceGroupDetailsDialogComponent', () => { - let component: ServiceGroupDetailsDialogComponent; - let fixture: ComponentFixture<ServiceGroupDetailsDialogComponent>; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ ServiceGroupDetailsDialogComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(ServiceGroupDetailsDialogComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should be created', () => { - expect(component).toBeTruthy(); - }); -}); 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 deleted file mode 100644 index 1cca21b1cbd48aa42cdf977998aece10e75ed50a..0000000000000000000000000000000000000000 --- a/smp-angular/src/app/service-group-edit/service-group-details-dialog/service-group-details-dialog.component.ts +++ /dev/null @@ -1,360 +0,0 @@ -import {ChangeDetectorRef, Component, Inject, OnInit, ViewChild} from '@angular/core'; -import {MAT_DIALOG_DATA, MatDialog, MatDialogRef} from '@angular/material/dialog'; -import {Observable} from "rxjs/internal/Observable"; -import {HttpClient} from "@angular/common/http"; -import {SmpConstants} from "../../smp.constants"; -import {AlertMessageService} from "../../common/alert-message/alert-message.service"; -import {AbstractControl, UntypedFormBuilder, UntypedFormControl, UntypedFormGroup, Validators} from "@angular/forms"; -import {EntityStatus} from "../../common/enums/entity-status.enum"; -import {ServiceGroupEditRo} from "../service-group-edit-ro.model"; -import {GlobalLookups} from "../../common/global-lookups"; -import {ServiceGroupExtensionWizardDialogComponent} from "../service-group-extension-wizard-dialog/service-group-extension-wizard-dialog.component"; -import {ServiceGroupValidationRo} from "./service-group-validation-edit-ro.model"; -import {DomainRo} from "../../common/model/domain-ro.model"; -import {ServiceGroupDomainEditRo} from "../service-group-domain-edit-ro.model"; -import {ConfirmationDialogComponent} from "../../common/dialogs/confirmation-dialog/confirmation-dialog.component"; -import {SecurityService} from "../../security/security.service"; -import {UserRo} from "../../system-settings/user/user-ro.model"; -import {ServiceGroupValidationErrorCodeModel} from "./service-group-validation-error-code.model"; - -@Component({ - selector: 'service-group-details', - templateUrl: './service-group-details-dialog.component.html', - styleUrls: ['./service-group-details-dialog.component.css'] -}) -export class ServiceGroupDetailsDialogComponent implements OnInit { - - static readonly NEW_MODE = 'New ServiceGroup'; - static readonly EDIT_MODE = 'ServiceGroup Edit'; - - - participantSchemePattern = '^[a-z0-9]+-[a-z0-9]+-[a-z0-9]+$'; - participantSchemeMessage = ''; - - @ViewChild('domainSelector') domainSelector: any; - - editMode: boolean; - formTitle: string; - current: ServiceGroupEditRo & { confirmation?: string }; - showSpinner: boolean = false; - - dialogForm: UntypedFormGroup; - extensionObserver: Observable<ServiceGroupValidationRo>; - - extensionValidationMessage: string = null; - isExtensionValid: boolean = true; - userList: UserRo[]; - - minSelectedListCount(min: number) { - return (c: AbstractControl): { [key: string]: any } => { - if (c.value && c.value.length >= min) - return null; - - return {'minSelectedListCount': {valid: false}}; - } - } - - multiDomainOn(multidomainOn: boolean) { - return (c: AbstractControl): { [key: string]: any } => { - if (c.value && c.value.length < 2 || multidomainOn) - return null; - - return {'multiDomainError': {valid: false}}; - } - } - - constructor(public securityService: SecurityService, - public dialog: MatDialog, - protected http: HttpClient, - public dialogRef: MatDialogRef<ServiceGroupDetailsDialogComponent>, - private alertService: AlertMessageService, - public lookups: GlobalLookups, - @Inject(MAT_DIALOG_DATA) public data: any, - private dialogFormBuilder: UntypedFormBuilder, - private changeDetector: ChangeDetectorRef) { - this.editMode = this.data.edit; - - this.formTitle = this.editMode ? ServiceGroupDetailsDialogComponent.EDIT_MODE : ServiceGroupDetailsDialogComponent.NEW_MODE; - this.current = !!this.data.row - ? { - ...this.data.row, - // copy serviceGroupDomain array - serviceGroupDomains: [...this.data.row.serviceGroupDomains] - } - : { - id: null, - participantIdentifier: '', - participantScheme: '', - serviceMetadata: [], - users: [], - serviceGroupDomains: [], - extension: '', - status: EntityStatus.NEW, - extensionStatus: EntityStatus.UPDATED, - }; - - if (this.lookups.cachedApplicationConfig) { - this.participantSchemePattern = this.lookups.cachedApplicationConfig.participantSchemaRegExp != null ? - this.lookups.cachedApplicationConfig.participantSchemaRegExp : ".*" - - this.participantSchemeMessage = this.lookups.cachedApplicationConfig.participantSchemaRegExpMessage; - } - // user is new when reopening the new item in edit mode! - // allow to change data but warn on error! - - this.dialogForm = this.dialogFormBuilder.group({ - 'participantIdentifier': new UntypedFormControl({ - value: '', - disabled: this.current.status !== EntityStatus.NEW - }, - this.current.status === EntityStatus.NEW ? Validators.required : null), - 'participantScheme': new UntypedFormControl({value: '', disabled: this.current.status !== EntityStatus.NEW}, - this.current.status === EntityStatus.NEW ? - [Validators.pattern(this.participantSchemePattern)] : null), - 'serviceGroupDomains': new UntypedFormControl({ - value: [], - disabled: !securityService.isCurrentUserSMPAdmin() - }, - [this.minSelectedListCount(1)]), - 'users': new UntypedFormControl({ - value: [], - disabled: !securityService.isCurrentUserSMPAdmin() - }, [this.minSelectedListCount(1)]), - 'extension': new UntypedFormControl({value: ''}, []), - - - }); - if (!!lookups.cachedApplicationConfig.partyIDSchemeMandatory && this.current.status == EntityStatus.NEW) { - this.dialogForm.controls['participantScheme'].addValidators(Validators.required); - } - - // update values - this.dialogForm.controls['participantIdentifier'].setValue(this.current.participantIdentifier); - this.dialogForm.controls['participantScheme'].setValue(this.current.participantScheme); - this.dialogForm.controls['serviceGroupDomains'].setValue(this.current.serviceGroupDomains); - this.dialogForm.controls['users'].setValue(this.current.users) - this.dialogForm.controls['extension'].setValue(this.current.extension) - } - - ngOnInit() { - // retrieve xml extension for this service group - if (this.current.status !== EntityStatus.NEW && !this.current.extension) { - // init domains - this.extensionObserver = this.http.get<ServiceGroupValidationRo>(SmpConstants.REST_PUBLIC_SERVICE_GROUP_ENTITY_EXTENSION.replace('{service-group-id}', this.current.id + "")); - 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; - }); - } - - // detect changes for updated values in mat-selection-list (check change detection operations) - // else the following error is thrown :xpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: - // 'aria-selected: false'. Current value: 'aria-selected: true' - // - this.changeDetector.detectChanges() - } - - submitForm() { - this.checkValidity(this.dialogForm); - - let request: ServiceGroupValidationRo = { - serviceGroupId: this.current.id, - participantScheme: this.dialogForm.controls['participantScheme'].value, - participantIdentifier: this.dialogForm.controls['participantIdentifier'].value, - extension: this.dialogForm.controls['extension'].value, - statusAction: this.editMode ? EntityStatus.UPDATED : EntityStatus.NEW, - } - // - let validationObservable = this.http.post<ServiceGroupValidationRo>(SmpConstants.REST_SERVICE_GROUP_EXTENSION_VALIDATE, request); - this.showSpinner = true; - validationObservable.toPromise().then((res: ServiceGroupValidationRo) => { - if (res.errorMessage) { - - this.isExtensionValid = false; - this.showSpinner = false; - if (res.errorCode == ServiceGroupValidationErrorCodeModel.ERROR_CODE_SERVICE_GROUP_EXISTS) { - this.dialogForm.controls['participantIdentifier'].setErrors({'dbExist': true}); - } else { - this.extensionValidationMessage = res.errorMessage; - } - } else { - this.extensionValidationMessage = "Extension is valid!"; - this.isExtensionValid = true; - this.showSpinner = false; - // we can close the dialog - this.dialogRef.close(true); - } - }).catch((err) => { - console.log("Error occurred on Validation Extension: " + err); - }); - } - - checkValidity(g: UntypedFormGroup) { - Object.keys(g.controls).forEach(key => { - g.get(key).markAsDirty(); - }); - Object.keys(g.controls).forEach(key => { - g.get(key).markAsTouched(); - }); - //!!! updateValueAndValidity - else some filed did no update current / on blur never happened - Object.keys(g.controls).forEach(key => { - g.get(key).updateValueAndValidity(); - }); - } - - - compareUserByUserId(item1, item2): boolean { - return item1.userId === item2.userId; - } - - compareDomain(domain: DomainRo, serviceGroupDomain: ServiceGroupDomainEditRo): boolean { - return domain.domainCode === serviceGroupDomain.domainCode; - } - - - public getCurrent(): ServiceGroupEditRo { - // change this two properties only on new - if (this.current.status === EntityStatus.NEW) { - this.current.participantIdentifier = this.dialogForm.value['participantIdentifier']; - this.current.participantScheme = this.dialogForm.value['participantScheme']; - } else { - this.current.extensionStatus = EntityStatus.UPDATED; - } - this.current.users = this.dialogForm.value['users']; - this.current.extension = this.dialogForm.value['extension']; - let domainOptions = this.domainSelector.options._results; - domainOptions.forEach(opt => { - let domValue = opt.value; - let sgd = this.getServiceGroupDomain(domValue.domainCode); - // if contains and deselected - delete - if (sgd && !opt.selected) { - this.current.serviceMetadata.forEach(metadata => { - if (metadata.domainCode === sgd.domainCode) { - metadata.status = EntityStatus.REMOVED; - metadata.deleted = true; - } - }); - - let index = this.current.serviceGroupDomains.indexOf(sgd); - if (index !== -1) this.current.serviceGroupDomains.splice(index, 1); - - // delete service group - } else if (!sgd && opt.selected) { - let newDomain: ServiceGroupDomainEditRo = { - id: null, - domainId: domValue.id, - domainCode: domValue.domainCode, - smlSubdomain: domValue.domainCode, - smlRegistered: false, - serviceMetadataCount: 0, - status: EntityStatus.NEW, - }; - this.current.serviceGroupDomains.push(newDomain); - } - }); - return this.current; - } - - dataChanged() { - if (this.current.status === EntityStatus.NEW) { - return true; - } - return this.current.users !== this.dialogForm.value['users']; - } - - extensionChanged(): boolean { - return !this.isEqual(this.current.extension, this.dialogForm.value['extension'].toString()); - } - - onExtensionDelete() { - this.dialogForm.controls['extension'].setValue(""); - } - - onStartWizardDialog() { - - const formRef: MatDialogRef<any> = this.dialog.open(ServiceGroupExtensionWizardDialogComponent); - formRef.afterClosed().subscribe(result => { - if (result) { - let existingXML = this.dialogForm.controls['extension'].value; - let val = (existingXML ? existingXML + '\n' : '') + formRef.componentInstance.getExtensionXML(); - this.dialogForm.controls['extension'].setValue(val); - } - }); - } - - public onExtensionValidate() { - - let request: ServiceGroupValidationRo = { - serviceGroupId: this.current.id, - participantScheme: this.dialogForm.controls['participantScheme'].value, - participantIdentifier: this.dialogForm.controls['participantIdentifier'].value, - extension: this.dialogForm.controls['extension'].value, - statusAction: EntityStatus.UPDATED, // do not validate as new - for new participant id and schema is also validated - } - // - let validationObservable = this.http.post<ServiceGroupValidationRo>(SmpConstants.REST_SERVICE_GROUP_EXTENSION_VALIDATE, request); - this.showSpinner = true; - validationObservable.toPromise().then((res: ServiceGroupValidationRo) => { - if (res.errorMessage) { - this.extensionValidationMessage = res.errorMessage; - this.isExtensionValid = false; - this.showSpinner = false; - } else { - this.extensionValidationMessage = "Extension is valid!"; - this.isExtensionValid = true; - this.showSpinner = false; - } - }).catch((err) => { - console.log("Error occurred on Validation Extension: " + err); - }); - - } - - onDomainSelectionChanged(event) { - // if deselected warn serviceMetadata will be deleted - let domainCode = event.option.value.domainCode; - if (!event.option.selected) { - let smdCount = this.getServiceMetadataCountOnDomain(domainCode); - if (smdCount > 0) { - this.dialog.open(ConfirmationDialogComponent, { - data: { - title: "Registered serviceMetadata on domain", - description: "Unregistering service group from domain will also delete its serviceMetadata (count: " + smdCount + ") from the domain! Do you want to continue?" - } - }).afterClosed().subscribe(result => { - if (!result) { - event.option.selected = true; - } - }) - } - } - } - - public getServiceMetadataCountOnDomain(domainCode: string) { - return this.current.serviceMetadata.filter(smd => { - return smd.domainCode === domainCode - }).length; - } - - public getServiceGroupDomain(domainCode: string) { - return this.current.serviceGroupDomains ? - this.current.serviceGroupDomains.find(smd => { - return smd.domainCode === domainCode - }) : null; - } - - isEqual(val1, val2): boolean { - return (this.isEmpty(val1) && this.isEmpty(val2) - || val1 === val2); - } - - isEmpty(str): boolean { - return (!str || 0 === str.length); - } - - clearAlert() { - this.extensionValidationMessage = null; - } -} diff --git a/smp-angular/src/app/service-group-edit/service-group-details-dialog/service-group-validation-edit-ro.model.ts b/smp-angular/src/app/service-group-edit/service-group-details-dialog/service-group-validation-edit-ro.model.ts deleted file mode 100644 index ad2d6f161b9e15a4e8e8ae9598af31e0107097b3..0000000000000000000000000000000000000000 --- a/smp-angular/src/app/service-group-edit/service-group-details-dialog/service-group-validation-edit-ro.model.ts +++ /dev/null @@ -1,10 +0,0 @@ - -export interface ServiceGroupValidationRo { - serviceGroupId: number; - participantScheme: string; - participantIdentifier: string; - extension: string; - errorMessage?: string; - statusAction:number; - errorCode?: number; -} diff --git a/smp-angular/src/app/service-group-edit/service-group-details-dialog/service-group-validation-error-code.model.ts b/smp-angular/src/app/service-group-edit/service-group-details-dialog/service-group-validation-error-code.model.ts deleted file mode 100644 index c1ed1858e7f40f458bec49eb4197d2d78f96097f..0000000000000000000000000000000000000000 --- a/smp-angular/src/app/service-group-edit/service-group-details-dialog/service-group-validation-error-code.model.ts +++ /dev/null @@ -1,5 +0,0 @@ -export enum ServiceGroupValidationErrorCodeModel { - ERROR_CODE_OK, - ERROR_CODE_SERVICE_GROUP_EXISTS, - ERROR_CODE_INVALID_EXTENSION -} diff --git a/smp-angular/src/app/service-group-edit/service-group-domain-edit-ro.model.ts b/smp-angular/src/app/service-group-edit/service-group-domain-edit-ro.model.ts deleted file mode 100644 index e23ff4e734545f362e42a406b414f0ea8bee592c..0000000000000000000000000000000000000000 --- a/smp-angular/src/app/service-group-edit/service-group-domain-edit-ro.model.ts +++ /dev/null @@ -1,10 +0,0 @@ -import {SearchTableEntity} from "../common/search-table/search-table-entity.model"; - -export interface ServiceGroupDomainEditRo extends SearchTableEntity { - id: number; - domainId: number; - domainCode: string; - smlSubdomain: string; - smlRegistered: boolean; - serviceMetadataCount?: number; -} 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 deleted file mode 100644 index 75133bd7f12468da8f34899226d12e869bc8c45d..0000000000000000000000000000000000000000 --- a/smp-angular/src/app/service-group-edit/service-group-edit-controller.ts +++ /dev/null @@ -1,147 +0,0 @@ -import {SearchTableController} from '../common/search-table/search-table-controller'; -import {MatDialog, MatDialogConfig, MatDialogRef} from '@angular/material/dialog'; -import {ServiceGroupDetailsDialogComponent} from './service-group-details-dialog/service-group-details-dialog.component'; -import {ServiceGroupEditRo} from './service-group-edit-ro.model'; -import {EntityStatus} from '../common/enums/entity-status.enum'; -import {ServiceMetadataEditRo} from "./service-metadata-edit-ro.model"; -import {ServiceGroupMetadataDialogComponent} from "./service-group-metadata-dialog/service-group-metadata-dialog.component"; -import {of} from "rxjs/internal/observable/of"; -import {SearchTableValidationResult} from "../common/search-table/search-table-validation-result.model"; -import {SearchTableEntity} from "../common/search-table/search-table-entity.model"; - -export class ServiceGroupEditController implements SearchTableController { - - compareUpdateSGProperties = ["extension", "users", "serviceGroupDomains"]; - compareNewSGProperties = ["participantScheme", "participantIdentifier", "", "extension", "users", "serviceGroupDomains"]; - - constructor(public dialog: MatDialog) { - } - - public showDetails(row: any, config?: MatDialogConfig,) { - let dialogRef: MatDialogRef<ServiceGroupDetailsDialogComponent> - = this.dialog.open(ServiceGroupDetailsDialogComponent); - dialogRef.afterClosed().subscribe(result => { - //Todo: - }); - } - - public edit(row: any) { - } - - public delete(row: any) { - - // set all rows as deleted - let sgRow = row as ServiceGroupEditRo; - sgRow.serviceMetadata.forEach(function (part, index, metaDataList) { - metaDataList[index].status = EntityStatus.REMOVED; - metaDataList[index].deleted = true; - }); - } - - public newDialog(config?: MatDialogConfig): MatDialogRef<ServiceGroupDetailsDialogComponent> { - return this.dialog.open(ServiceGroupDetailsDialogComponent, config); - } - - public newMetadataDialog(config?: MatDialogConfig): MatDialogRef<ServiceGroupMetadataDialogComponent> { - return this.dialog.open(ServiceGroupMetadataDialogComponent, config); - } - - public newRow(): ServiceGroupEditRo { - return { - id: null, - index: null, - participantIdentifier: '', - participantScheme: '', - serviceMetadata: [], - users: [], - serviceGroupDomains: [], - extensionStatus: EntityStatus.NEW, - status: EntityStatus.NEW - }; - } - - public newServiceMetadataRow(): ServiceMetadataEditRo { - return { - id: null, - documentIdentifier: '', - documentIdentifierScheme: '', - smlSubdomain: '', - domainCode: '', - domainId: null, - status: EntityStatus.NEW, - xmlContentStatus: EntityStatus.NEW, - }; - } - - public dataSaved() { - } - - validateDeleteOperation(rows: Array<SearchTableEntity>) { - return of(this.newValidationResult(true, '')); - } - - public newValidationResult(result: boolean, message: string): SearchTableValidationResult { - return { - validOperation: result, - stringMessage: message, - } - } - - isRowExpanderDisabled(row: ServiceGroupEditRo): boolean { - const serviceGroup = <ServiceGroupEditRo>row; - return !(serviceGroup.serviceMetadata && serviceGroup.serviceMetadata.length); - } - - isRecordChanged(oldModel, newModel): boolean { - // different set of properties to compare in case if new entry is reedited or already saved entry is reedited. - let propsToCompare = newModel.status === EntityStatus.NEW ? - this.compareNewSGProperties : this.compareUpdateSGProperties; - - // check if other properties were changed - let propSize = propsToCompare.length; - for (let i = 0; i < propSize; i++) { - let property = propsToCompare[i]; - let isEqual = false; - - if (property === 'users') { - isEqual = this.isEqualListByAttribute(newModel[property], oldModel[property], "userId"); - } else if (property === 'serviceGroupDomains') { - isEqual = this.isEqualListByAttribute(newModel[property], oldModel[property], "domainCode"); - } else { - isEqual = this.isEqual(JSON.stringify(newModel[property]), JSON.stringify(oldModel[property])); - } - console.log("Property: " + property + " new: " + JSON.stringify(newModel[property]) + "old: " + JSON.stringify(oldModel[property]) + " val: " + isEqual); - if (!isEqual) { - return true; // Property has changed - } - } - return false; - } - - isEqualListByAttribute(array1, array2, compareByAttribute): boolean { - let result1 = array1.filter(function (o1) { - // filter out (!) items in result2 - return !array2.some(function (o2) { - return o1[compareByAttribute] === o2[compareByAttribute]; // unique id - }); - }); - - let result2 = array2.filter(function (o1) { - // filter out (!) items in result2 - return !array1.some(function (o2) { - return o1[compareByAttribute] === o2[compareByAttribute]; // unique id - }); - }); - - return (!result1 || result1.length === 0) && (!result2 || result2.length === 0); - } - - 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-ro.model.ts b/smp-angular/src/app/service-group-edit/service-group-edit-ro.model.ts deleted file mode 100644 index 6795ba86cecb82f66ec57ec7bc1c7a74b305588f..0000000000000000000000000000000000000000 --- a/smp-angular/src/app/service-group-edit/service-group-edit-ro.model.ts +++ /dev/null @@ -1,16 +0,0 @@ -import {ServiceMetadataEditRo} from './service-metadata-edit-ro.model'; -import {SearchTableEntity} from "../common/search-table/search-table-entity.model"; -import {UserRo} from "../system-settings/user/user-ro.model"; -import {ServiceGroupDomainEditRo} from "./service-group-domain-edit-ro.model"; -import {EntityStatus} from "../common/enums/entity-status.enum"; - -export interface ServiceGroupEditRo extends SearchTableEntity { - id: number; - participantIdentifier: string; - participantScheme: string; - serviceMetadata: Array<ServiceMetadataEditRo>; - serviceGroupDomains: Array<ServiceGroupDomainEditRo>; - users: Array<UserRo>; - extension?: string; - extensionStatus: EntityStatus; -} diff --git a/smp-angular/src/app/service-group-edit/service-group-edit.component.css b/smp-angular/src/app/service-group-edit/service-group-edit.component.css deleted file mode 100644 index eeed25389d68b3cd8f633a70fb59b8205d0bc57f..0000000000000000000000000000000000000000 --- a/smp-angular/src/app/service-group-edit/service-group-edit.component.css +++ /dev/null @@ -1,31 +0,0 @@ -/* --- Select ---*/ -.mat-select{ - padding:20px 0; -} - -/* --- Button ---*/ -.group-btn { - margin-top:20px; - } - -#hiddenButtonId { - position: fixed; -} - -.datatable-body{ - overflow-y: scroll; -} - -::ng-deep .inner-table { - margin-left: 100px; - width: 80%; -} - -::ng-deep .inner-table .datatable-body-cell { - padding: 1.5em 2px !important; -} - -::ng-deep .inner-table .mat-icon-button { - height: auto !important;; - line-height: unset !important; -} 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 deleted file mode 100644 index cf7d8e9da889f19793ca58b7e1d3be7d816105cb..0000000000000000000000000000000000000000 --- a/smp-angular/src/app/service-group-edit/service-group-edit.component.html +++ /dev/null @@ -1,99 +0,0 @@ -<smp-search-table #searchTable - page_id='edit_id' - [title]="'Edit'" - [columnPicker]="columnPicker" - [url]="baseUrl" - [additionalToolButtons]="additionalToolButtons" - [searchPanel]="searchPanel" - [filter]="filter" - [searchTableController]="serviceGroupEditController" - [tableRowDetailContainer]="tableRowDetailContainer" - [additionalRowActionButtons]="additionalRowActionButtons" - [allowNewItems]="securityService.isCurrentUserSMPAdmin()" - [allowDeleteItems]="securityService.isCurrentUserSMPAdmin()" -> - <ng-template #rowSMPUrlLinkAction let-row="row" let-value="value" ngx-datatable-cell-template - > - <a target="_blank" matTooltip="Open metadata as XML data" - href="{{contextPath}}{{createServiceGroupURL(row)}}">Open URL</a> - </ng-template> - - - <ng-template #searchPanel> - <mat-form-field> - <input matInput placeholder="Participant Identifier" name="ParticipantIdentifier" - [(ngModel)]="filter.participantIdentifier" - #messageId="ngModel" id="participantIdentifier"> - </mat-form-field> - <mat-form-field> - <input matInput placeholder="Participant scheme" name="patricipantScheme" [(ngModel)]="filter.participantScheme" - #messageId="ngModel" id="participantScheme"> - </mat-form-field> - <mat-select placeholder="All Domains" [(ngModel)]="filter.domain" name="domain" - id="domain_id"> - <mat-option [value]="''">All Domains</mat-option> - <mat-option *ngFor="let domain of lookups.cachedDomainList" [value]="domain.domainCode"> - {{domain.domainCode}} ({{domain.smlSubdomain}}) - </mat-option> - </mat-select> - </ng-template> - - - <ng-template #additionalToolButtons></ng-template> - - <ng-template #additionalRowActionButtons let-row="row" > - <button mat-icon-button color="primary" [disabled]="row?.deleted || loading" - (click)="onAddMetadataRow(row)" matTooltip="Add service metadata"> - <mat-icon>playlist_add</mat-icon> - </button> - </ng-template> - - <ng-template #tableRowDetailContainer let-row="row"> - - <div *ngIf="row.serviceMetadata.length===0" style="padding-left:20px;"> - No service metadata - </div> - <div *ngIf="row.serviceMetadata.length !== 0" > - <ngx-datatable - class='inner-table material striped' - [loadingIndicator]="false" - [rows]='row.serviceMetadata' - [columnMode]='"force"' - [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> - <ngx-datatable-column prop="documentIdentifier" name="Document identifier" maxWidth="250" ></ngx-datatable-column> - <ngx-datatable-column [cellTemplate]="rowMetadataSMPUrlLinkAction" name="URL" maxWidth="250" ></ngx-datatable-column> - <ngx-datatable-column [cellTemplate]="rowMetadataActions" name="Actions" maxWidth="150" ></ngx-datatable-column> - - <ng-template #rowDomain let-rowSmd="row" ngx-datatable-cell-template> - {{rowSmd.domainCode}} ({{rowSmd.smlSubdomain}}) - </ng-template> - - <ng-template #rowMetadataSMPUrlLinkAction let-rowSmd="row" ngx-datatable-cell-template> - <a target="_blank" - href="{{contextPath}}{{createServiceMetadataURL(row, rowSmd)}}" >Open URL</a> - </ng-template> - </ngx-datatable> - - <ng-template #rowMetadataActions let-rowSmd="row" ngx-datatable-cell-template> - <div> - <button mat-icon-button color="primary" [disabled]="rowSmd.deleted || loading" - (click)="onEditMetadataRow(row, rowSmd)" matTooltip="Edit service metadata"> - <mat-icon>edit</mat-icon> - </button> - <button mat-icon-button color="primary" [disabled]="rowSmd.deleted || loading" - (click)="onDeleteMetadataRowActionClicked(row, rowSmd)" matTooltip="Delete service metadata"> - <mat-icon>delete</mat-icon> - </button> - </div> - </ng-template> - - </div> - </ng-template> - -</smp-search-table> 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 deleted file mode 100644 index f34997b89f38fa4390e06a70e5d979554e6c97c6..0000000000000000000000000000000000000000 --- a/smp-angular/src/app/service-group-edit/service-group-edit.component.ts +++ /dev/null @@ -1,225 +0,0 @@ -import { - AfterViewChecked, - AfterViewInit, - ChangeDetectorRef, - Component, - OnInit, - TemplateRef, - ViewChild -} from '@angular/core'; -import {ColumnPicker} from '../common/column-picker/column-picker.model'; -import {MatDialog, MatDialogRef} from '@angular/material/dialog'; -import {AlertMessageService} from '../common/alert-message/alert-message.service'; -import {ServiceGroupEditController} from './service-group-edit-controller'; -import {HttpClient} from '@angular/common/http'; -import {SmpConstants} from "../smp.constants"; -import {EntityStatus} from "../common/enums/entity-status.enum"; -import {SearchTableComponent} from "../common/search-table/search-table.component"; -import {GlobalLookups} from "../common/global-lookups"; -import {SecurityService} from "../security/security.service"; - -@Component({ - moduleId: 'edit', - templateUrl: './service-group-edit.component.html', - styleUrls: ['./service-group-edit.component.css'] -}) -export class ServiceGroupEditComponent implements OnInit, AfterViewInit, AfterViewChecked { - - @ViewChild('rowMetadataAction', {static: true}) rowMetadataAction: TemplateRef<any> - @ViewChild('rowActions', {static: true}) rowActions: TemplateRef<any>; - @ViewChild('rowSMPUrlLinkAction', {static: true}) rowSMPUrlLinkAction: TemplateRef<any>; - @ViewChild('searchTable', {static: true}) searchTable: SearchTableComponent; - - columnPicker: ColumnPicker = new ColumnPicker(); - serviceGroupEditController: ServiceGroupEditController; - filter: any = {}; - baseUrl: string; - contextPath: string = location.pathname.substring(0, location.pathname.length - 3); // remove /ui s - - constructor(public securityService: SecurityService, - protected lookups: GlobalLookups, - protected http: HttpClient, - protected alertService: AlertMessageService, - public dialog: MatDialog, - private changeDetector: ChangeDetectorRef) { - - // if smp admin it needs to have update user list for detail dialog! - if (this.securityService.isCurrentUserSMPAdmin() || this.securityService.isCurrentUserServiceGroupAdmin()) { - this.lookups.refreshUserLookup(); - this.lookups.refreshApplicationConfiguration(); - } - this.baseUrl = SmpConstants.REST_PUBLIC_SERVICE_GROUP; - } - - ngOnInit(): void { - this.serviceGroupEditController = new ServiceGroupEditController(this.dialog); - } - - initColumns() { - this.columnPicker.allColumns = [ - { - name: 'Metadata', - prop: 'serviceMetadata.length', - showInitially: true, - width: 75, - maxWidth: 75, - resizable: "false", - }, - { - name: 'Owners', - prop: 'users.length', - showInitially: true, - width: 75, - maxWidth: 75, - resizable: "false" - }, - { - name: 'Participant scheme', - prop: 'participantScheme', - showInitially: true, - width: 200, - maxWidth: 300, - resizable: "false" - }, - { - name: 'Participant identifier', - prop: 'participantIdentifier', - showInitially: true, - }, - { - cellTemplate: this.rowSMPUrlLinkAction, - name: 'OASIS ServiceGroup URL', - showInitially: true, - width: 150, - maxWidth: 250, - resizable: "false", - sortable: false - }, - ]; - this.searchTable.tableColumnInit(); - } - - ngAfterViewChecked() { - this.changeDetector.detectChanges(); - } - - ngAfterViewInit(): void { - this.initColumns(); - } - - details(row: any) { - this.serviceGroupEditController.showDetails(row); - - } - - onAddMetadataRow(row: any) { - let rowNumber = this.searchTable.rows.indexOf(row); - - const formRef: MatDialogRef<any> = this.serviceGroupEditController.newMetadataDialog({ - data: {edit: false, serviceGroup: row, metadata: this.serviceGroupEditController.newServiceMetadataRow()} - }); - formRef.afterClosed().subscribe(result => { - if (result) { - const status = row.status === EntityStatus.PERSISTED - ? EntityStatus.UPDATED - : row.status; - - let data = formRef.componentInstance.getCurrent(); - row.serviceMetadata.push(data); - this.searchTable.updateTableRow(rowNumber, row, status); - } - }); - - } - - getRowClass(row) { - return { - 'table-row-new': (row.status === EntityStatus.NEW), - 'table-row-updated': (row.status === EntityStatus.UPDATED), - 'deleted': (row.status === EntityStatus.REMOVED) - }; - } - - onEditMetadataRow(serviceGroupRow: any, metaDataRow: any) { - let metadataRowNumber = serviceGroupRow.serviceMetadata.indexOf(metaDataRow); - - const formRef: MatDialogRef<any> = this.serviceGroupEditController.newMetadataDialog({ - data: { - edit: metaDataRow.status !== EntityStatus.NEW, - serviceGroup: serviceGroupRow, - metadata: metaDataRow - } - }); - formRef.afterClosed().subscribe(result => { - if (result) { - - // method isServiceMetaDataChanged must be called before getCurrent! - let isChanged = formRef.componentInstance.isServiceMetaDataChanged(); - if (!isChanged) { - // nothing to save - return; - } - - let statusMetadata = metaDataRow.status === EntityStatus.PERSISTED - ? EntityStatus.UPDATED - : metaDataRow; - - metaDataRow.status = statusMetadata; - metaDataRow = {...formRef.componentInstance.getCurrent()}; - - serviceGroupRow.serviceMetadata [metadataRowNumber] = {...metaDataRow}; - // change reference to fire table update - serviceGroupRow.serviceMetadata = [...serviceGroupRow.serviceMetadata] - - // set row as updated - const status = serviceGroupRow.status === EntityStatus.PERSISTED - ? EntityStatus.UPDATED - : serviceGroupRow.status; - serviceGroupRow.status = status; - - this.changeDetector.detectChanges(); - - } - }); - } - - onDeleteMetadataRowActionClicked(serviceGroupRow: any, metaDataRow: any) { - let rowNumber = this.searchTable.rows.indexOf(serviceGroupRow); - - if (metaDataRow.status === EntityStatus.NEW) { - serviceGroupRow.splice(serviceGroupRow.indexOf(metaDataRow), 1); - } else { - metaDataRow.status = EntityStatus.REMOVED; - metaDataRow.deleted = true; - // set row as updated - const status = serviceGroupRow.status === EntityStatus.PERSISTED - ? EntityStatus.UPDATED - : serviceGroupRow.status; - serviceGroupRow.status = status; - - // do not do that it updates the whole table - // this.searchTable.rows[rowNumber] = {...serviceGroupRow, status}; - // this.searchTable.rows = [...this.searchTable.rows]; - } - } - - - // for dirty guard... - isDirty(): boolean { - return this.searchTable.isDirty(); - } - - createServiceGroupURL(row: any) { - return encodeURIComponent((!row.participantScheme ? '' : row.participantScheme) + '::' + row.participantIdentifier); - } - - 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); - } - } -} diff --git a/smp-angular/src/app/service-group-edit/service-group-extension-wizard-dialog/service-group-extension-wizard-dialog.component.css b/smp-angular/src/app/service-group-edit/service-group-extension-wizard-dialog/service-group-extension-wizard-dialog.component.css deleted file mode 100644 index b734d415f91b5d605412708ad09654221ffbd456..0000000000000000000000000000000000000000 --- a/smp-angular/src/app/service-group-edit/service-group-extension-wizard-dialog/service-group-extension-wizard-dialog.component.css +++ /dev/null @@ -1,5 +0,0 @@ -.flex-dialog-content{ - display: flex; justify-content: space-around; - flex-flow: row; - align-items: stretch;height:510px;min-width:950px -} diff --git a/smp-angular/src/app/service-group-edit/service-group-extension-wizard-dialog/service-group-extension-wizard-dialog.component.html b/smp-angular/src/app/service-group-edit/service-group-extension-wizard-dialog/service-group-extension-wizard-dialog.component.html deleted file mode 100644 index 4b6e3041900c8bd9a65822e13f48000d6a7a850a..0000000000000000000000000000000000000000 --- a/smp-angular/src/app/service-group-edit/service-group-extension-wizard-dialog/service-group-extension-wizard-dialog.component.html +++ /dev/null @@ -1,34 +0,0 @@ -<h2 mat-dialog-title>ServiceGroup Extension Wizard</h2> - -<mat-dialog-content [class]="'flex-dialog-content'"> - <form [formGroup]="dialogForm"> - <mat-card> - <mat-card-content> - <fieldset style="border: none;"> - <mat-form-field *ngFor="let elmnt of elements;" style="width:100%"> - <input matInput - type="{{elmnt.type}}" - placeholder="{{elmnt.name}} - {{elmnt.description}}" - [name]="elmnt.name" - id="{{elmnt.name}}_id" - [formControl]="dialogForm.controls[elmnt.name]" maxlength="255"> - </mat-form-field > - </fieldset> - </mat-card-content> - </mat-card> - </form> -</mat-dialog-content> - -<mat-dialog-actions> - <button mat-raised-button color="primary" [mat-dialog-close]="true" - [disabled]="!dialogForm.valid"> - <mat-icon>check_circle</mat-icon> - <span>OK</span> - </button> - - <button mat-raised-button color="primary" mat-dialog-close> - <mat-icon>cancel</mat-icon> - <span>Cancel</span> - </button> - -</mat-dialog-actions> diff --git a/smp-angular/src/app/service-group-edit/service-group-extension-wizard-dialog/service-group-extension-wizard-dialog.component.ts b/smp-angular/src/app/service-group-edit/service-group-extension-wizard-dialog/service-group-extension-wizard-dialog.component.ts deleted file mode 100644 index fe7b321e0f0a410b3475716c35289828894b5091..0000000000000000000000000000000000000000 --- a/smp-angular/src/app/service-group-edit/service-group-extension-wizard-dialog/service-group-extension-wizard-dialog.component.ts +++ /dev/null @@ -1,62 +0,0 @@ -import {Component} from '@angular/core'; -import {MatDialogRef} from '@angular/material/dialog'; -import {UntypedFormBuilder, UntypedFormControl, UntypedFormGroup} from "@angular/forms"; - -@Component({ - selector: 'service-group-extension-wizard', - templateUrl: './service-group-extension-wizard-dialog.component.html', - styleUrls: ['./service-group-extension-wizard-dialog.component.css'] -}) -export class ServiceGroupExtensionWizardDialogComponent { - dialogForm: UntypedFormGroup; - - dummyXML: string ="<!-- Custom element is mandatory by OASIS SMP schema.\n Replace following element with your XML structure. -->\n<ext:example xmlns:ext=\"http://my.namespace.eu\">my mandatory content</ext:example>" - - elements: any[] = [ - {name:'ExtensionID', description:'An identifier for the Extension assigned by the creator of the extension.', type:'text'}, - {name:'ExtensionName', description:'A name for the Extension assigned by the creator of the extension.', type:'text'}, - {name:'ExtensionAgencyID', description:'An agency that maintains one or more Extensions.', type:'text'}, - {name:'ExtensionAgencyName', description:'The name of the agency that maintains the Extension.', type:'text'}, - {name:'ExtensionAgencyURI', description:'A URI for the Agency that maintains the Extension.', type:'url'}, - {name:'ExtensionVersionID', description:'The version of the Extension.', type:'text'}, - {name:'ExtensionURI', description:'A URI for the Extension.', type:'url'}, - {name:'ExtensionReasonCode', description:'A code for reason the Extension is being included.', type:'text'}, - {name:'ExtensionReason', description:'A description of the reason for the Extension.', type:'text'}, - ]; - - constructor(public dialogRef: MatDialogRef<ServiceGroupExtensionWizardDialogComponent>, - private dialogFormBuilder: UntypedFormBuilder) { - - this.dialogForm = this.dialogFormBuilder.group({ }); - - let arrayLength = this.elements.length; - for (var i = 0; i < arrayLength; i++) { - this.dialogForm.addControl(this.elements[i].name, new UntypedFormControl('')); - } - } - - getExtensionXML(){ - var xmlString = '<Extension xmlns="http://docs.oasis-open.org/bdxr/ns/SMP/2016/05">' - let arrayLength = this.elements.length; - for (var i = 0; i < arrayLength; i++) { - let str = this.dialogForm.get(this.elements[i].name).value; - if (str && 0 !== str.length) { - xmlString = xmlString + '\n <'+this.elements[i].name+'>' + this.xmlSpecialChars(str) + '</'+this.elements[i].name+'>'; - } - } - xmlString = xmlString+ '\n' +this.dummyXML+ '\n</Extension>' - - return xmlString; - } - - xmlSpecialChars(unsafe) { - return unsafe - .replace(/&/g, "&") - .replace(/</g, "<") - .replace(/>/g, ">") - .replace(/"/g, """); - } - - - -} diff --git a/smp-angular/src/app/service-group-edit/service-group-metadata-dialog/service-group-metadata-dialog.component.css b/smp-angular/src/app/service-group-edit/service-group-metadata-dialog/service-group-metadata-dialog.component.css deleted file mode 100644 index c6fbe97a8728a261639ad5100e7f99fc07057c62..0000000000000000000000000000000000000000 --- a/smp-angular/src/app/service-group-edit/service-group-metadata-dialog/service-group-metadata-dialog.component.css +++ /dev/null @@ -1,50 +0,0 @@ -.flex-dialog-content { - display: flex; - justify-content: space-around; - flex-flow: row; - align-items: stretch; - height: 510px; - min-width: 950px -} - -label:hover, label:active, input:hover + label, input:active + label { - color: #3f51b5; -} - -.divTable { - display: table; - width: 100%; -} - -.divTableRow { - display: table-row; -} - -.divTableHeading { - background-color: #EEE; - display: table-header-group; -} - -.divTableCell, .divTableHead { - /*border: 1px solid #999999;*/ - display: table-cell; - padding: 3px 3px; - text-align: center; -} - -.divTableHeading { - background-color: #EEE; - display: table-header-group; - font-weight: bold; -} - -.divTableFoot { - background-color: #EEE; - display: table-footer-group; - font-weight: bold; -} - -.divTableBody { - display: table-row-group; -} - diff --git a/smp-angular/src/app/service-group-edit/service-group-metadata-dialog/service-group-metadata-dialog.component.html b/smp-angular/src/app/service-group-edit/service-group-metadata-dialog/service-group-metadata-dialog.component.html deleted file mode 100644 index e6604b7705d144203558d3fed1dc3000b7a47de0..0000000000000000000000000000000000000000 --- a/smp-angular/src/app/service-group-edit/service-group-metadata-dialog/service-group-metadata-dialog.component.html +++ /dev/null @@ -1,116 +0,0 @@ -<h2 mat-dialog-title>{{formTitle}}</h2> -<mat-dialog-content class="flex-dialog-content"> - <div fxLayout="column" style="flex-grow: 1;"> - <mat-card style="flex-grow: 1;" > - - <mat-card-content > - <div class="panel"> - <mat-form-field style="width:30%"> - <input matInput placeholder="Participant scheme" name="patricipantSchema" id="participanSchema_id" - [formControl]="dialogForm.controls['participantScheme']" - > - </mat-form-field> - <mat-form-field style="width:40%"> - <input matInput placeholder="Participant Identifier" name="participantIdentifier" id="participantIdentifier_id" - [formControl]="dialogForm.controls['participantIdentifier']"> - </mat-form-field> - <mat-select #domainList [compareWith]="compareDomainCode" placeholder="Domain (sml subdomain)" id="domain_id" style="width:20%" - [formControl]="dialogForm.controls['domainCode']"> - <mat-option *ngFor="let domain of currentServiceGroup.serviceGroupDomains" [value]="domain"> - {{domain.domainCode}} ({{domain.smlSubdomain}}) - </mat-option> - </mat-select> - <div - *ngIf="(!editMode && dialogForm.controls['domainCode'].touched || editMode) && dialogForm.controls['domainCode'].hasError('required')" - style="color:red; font-size: 70%"> - Domain must be selected. - </div> - - <mat-form-field style="width:30%"> - <input matInput placeholder="Document identifier scheme" name="documentScheme" id="documentScheme_id" - [formControl]="dialogForm.controls['documentIdentifierScheme']" maxlength="255" > - </mat-form-field> - <mat-form-field style="width:55%"> - <input matInput placeholder="Document identifier" name="documentIdentifier" id="documentIdentifier_id" - [formControl]="dialogForm.controls['documentIdentifier']" maxlength="255" required> - </mat-form-field> - </div> - </mat-card-content> - </mat-card> - - - <mat-card style="flex-grow: 1;"> - <mat-card-content> - <mat-toolbar class ="mat-elevation-z2"> - <mat-toolbar-row class="smp-toolbar-row"> - <button mat-raised-button color="primary" - matTooltip="Clear the metadata content." - matTooltipPosition="below" - (click)="onClearServiceMetadata()"> - <mat-icon>clear</mat-icon> - <span>Clear</span> - </button> - <button mat-raised-button color="primary" - matTooltip="Generates simple XML" - matTooltipPosition="below" - (click)="onGenerateSimpleXML()"> - <mat-icon>settings_ethernet</mat-icon> - <span>Generate XML</span> - </button> - <button mat-raised-button color="primary" - matTooltip="Opens wizard to configure ServiceMetadata xml." - matTooltipPosition="below" - (click)="onStartWizardDialog()"> - <mat-icon>add_box</mat-icon> - <span>Metadata wizard</span> - </button> - <button mat-raised-button color="primary" - matTooltip="Validate serviceMetadata XML." - matTooltipPosition="below" - (click)="onServiceMetadataValidate()"> - <mat-icon>warning</mat-icon> - <span>Validate</span> - </button> - </mat-toolbar-row> - </mat-toolbar> - - <div style="display: block;border:1px; solid: #999999;margin:5px 0; padding:3px;"> - <div class="textwrapper"> - <textarea matInput style="width:100%;border: #03A9F4 1px solid" cols="2" rows="25" - resizeable="false" - id="MetadataTextArea" - placeholder="Metadata XML*" name="metadataXML" - [formControl]="dialogForm.controls['xmlContent']" - - required></textarea> - </div> - <div - *ngIf="(!editMode && dialogForm.controls['xmlContent'].dirty || editMode) && dialogForm.controls['xmlContent'].hasError('required')" - style="color:red; font-size: 70%"> - Valid service metadata XML is required! - </div> - <div - *ngIf="metadataValidationMessage && !((!editMode && dialogForm.controls['xmlContent'].touched || editMode) && dialogForm.controls['xmlContent'].hasError('required'))" - [style.color]="isMetadataValid?'green':'red'"> - {{metadataValidationMessage}} - </div> - - </div> - - </mat-card-content> - </mat-card> - </div> - <div class="required-fields">* required fields</div> -</mat-dialog-content> -<mat-dialog-actions> - <button mat-raised-button color="primary" (click)="submitForm()" - [disabled]="!dialogForm.valid"> - <mat-icon>check_circle</mat-icon> - <span>OK</span> - </button> - - <button mat-raised-button color="primary" mat-dialog-close> - <mat-icon>cancel</mat-icon> - <span>Cancel</span> - </button> -</mat-dialog-actions> diff --git a/smp-angular/src/app/service-group-edit/service-group-metadata-dialog/service-group-metadata-dialog.component.spec.ts b/smp-angular/src/app/service-group-edit/service-group-metadata-dialog/service-group-metadata-dialog.component.spec.ts deleted file mode 100644 index 86acc1f1913a61b83d755d8f4bfdab3ddcbba05e..0000000000000000000000000000000000000000 --- a/smp-angular/src/app/service-group-edit/service-group-metadata-dialog/service-group-metadata-dialog.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; - -import { ServiceGroupMetadataDialogComponent } from './service-group-metadata-dialog.component'; - -describe('ServiceGroupMetadataDialogComponent', () => { - let component: ServiceGroupMetadataDialogComponent; - let fixture: ComponentFixture<ServiceGroupMetadataDialogComponent>; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ ServiceGroupMetadataDialogComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(ServiceGroupMetadataDialogComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/smp-angular/src/app/service-group-edit/service-group-metadata-dialog/service-group-metadata-dialog.component.ts b/smp-angular/src/app/service-group-edit/service-group-metadata-dialog/service-group-metadata-dialog.component.ts deleted file mode 100644 index e9af19b5f8ca9fe87c1d28f65bda276791cd7801..0000000000000000000000000000000000000000 --- a/smp-angular/src/app/service-group-edit/service-group-metadata-dialog/service-group-metadata-dialog.component.ts +++ /dev/null @@ -1,302 +0,0 @@ -import {Component, Inject, OnInit, ViewChild} from '@angular/core'; -import {MAT_DIALOG_DATA, MatDialog, MatDialogConfig, MatDialogRef} from '@angular/material/dialog'; -import {UntypedFormBuilder, UntypedFormControl, UntypedFormGroup, Validators} from "@angular/forms"; -import {AlertMessageService} from "../../common/alert-message/alert-message.service"; -import {EntityStatus} from "../../common/enums/entity-status.enum"; -import {ServiceMetadataEditRo} from "../service-metadata-edit-ro.model"; -import {GlobalLookups} from "../../common/global-lookups"; -import {ServiceMetadataWizardDialogComponent} from "../service-metadata-wizard-dialog/service-metadata-wizard-dialog.component"; -import {ServiceGroupEditRo} from "../service-group-edit-ro.model"; -import {SmpConstants} from "../../smp.constants"; -import {Observable} from "rxjs/internal/Observable"; -import {HttpClient} from "@angular/common/http"; -import {ServiceGroupDomainEditRo} from "../service-group-domain-edit-ro.model"; -import {ServiceMetadataValidationEditRo} from "./service-metadata-validation-edit-ro.model"; -import {ServiceMetadataWizardRo} from "../service-metadata-wizard-dialog/service-metadata-wizard-edit-ro.model"; - -@Component({ - selector: 'service-group-metadata-dialog', - templateUrl: './service-group-metadata-dialog.component.html', - styleUrls: ['./service-group-metadata-dialog.component.css'] -}) -export class ServiceGroupMetadataDialogComponent implements OnInit { - - static readonly NEW_MODE = 'New ServiceMetadata'; - static readonly EDIT_MODE = 'Edit ServiceMetadata'; - - @ViewChild('domainList') domainList: any; - - - editMode: boolean; - formTitle: string; - current: ServiceMetadataEditRo & { confirmation?: string }; - currentServiceGroup: ServiceGroupEditRo; - dialogForm: UntypedFormGroup; - metadataValidationMessage: string; - xmlServiceMetadataObserver: Observable<ServiceMetadataEditRo>; - isMetadataValid: boolean = true; - - - constructor(public dialog: MatDialog, - protected http: HttpClient, - public lookups: GlobalLookups, - private dialogRef: MatDialogRef<ServiceGroupMetadataDialogComponent>, - private alertService: AlertMessageService, - @Inject(MAT_DIALOG_DATA) public data: any, - private fb: UntypedFormBuilder) { - - this.editMode = data.edit; - this.formTitle = !!data.metadata ? ServiceGroupMetadataDialogComponent.EDIT_MODE : ServiceGroupMetadataDialogComponent.NEW_MODE; - this.currentServiceGroup = data.serviceGroup; - this.current = !!data.metadata - ? { - ...data.metadata, - } - : { - documentIdentifier: '', - documentIdentifierScheme: '', - smlSubdomain: this.currentServiceGroup.serviceGroupDomains[0].smlSubdomain, - domainCode: this.currentServiceGroup.serviceGroupDomains[0].domainCode, - domainId: null, - status: EntityStatus.NEW, - xmlContentStatus: EntityStatus.NEW, - }; - - this.dialogForm = fb.group({ - 'participantIdentifier': new UntypedFormControl({value: this.currentServiceGroup.participantIdentifier, disabled: true}), - 'participantScheme': new UntypedFormControl({value: this.currentServiceGroup.participantScheme, disabled: true}), - 'domainCode': new UntypedFormControl({}, [Validators.required]), - - 'documentIdentifier': new UntypedFormControl({value: this.current.documentIdentifier, disabled: this.editMode}, - [Validators.required]), - 'documentIdentifierScheme': new UntypedFormControl({ - value: this.current.documentIdentifierScheme, - disabled: this.editMode - }, - []), - 'xmlContent': new UntypedFormControl({value: ''}, [Validators.required]), - }); - - // update values - this.dialogForm.controls['domainCode'].setValue(this.current.domainCode); - this.dialogForm.controls['xmlContent'].setValue(this.current.xmlContent); - } - - ngOnInit() { - - // retrieve xml extension for this service group - if (this.current.status !== EntityStatus.NEW && !this.current.xmlContent) { - // init domains - this.xmlServiceMetadataObserver = this.http.get<ServiceMetadataEditRo>(SmpConstants.REST_METADATA + '/' + this.current.id); - this.xmlServiceMetadataObserver.subscribe((res: ServiceMetadataEditRo) => { - this.dialogForm.get('xmlContent').setValue(res.xmlContent); - // store init xml to current value for change validation - this.current.xmlContent = res.xmlContent; - }); - } - - } - - checkValidity(g: UntypedFormGroup) { - Object.keys(g.controls).forEach(key => { - g.get(key).markAsDirty(); - }); - Object.keys(g.controls).forEach(key => { - g.get(key).markAsTouched(); - }); - //!!! updateValueAndValidity - else some filed did no update current / on blur never happened - Object.keys(g.controls).forEach(key => { - g.get(key).updateValueAndValidity(); - }); - } - - submitForm() { - this.checkValidity(this.dialogForm); - - // before closing check the schema - let request: ServiceMetadataValidationEditRo = { - participantScheme: this.dialogForm.controls['participantScheme'].value, - participantIdentifier: this.dialogForm.controls['participantIdentifier'].value, - documentIdentifierScheme: !this.dialogForm.controls['documentIdentifierScheme'].value ? null : - this.dialogForm.controls['documentIdentifierScheme'].value, - documentIdentifier: this.dialogForm.controls['documentIdentifier'].value, - xmlContent: this.dialogForm.controls['xmlContent'].value, - statusAction: this.editMode ? EntityStatus.UPDATED : EntityStatus.NEW, - } - // - let validationObservable = this.http.post<ServiceMetadataValidationEditRo>(SmpConstants.REST_METADATA_VALIDATE, request); - validationObservable.subscribe((res: ServiceMetadataValidationEditRo) => { - if (res.errorMessage) { - this.metadataValidationMessage = res.errorMessage; - this.isMetadataValid = false; - } else { - this.metadataValidationMessage = "ServiceMetada is valid!"; - this.isMetadataValid = true; - // now we can close the dialog - this.dialogRef.close(true); - } - - }); - } - - onClearServiceMetadata() { - this.dialogForm.controls['xmlContent'].setValue(""); - } - - onStartWizardDialog() { - - let serviceMetadataWizard: ServiceMetadataWizardRo = { - isNewServiceMetadata: !this.editMode, - participantIdentifier: this.dialogForm.controls['participantIdentifier'].value, - participantScheme: this.dialogForm.controls['participantScheme'].value, - documentIdentifier: this.dialogForm.controls['documentIdentifier'].value, - documentIdentifierScheme: this.dialogForm.controls['documentIdentifierScheme'].value, - processIdentifier: '', - processScheme: '', - transportProfile: 'bdxr-transport-ebms3-as4-v1p0', // default value for oasis AS4 - - endpointUrl: '', - endpointCertificate: '', - - serviceDescription: '', - technicalContactUrl: '', - - } - - let wizardInit: MatDialogConfig = { - data: serviceMetadataWizard - } - - - const formRef: MatDialogRef<any> = this.dialog.open(ServiceMetadataWizardDialogComponent, wizardInit); - formRef.afterClosed().subscribe(result => { - if (result) { - - let smw: ServiceMetadataWizardRo = formRef.componentInstance.getCurrent(); - this.dialogForm.controls['xmlContent'].setValue(smw.contentXML); - if (!this.editMode) { - this.dialogForm.controls['documentIdentifierScheme'].setValue(smw.documentIdentifierScheme); - this.dialogForm.controls['documentIdentifier'].setValue(smw.documentIdentifier); - } - } - }); - } - - getParticipantElementXML(): string { - let schema = this.dialogForm.controls['participantScheme'].value; - let value = this.dialogForm.controls['participantIdentifier'].value; - if (!!schema && this.lookups.cachedApplicationConfig.concatEBCorePartyId && - schema.startsWith(ServiceMetadataWizardDialogComponent.EBCORE_IDENTIFIER_PREFIX)) { - value = schema + ":" + value; - schema = null; - } - - return '<ParticipantIdentifier ' + - (!schema ? '' : 'scheme="' + this.xmlSpecialChars(schema) + '"') + '>' - + this.xmlSpecialChars(value) + '</ParticipantIdentifier>'; - } - - getDocumentElementXML(): string { - return ' <DocumentIdentifier ' + - (!this.dialogForm.controls['documentIdentifierScheme'].value ? '' : 'scheme="' - + this.xmlSpecialChars(this.dialogForm.controls['documentIdentifierScheme'].value) + '"') + - '>' + this.xmlSpecialChars(this.dialogForm.controls['documentIdentifier'].value) + '</DocumentIdentifier>'; - } - - onGenerateSimpleXML() { - let exampleXML = '<ServiceMetadata xmlns="http://docs.oasis-open.org/bdxr/ns/SMP/2016/05">' + - '\n <ServiceInformation>' + - '\n ' + this.getParticipantElementXML() + - '\n ' + this.getDocumentElementXML() + - '\n <ProcessList>' + - '\n <Process>' + - '\n <ProcessIdentifier scheme="[enterProcessType]">[enterProcessName]</ProcessIdentifier>' + - '\n <ServiceEndpointList>' + - '\n <Endpoint transportProfile="bdxr-transport-ebms3-as4-v1p0">' + - '\n <EndpointURI>https://mypage.eu</EndpointURI>' + - '\n <Certificate>UGFzdGUgYmFzZTY0IGVuY29kZWQgY2VydGlmaWNhdGUgb2YgQVA=</Certificate>' + - '\n <ServiceDescription>Service description for partners</ServiceDescription>' + - '\n <TechnicalContactUrl>www.best-page.eu</TechnicalContactUrl>' + - '\n </Endpoint>' + - '\n </ServiceEndpointList>' + - '\n </Process>' + - '\n </ProcessList>' + - '\n </ServiceInformation>' + - '\n</ServiceMetadata>'; - this.dialogForm.controls['xmlContent'].setValue(exampleXML); - } - - xmlSpecialChars(unsafe) { - return !unsafe ? '' : unsafe - .replace(/&/g, "&") - .replace(/</g, "<") - .replace(/>/g, ">") - .replace(/"/g, """); - } - - onServiceMetadataValidate() { - - let request: ServiceMetadataValidationEditRo = { - - participantScheme: this.dialogForm.controls['participantScheme'].value, - participantIdentifier: this.dialogForm.controls['participantIdentifier'].value, - documentIdentifierScheme: !this.dialogForm.controls['documentIdentifierScheme'].value ? null : - this.dialogForm.controls['documentIdentifierScheme'].value, - documentIdentifier: this.dialogForm.controls['documentIdentifier'].value, - xmlContent: this.dialogForm.controls['xmlContent'].value, - statusAction: this.editMode ? EntityStatus.UPDATED : EntityStatus.NEW, - } - // - let validationObservable = this.http.post<ServiceMetadataValidationEditRo>(SmpConstants.REST_METADATA_VALIDATE, request); - validationObservable.subscribe((res: ServiceMetadataValidationEditRo) => { - if (res.errorMessage) { - this.metadataValidationMessage = res.errorMessage; - this.isMetadataValid = false; - } else { - this.metadataValidationMessage = "Servicemetadata is valid!"; - this.isMetadataValid = true; - } - - }); - } - - public getCurrent(): ServiceMetadataEditRo { - - this.current.domainCode = this.domainList.selected.value.domainCode; - this.current.smlSubdomain = this.domainList.selected.value.smlSubdomain; - this.current.domainId = this.domainList.selected.value.domainId; - - this.current.xmlContent = this.dialogForm.value['xmlContent']; - // change this two properties only on new - if (this.current.status === EntityStatus.NEW) { - this.current.documentIdentifier = this.dialogForm.value['documentIdentifier']; - this.current.documentIdentifierScheme = this.dialogForm.value['documentIdentifierScheme']; - } else if (this.current.status === EntityStatus.PERSISTED) { - this.current.status = EntityStatus.UPDATED; - this.current.xmlContentStatus = EntityStatus.UPDATED; - } - return this.current; - } - - //!! this two method must be called before getCurrent - public isMetaDataXMLChanged(): boolean { - return this.dialogForm.value['xmlContent'] !== this.current.xmlContent; - } - - public isServiceMetaDataChanged(): boolean { - return this.isMetaDataXMLChanged() || !this.isEqual(this.current.domainCode, this.domainList.selected.value.domainCode); - } - - compareDomainCode(sgDomain: ServiceGroupDomainEditRo, domainCode: string): boolean { - return sgDomain.domainCode === domainCode; - } - - 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-metadata-dialog/service-metadata-validation-edit-ro.model.ts b/smp-angular/src/app/service-group-edit/service-group-metadata-dialog/service-metadata-validation-edit-ro.model.ts deleted file mode 100644 index 3f5fb422391df2c6d58fa4d307ded6ac45309771..0000000000000000000000000000000000000000 --- a/smp-angular/src/app/service-group-edit/service-group-metadata-dialog/service-metadata-validation-edit-ro.model.ts +++ /dev/null @@ -1,11 +0,0 @@ - -export interface ServiceMetadataValidationEditRo { - participantScheme: string; - participantIdentifier: string; - documentIdentifierScheme: string; - documentIdentifier: string; - - errorMessage?: string; - xmlContent?: string; - statusAction: number; -} diff --git a/smp-angular/src/app/service-group-edit/service-metadata-edit-ro.model.ts b/smp-angular/src/app/service-group-edit/service-metadata-edit-ro.model.ts deleted file mode 100644 index 8f6e3dfa5d3c572f937003a66bd870af2997d4a6..0000000000000000000000000000000000000000 --- a/smp-angular/src/app/service-group-edit/service-metadata-edit-ro.model.ts +++ /dev/null @@ -1,13 +0,0 @@ -import {SearchTableEntity} from "../common/search-table/search-table-entity.model"; - - -export interface ServiceMetadataEditRo extends SearchTableEntity { - documentIdentifier: string; - documentIdentifierScheme?: string; - smlSubdomain: string; - domainCode: string; - domainId: null, - xmlContent?:string, - xmlContentStatus:number, - -} diff --git a/smp-angular/src/app/service-group-search/service-group-search.component.ts b/smp-angular/src/app/service-group-search/service-group-search.component.ts index fc9a7a11730e8472ac7255657144ba3721eca33d..d4ae3b77022cabd171dcefed31a11deb77174cf9 100644 --- a/smp-angular/src/app/service-group-search/service-group-search.component.ts +++ b/smp-angular/src/app/service-group-search/service-group-search.component.ts @@ -46,10 +46,6 @@ export class ServiceGroupSearchComponent implements OnInit, AfterViewInit, After this.baseUrl = SmpConstants.REST_PUBLIC_SEARCH_SERVICE_GROUP; } - ngOnDestroy() { - - } - ngOnInit(): void { this.serviceGroupSearchController = new ServiceGroupSearchController(this.dialog); } diff --git a/smp-angular/src/app/system-settings/property/property-details-dialog/property-details-dialog.component.ts b/smp-angular/src/app/system-settings/property/property-details-dialog/property-details-dialog.component.ts index 3440cd079354196f0e7108423fa981813e531917..31629a37ff27fceb610608a20160927c17ff4e81 100644 --- a/smp-angular/src/app/system-settings/property/property-details-dialog/property-details-dialog.component.ts +++ b/smp-angular/src/app/system-settings/property/property-details-dialog/property-details-dialog.component.ts @@ -4,9 +4,7 @@ import {UntypedFormBuilder, UntypedFormControl, UntypedFormGroup} from "@angular import {PropertyRo} from "../property-ro.model"; import {AlertMessageService} from "../../../common/alert-message/alert-message.service"; import {EntityStatus} from "../../../common/enums/entity-status.enum"; -import {ServiceGroupValidationRo} from "../../../service-group-edit/service-group-details-dialog/service-group-validation-edit-ro.model"; import {SmpConstants} from "../../../smp.constants"; -import {ServiceGroupValidationErrorCodeModel} from "../../../service-group-edit/service-group-details-dialog/service-group-validation-error-code.model"; import {PropertyValidationRo} from "../property-validate-ro.model"; import {HttpClient} from "@angular/common/http"; import {HttpErrorHandlerService} from "../../../common/error/http-error-handler.service";