From 0963a320810bf091938644b144e0d2692ca8c9f0 Mon Sep 17 00:00:00 2001 From: Mattia Vianelli Date: Tue, 24 Oct 2023 12:59:21 +0200 Subject: [PATCH] CST-12174 Updated delete services to mark for deletion --- .../admin-ldn-services-routing.module.ts | 48 +- .../admin-ldn-services.module.ts | 30 +- .../ldn-service-form-edit.component.html | 484 ++++++------- .../ldn-service-form-edit.component.scss | 18 +- .../ldn-service-form-edit.component.spec.ts | 28 +- .../ldn-service-form-edit.component.ts | 682 +++++++++--------- .../ldn-service-form.component.html | 453 ++++++------ .../ldn-service-form.component.scss | 20 +- .../ldn-service-form.component.spec.ts | 32 +- .../ldn-service-form.component.ts | 346 +++++---- .../ldn-service-new.component.spec.ts | 32 +- .../ldn-service-new.component.ts | 29 +- .../ldnServicesRD$-mock.ts | 6 +- .../ldn-itemfilters-data.service.ts | 13 +- .../ldn-services-data.service.ts | 141 ++-- .../ldn-services-directory.component.html | 37 +- .../ldn-services-directory.component.spec.ts | 32 +- .../ldn-services-directory.component.ts | 212 +++--- .../ldn-services-guard.service.ts | 40 +- .../ldn-services.guard.spec.ts | 18 +- .../ldn-service-itemfilters.ts | 3 +- .../ldn-service-patterns.model.ts | 12 +- .../ldn-service-status.model.ts | 6 +- .../ldn-service.constrain.model.ts | 2 +- .../ldn-services-model/ldn-services.model.ts | 1 - .../ldn-directory.service.spec.ts | 18 +- .../ldn-directory.service.ts | 24 +- .../ldn-service-bulk-delete.service.spec.ts | 18 +- 28 files changed, 1388 insertions(+), 1397 deletions(-) diff --git a/src/app/admin/admin-ldn-services/admin-ldn-services-routing.module.ts b/src/app/admin/admin-ldn-services/admin-ldn-services-routing.module.ts index 4f05bca9e3..2d3c68f7cb 100644 --- a/src/app/admin/admin-ldn-services/admin-ldn-services-routing.module.ts +++ b/src/app/admin/admin-ldn-services/admin-ldn-services-routing.module.ts @@ -7,30 +7,30 @@ import { LdnServiceNewComponent } from './ldn-service-new/ldn-service-new.compon import { LdnServiceFormEditComponent } from './ldn-service-form-edit/ldn-service-form-edit.component'; @NgModule({ - imports: [ - RouterModule.forChild([ - { - path: '', - pathMatch: 'full', - component: LdnServicesOverviewComponent, - resolve: { breadcrumb: I18nBreadcrumbResolver }, - data: { title: 'ldn-registered-services.title', breadcrumbKey: 'ldn-registered-services.new' }, - canActivate: [LdnServicesGuard] - }, - { - path: 'new', - resolve: { breadcrumb: I18nBreadcrumbResolver }, - component: LdnServiceNewComponent, - data: { title: 'ldn-register-new-service.title', breadcrumbKey: 'ldn-register-new-service' } - }, - { - path: 'edit/:serviceId', - resolve: { breadcrumb: I18nBreadcrumbResolver }, - component: LdnServiceFormEditComponent, - data: { title: 'ldn-edit-service.title', breadcrumbKey: 'ldn-edit-service' } - }, - ]), - ] + imports: [ + RouterModule.forChild([ + { + path: '', + pathMatch: 'full', + component: LdnServicesOverviewComponent, + resolve: {breadcrumb: I18nBreadcrumbResolver}, + data: {title: 'ldn-registered-services.title', breadcrumbKey: 'ldn-registered-services.new'}, + canActivate: [LdnServicesGuard] + }, + { + path: 'new', + resolve: {breadcrumb: I18nBreadcrumbResolver}, + component: LdnServiceNewComponent, + data: {title: 'ldn-register-new-service.title', breadcrumbKey: 'ldn-register-new-service'} + }, + { + path: 'edit/:serviceId', + resolve: {breadcrumb: I18nBreadcrumbResolver}, + component: LdnServiceFormEditComponent, + data: {title: 'ldn-edit-service.title', breadcrumbKey: 'ldn-edit-service'} + }, + ]), + ] }) export class AdminLdnServicesRoutingModule { diff --git a/src/app/admin/admin-ldn-services/admin-ldn-services.module.ts b/src/app/admin/admin-ldn-services/admin-ldn-services.module.ts index c82250fcec..9ca3775a9e 100644 --- a/src/app/admin/admin-ldn-services/admin-ldn-services.module.ts +++ b/src/app/admin/admin-ldn-services/admin-ldn-services.module.ts @@ -10,20 +10,20 @@ import { FormsModule } from '@angular/forms'; import { LdnItemfiltersService } from './ldn-services-data/ldn-itemfilters-data.service'; - @NgModule({ - imports: [ - CommonModule, - SharedModule, - AdminLdnServicesRoutingModule, - FormsModule - ], - declarations: [ - LdnServicesOverviewComponent, - LdnServiceNewComponent, - LdnServiceFormComponent, - LdnServiceFormEditComponent, - ], - providers: [LdnItemfiltersService] + imports: [ + CommonModule, + SharedModule, + AdminLdnServicesRoutingModule, + FormsModule + ], + declarations: [ + LdnServicesOverviewComponent, + LdnServiceNewComponent, + LdnServiceFormComponent, + LdnServiceFormEditComponent, + ], + providers: [LdnItemfiltersService] }) -export class AdminLdnServicesModule { } +export class AdminLdnServicesModule { +} diff --git a/src/app/admin/admin-ldn-services/ldn-service-form-edit/ldn-service-form-edit.component.html b/src/app/admin/admin-ldn-services/ldn-service-form-edit/ldn-service-form-edit.component.html index 3781a059ec..bcd597845d 100644 --- a/src/app/admin/admin-ldn-services/ldn-service-form-edit/ldn-service-form-edit.component.html +++ b/src/app/admin/admin-ldn-services/ldn-service-form-edit/ldn-service-form-edit.component.html @@ -1,275 +1,277 @@
-
-
-

{{ 'ldn-edit-registered-service.title' | translate }}

-
- -
- -
- -
-
-
-
-
- -
- - -
- -
-   -
- - -
- - -
- -
-   -
- - -
- - -
- -
-   -
- - -
- - -
- -
-   -
- -
-
- -
-
- -
-
- -
-
-
-
- -
- - - - - - -
-
- + +
+

{{ 'ldn-edit-registered-service.title' | translate }}

+
+ +
+ +
+ +
+
+
+
-
- - - +
+ +
-
- -
-
-
+
+  
- -
- - + +
+ +
-
- -
- - - {{ 'ldn-new-service.form.label.addPattern' | translate }} - -
-   -
- -
-
- -
-
- -
-
- -
-
-
-
- -
- - - - -
-
- +
+  
-
- - + + +
+ + +
+ +
+   +
+ + +
+ + +
+ +
+   +
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+ +
+ + + + +
+
+ +
+ +
+ + + +
+ +
+ +
+
+
+
+ + +
+ + +
+
+
-
- -
-
-
+ + {{ 'ldn-new-service.form.label.addPattern' | translate }} + +
+  
-
- +
+
+ +
+
+ +
+
+ +
+
+
-
- -
- {{ 'ldn-new-service.form.label.addPattern' | translate }} +
+ + + + +
+
+ +
+
+ + + +
+ +
+ +
+
+
+
+ +
+ +
+
+
+
+ + {{ 'ldn-new-service.form.label.addPattern' | translate }} -
-   -
- - +
+   +
+ +
-
+
- + - -
-
+
- + - -
diff --git a/src/app/admin/admin-ldn-services/ldn-service-form-edit/ldn-service-form-edit.component.scss b/src/app/admin/admin-ldn-services/ldn-service-form-edit/ldn-service-form-edit.component.scss index df8146330f..b686e6533b 100644 --- a/src/app/admin/admin-ldn-services/ldn-service-form-edit/ldn-service-form-edit.component.scss +++ b/src/app/admin/admin-ldn-services/ldn-service-form-edit/ldn-service-form-edit.component.scss @@ -27,12 +27,13 @@ textarea { resize: none; } -.add-pattern-link{ +.add-pattern-link { color: #0048ff; cursor: pointer; margin-left: 10px; } -.remove-pattern-link{ + +.remove-pattern-link { color: #e34949; cursor: pointer; margin-left: 10px; @@ -75,7 +76,6 @@ textarea { } - .toggle-switch .slider { width: 22px; height: 22px; @@ -101,16 +101,16 @@ textarea { margin-right: 3px } -.label-box{ - margin-left:11px; +.label-box { + margin-left: 11px; } -.label-box-2{ - margin-left:14px; +.label-box-2 { + margin-left: 14px; } -.label-box-3{ - margin-left:5px; +.label-box-3 { + margin-left: 5px; } form button.btn.btn-primary[type="submit"] { diff --git a/src/app/admin/admin-ldn-services/ldn-service-form-edit/ldn-service-form-edit.component.spec.ts b/src/app/admin/admin-ldn-services/ldn-service-form-edit/ldn-service-form-edit.component.spec.ts index 8320ec9042..332d43cae3 100644 --- a/src/app/admin/admin-ldn-services/ldn-service-form-edit/ldn-service-form-edit.component.spec.ts +++ b/src/app/admin/admin-ldn-services/ldn-service-form-edit/ldn-service-form-edit.component.spec.ts @@ -3,21 +3,21 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { LdnServiceFormEditComponent } from './ldn-service-form-edit.component'; describe('LdnServiceFormEditComponent', () => { - let component: LdnServiceFormEditComponent; - let fixture: ComponentFixture; + let component: LdnServiceFormEditComponent; + let fixture: ComponentFixture; - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [ LdnServiceFormEditComponent ] - }) - .compileComponents(); + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [LdnServiceFormEditComponent] + }) + .compileComponents(); - fixture = TestBed.createComponent(LdnServiceFormEditComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + fixture = TestBed.createComponent(LdnServiceFormEditComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it('should create', () => { + expect(component).toBeTruthy(); + }); }); diff --git a/src/app/admin/admin-ldn-services/ldn-service-form-edit/ldn-service-form-edit.component.ts b/src/app/admin/admin-ldn-services/ldn-service-form-edit/ldn-service-form-edit.component.ts index 39cfb6ac6c..93622f9df0 100644 --- a/src/app/admin/admin-ldn-services/ldn-service-form-edit/ldn-service-form-edit.component.ts +++ b/src/app/admin/admin-ldn-services/ldn-service-form-edit/ldn-service-form-edit.component.ts @@ -21,371 +21,365 @@ import { FindListOptions } from '../../../core/data/find-list-options.model'; import { PaginationComponentOptions } from '../../../shared/pagination/pagination-component-options.model'; @Component({ - selector: 'ds-ldn-service-form-edit', - templateUrl: './ldn-service-form-edit.component.html', - styleUrls: ['./ldn-service-form-edit.component.scss'], - animations: [ - trigger('toggleAnimation', [ - state('true', style({})), - state('false', style({})), - transition('true <=> false', animate('300ms ease-in')), - ]), - ], + selector: 'ds-ldn-service-form-edit', + templateUrl: './ldn-service-form-edit.component.html', + styleUrls: ['./ldn-service-form-edit.component.scss'], + animations: [ + trigger('toggleAnimation', [ + state('true', style({})), + state('false', style({})), + transition('true <=> false', animate('300ms ease-in')), + ]), + ], }) export class LdnServiceFormEditComponent implements OnInit { - formModel: FormGroup; - @ViewChild('confirmModal', {static: true}) confirmModal: TemplateRef; - @ViewChild('resetFormModal', {static: true}) resetFormModal: TemplateRef; + formModel: FormGroup; + @ViewChild('confirmModal', {static: true}) confirmModal: TemplateRef; + @ViewChild('resetFormModal', {static: true}) resetFormModal: TemplateRef; - public inboundPatterns: object[] = notifyPatterns; - public outboundPatterns: object[] = notifyPatterns; - itemfiltersRD$: Observable>>; - config: FindListOptions = Object.assign(new FindListOptions(), { - elementsPerPage: 20 - }); - pageConfig: PaginationComponentOptions = Object.assign(new PaginationComponentOptions(), { - id: 'po', - pageSize: 20 - }); - @Input() public name: string; - @Input() public description: string; - @Input() public url: string; - @Input() public ldnUrl: string; - @Input() public inboundPattern: string; - @Input() public outboundPattern: string; - @Input() public constraint: string; - @Input() public automatic: boolean; - @Input() public headerKey: string; - private originalInboundPatterns: any[] = []; - private originalOutboundPatterns: any[] = []; - private deletedInboundPatterns: number[] = []; - private deletedOutboundPatterns: number[] = []; - private modalRef: any; - private service: LdnService; - protected serviceId: string; - markedForDeletion: number[] = []; - - - constructor( - protected ldnServicesService: LdnServicesService, - private ldnItemfiltersService: LdnItemfiltersService, - private formBuilder: FormBuilder, - private router: Router, - private route: ActivatedRoute, - private cdRef: ChangeDetectorRef, - protected modalService: NgbModal, - private notificationService: NotificationsService, - private translateService: TranslateService, - protected paginationService: PaginationService - ) { - - this.formModel = this.formBuilder.group({ - id: [''], - name: ['', Validators.required], - description: ['', Validators.required], - url: ['', Validators.required], - ldnUrl: ['', Validators.required], - inboundPattern: [''], - outboundPattern: [''], - constraintPattern: [''], - enabled: [''], - notifyServiceInboundPatterns: this.formBuilder.array([this.createInboundPatternFormGroup()]), - notifyServiceOutboundPatterns: this.formBuilder.array([this.createOutboundPatternFormGroup()]), - type: LDN_SERVICE.value, + public inboundPatterns: object[] = notifyPatterns; + public outboundPatterns: object[] = notifyPatterns; + itemfiltersRD$: Observable>>; + config: FindListOptions = Object.assign(new FindListOptions(), { + elementsPerPage: 20 }); - } - - ngOnInit(): void { - this.route.params.subscribe((params) => { - this.serviceId = params.serviceId; - if (this.serviceId) { - this.fetchServiceData(this.serviceId); - } + pageConfig: PaginationComponentOptions = Object.assign(new PaginationComponentOptions(), { + id: 'po', + pageSize: 20 }); - this.setItemfilters(); - } + @Input() public name: string; + @Input() public description: string; + @Input() public url: string; + @Input() public ldnUrl: string; + @Input() public inboundPattern: string; + @Input() public outboundPattern: string; + @Input() public constraint: string; + @Input() public automatic: boolean; + @Input() public headerKey: string; + markedForDeletion: number[] = []; + protected serviceId: string; + private originalInboundPatterns: any[] = []; + private originalOutboundPatterns: any[] = []; + private deletedInboundPatterns: number[] = []; + private deletedOutboundPatterns: number[] = []; + private modalRef: any; + private service: LdnService; - setItemfilters() { - this.itemfiltersRD$ = this.ldnItemfiltersService.findAll().pipe( - getFirstCompletedRemoteData()); - } + constructor( + protected ldnServicesService: LdnServicesService, + private ldnItemfiltersService: LdnItemfiltersService, + private formBuilder: FormBuilder, + private router: Router, + private route: ActivatedRoute, + private cdRef: ChangeDetectorRef, + protected modalService: NgbModal, + private notificationService: NotificationsService, + private translateService: TranslateService, + protected paginationService: PaginationService + ) { + + this.formModel = this.formBuilder.group({ + id: [''], + name: ['', Validators.required], + description: ['', Validators.required], + url: ['', Validators.required], + ldnUrl: ['', Validators.required], + inboundPattern: [''], + outboundPattern: [''], + constraintPattern: [''], + enabled: [''], + notifyServiceInboundPatterns: this.formBuilder.array([this.createInboundPatternFormGroup()]), + notifyServiceOutboundPatterns: this.formBuilder.array([this.createOutboundPatternFormGroup()]), + type: LDN_SERVICE.value, + }); + } + + ngOnInit(): void { + this.route.params.subscribe((params) => { + this.serviceId = params.serviceId; + if (this.serviceId) { + this.fetchServiceData(this.serviceId); + } + }); + this.setItemfilters(); + } + + setItemfilters() { + this.itemfiltersRD$ = this.ldnItemfiltersService.findAll().pipe( + getFirstCompletedRemoteData()); + } + fetchServiceData(serviceId: string): void { + this.ldnServicesService.findById(serviceId).pipe( + getFirstCompletedRemoteData() + ).subscribe( + (data: RemoteData) => { + if (data.hasSucceeded) { + this.service = data.payload; + this.formModel.patchValue({ + id: this.service.id, + name: this.service.name, + description: this.service.description, + url: this.service.url, + ldnUrl: this.service.ldnUrl, + type: this.service.type, + enabled: this.service.enabled + }); - fetchServiceData(serviceId: string): void { - this.ldnServicesService.findById(serviceId).pipe( - getFirstCompletedRemoteData() - ).subscribe( - (data: RemoteData) => { - if (data.hasSucceeded) { - this.service = data.payload; + const inboundPatternsArray = this.formModel.get('notifyServiceInboundPatterns') as FormArray; + inboundPatternsArray.clear(); - this.formModel.patchValue({ - id: this.service.id, - name: this.service.name, - description: this.service.description, - url: this.service.url, - ldnUrl: this.service.ldnUrl, - type: this.service.type, - enabled: this.service.enabled - }); + this.service.notifyServiceInboundPatterns.forEach((pattern: any) => { + const patternFormGroup = this.initializeInboundPatternFormGroup(); + patternFormGroup.patchValue(pattern); + inboundPatternsArray.push(patternFormGroup); + this.cdRef.detectChanges(); + }); - const inboundPatternsArray = this.formModel.get('notifyServiceInboundPatterns') as FormArray; - inboundPatternsArray.clear(); + const outboundPatternsArray = this.formModel.get('notifyServiceOutboundPatterns') as FormArray; + outboundPatternsArray.clear(); - this.service.notifyServiceInboundPatterns.forEach((pattern: any) => { - const patternFormGroup = this.initializeInboundPatternFormGroup(); - patternFormGroup.patchValue(pattern); - inboundPatternsArray.push(patternFormGroup); - this.cdRef.detectChanges(); - }); + this.service.notifyServiceOutboundPatterns.forEach((pattern: any) => { + const patternFormGroup = this.initializeOutboundPatternFormGroup(); + patternFormGroup.patchValue(pattern); + outboundPatternsArray.push(patternFormGroup); - const outboundPatternsArray = this.formModel.get('notifyServiceOutboundPatterns') as FormArray; - outboundPatternsArray.clear(); + this.cdRef.detectChanges(); + }); + this.originalInboundPatterns = [...this.service.notifyServiceInboundPatterns]; + this.originalOutboundPatterns = [...this.service.notifyServiceOutboundPatterns]; + } + }, + ); + } - this.service.notifyServiceOutboundPatterns.forEach((pattern: any) => { - const patternFormGroup = this.initializeOutboundPatternFormGroup(); - patternFormGroup.patchValue(pattern); - outboundPatternsArray.push(patternFormGroup); + generatePatchOperations(): any[] { + const patchOperations: any[] = []; - this.cdRef.detectChanges(); - }); - this.originalInboundPatterns = [...this.service.notifyServiceInboundPatterns]; - this.originalOutboundPatterns = [...this.service.notifyServiceOutboundPatterns]; + this.createReplaceOperation(patchOperations, 'name', '/name'); + this.createReplaceOperation(patchOperations, 'description', '/description'); + this.createReplaceOperation(patchOperations, 'ldnUrl', '/ldnurl'); + this.createReplaceOperation(patchOperations, 'url', '/url'); + + this.handlePatterns(patchOperations, 'notifyServiceInboundPatterns'); + this.handlePatterns(patchOperations, 'notifyServiceOutboundPatterns'); + + this.deletedInboundPatterns.forEach(index => { + const removeOperation: Operation = { + op: 'remove', + path: `notifyServiceInboundPatterns[${index}]` + }; + patchOperations.push(removeOperation); + }); + + this.deletedOutboundPatterns.forEach(index => { + const removeOperation: Operation = { + op: 'remove', + path: `notifyServiceOutboundPatterns[${index}]` + }; + patchOperations.push(removeOperation); + }); + + return patchOperations; + } + + onSubmit() { + this.openConfirmModal(this.confirmModal); + } + + addInboundPattern() { + const notifyServiceInboundPatternsArray = this.formModel.get('notifyServiceInboundPatterns') as FormArray; + notifyServiceInboundPatternsArray.push(this.createInboundPatternFormGroup()); + } + + addOutboundPattern() { + const notifyServiceOutboundPatternsArray = this.formModel.get('notifyServiceOutboundPatterns') as FormArray; + notifyServiceOutboundPatternsArray.push(this.createOutboundPatternFormGroup()); + } + + removeOutboundPattern(index: number): void { + const patternsArray = this.formModel.get('notifyServiceOutboundPatterns') as FormArray; + const patternGroup = patternsArray.at(index) as FormGroup; + const patternValue = patternGroup.value; + + if (index < 0 || index >= patternsArray.length || patternValue.isNew) { + patternsArray.removeAt(index); + return; } - }, - ); - } - - generatePatchOperations(): any[] { - const patchOperations: any[] = []; - - this.createReplaceOperation(patchOperations, 'name', '/name'); - this.createReplaceOperation(patchOperations, 'description', '/description'); - this.createReplaceOperation(patchOperations, 'ldnUrl', '/ldnurl'); - this.createReplaceOperation(patchOperations, 'url', '/url'); - - this.handlePatterns(patchOperations, 'notifyServiceInboundPatterns'); - this.handlePatterns(patchOperations, 'notifyServiceOutboundPatterns'); - - this.deletedInboundPatterns.forEach(index => { - const removeOperation: Operation = { - op: 'remove', - path: `notifyServiceInboundPatterns[${index}]` - }; - patchOperations.push(removeOperation); - }); - - this.deletedOutboundPatterns.forEach(index => { - const removeOperation: Operation = { - op: 'remove', - path: `notifyServiceOutboundPatterns[${index}]` - }; - patchOperations.push(removeOperation); - }); - - return patchOperations; - } - - onSubmit() { - this.openConfirmModal(this.confirmModal); - } - - addInboundPattern() { - const notifyServiceInboundPatternsArray = this.formModel.get('notifyServiceInboundPatterns') as FormArray; - notifyServiceInboundPatternsArray.push(this.createInboundPatternFormGroup()); - } - - addOutboundPattern() { - const notifyServiceOutboundPatternsArray = this.formModel.get('notifyServiceOutboundPatterns') as FormArray; - notifyServiceOutboundPatternsArray.push(this.createOutboundPatternFormGroup()); - } - - removeOutboundPattern(index: number): void { - const patternsArray = this.formModel.get('notifyServiceOutboundPatterns') as FormArray; - const patternGroup = patternsArray.at(index) as FormGroup; - const patternValue = patternGroup.value; - - if (index < 0 || index >= patternsArray.length || patternValue.isNew) { - patternsArray.removeAt(index); - return; - } - this.deletedOutboundPatterns.push(index); + this.deletedOutboundPatterns.push(index); - patternsArray.removeAt(index); - this.cdRef.detectChanges(); - } - - - toggleAutomatic(i: number) { - const automaticControl = this.formModel.get(`notifyServiceInboundPatterns.${i}.automatic`); - if (automaticControl) { - automaticControl.setValue(!automaticControl.value); - } - } - - toggleEnabled() { - const newStatus = !this.formModel.get('enabled').value; - - const patchOperation: Operation = { - op: 'replace', - path: '/enabled', - value: newStatus, - }; - - this.ldnServicesService.patch(this.service, [patchOperation]).pipe( - getFirstCompletedRemoteData() - ).subscribe( - () => { - - this.formModel.get('enabled').setValue(newStatus); - this.cdRef.detectChanges(); - } - ); - } - - - closeModal() { - this.modalRef.close(); - this.cdRef.detectChanges(); - } - - openConfirmModal(content) { - this.modalRef = this.modalService.open(content); - } - - openResetFormModal(content) { - this.modalRef = this.modalService.open(content); - } - - patchService() { - this.deleteMarkedPatterns(); - const patchOperations = this.generatePatchOperations(); - - - this.ldnServicesService.patch(this.service, patchOperations).pipe( - getFirstCompletedRemoteData() - ).subscribe( - () => { - - this.closeModal(); - this.sendBack(); - this.notificationService.success(this.translateService.get('admin.registries.services-formats.modify.success.head'), - this.translateService.get('admin.registries.services-formats.modify.success.content')); - }, - (error) => { - this.notificationService.error(this.translateService.get('admin.registries.services-formats.modify.failure.head'), - this.translateService.get('admin.registries.services-formats.modify.failure.content')); - } - ); - - } - - private createReplaceOperation(patchOperations: any[], formControlName: string, path: string): void { - if (this.formModel.get(formControlName).dirty) { - patchOperations.push({ - op: 'replace', - path, - value: this.formModel.get(formControlName).value, - }); - } - } - - private handlePatterns(patchOperations: any[], formArrayName: string): void { - const patternsArray = this.formModel.get(formArrayName) as FormArray; - - for (let i = 0; i < patternsArray.length; i++) { - const patternGroup = patternsArray.at(i) as FormGroup; - const patternValue = patternGroup.value; - - if (patternGroup.dirty) { - if (patternValue.isNew) { - delete patternValue.isNew; - const addOperation = { - op: 'add', - path: `${formArrayName}/-`, - value: patternValue, - }; - patchOperations.push(addOperation); - } else { - const replaceOperation = { - op: 'replace', - path: `${formArrayName}[${i}]`, - value: patternValue, - }; - patchOperations.push(replaceOperation); - } - } - } - } - - private sendBack() { - this.router.navigateByUrl('admin/ldn/services'); - } - - resetFormAndLeave() { - this.sendBack(); - this.closeModal(); - } - - private createOutboundPatternFormGroup(): FormGroup { - return this.formBuilder.group({ - pattern: '', - constraint: '', - isNew: true, - }); - } - - private createInboundPatternFormGroup(): FormGroup { - return this.formBuilder.group({ - pattern: '', - constraint: '', - automatic: false, - isNew: true - }); - } - - private initializeOutboundPatternFormGroup(): FormGroup { - return this.formBuilder.group({ - pattern: '', - constraint: '', - }); - } - - private initializeInboundPatternFormGroup(): FormGroup { - return this.formBuilder.group({ - pattern: '', - constraint: '', - automatic: '', - }); - } - markForDeletion(index: number) { - if (!this.markedForDeletion.includes(index)) { - this.markedForDeletion.push(index); - } - } - - unmarkForDeletion(index: number) { - const i = this.markedForDeletion.indexOf(index); - if (i !== -1) { - this.markedForDeletion.splice(i, 1); - } - } - - deleteMarkedPatterns() { - this.markedForDeletion.sort((a, b) => b - a); - const patternsArray = this.formModel.get('notifyServiceInboundPatterns') as FormArray; - - for (const index of this.markedForDeletion) { - if (index >= 0 && index < patternsArray.length) { - this.deletedInboundPatterns.push(index); patternsArray.removeAt(index); - } + this.cdRef.detectChanges(); } - this.markedForDeletion = []; - } + + toggleAutomatic(i: number) { + const automaticControl = this.formModel.get(`notifyServiceInboundPatterns.${i}.automatic`); + if (automaticControl) { + automaticControl.setValue(!automaticControl.value); + } + } + + toggleEnabled() { + const newStatus = !this.formModel.get('enabled').value; + + const patchOperation: Operation = { + op: 'replace', + path: '/enabled', + value: newStatus, + }; + + this.ldnServicesService.patch(this.service, [patchOperation]).pipe( + getFirstCompletedRemoteData() + ).subscribe( + () => { + + this.formModel.get('enabled').setValue(newStatus); + this.cdRef.detectChanges(); + } + ); + } + + + closeModal() { + this.modalRef.close(); + this.cdRef.detectChanges(); + } + + openConfirmModal(content) { + this.modalRef = this.modalService.open(content); + } + + openResetFormModal(content) { + this.modalRef = this.modalService.open(content); + } + + patchService() { + this.deleteMarkedPatterns(); + const patchOperations = this.generatePatchOperations(); + + + this.ldnServicesService.patch(this.service, patchOperations).pipe( + getFirstCompletedRemoteData() + ).subscribe( + () => { + + this.closeModal(); + this.sendBack(); + this.notificationService.success(this.translateService.get('admin.registries.services-formats.modify.success.head'), + this.translateService.get('admin.registries.services-formats.modify.success.content')); + } + ); + + } + + resetFormAndLeave() { + this.sendBack(); + this.closeModal(); + } + + markForDeletion(index: number) { + if (!this.markedForDeletion.includes(index)) { + this.markedForDeletion.push(index); + } + } + + unmarkForDeletion(index: number) { + const i = this.markedForDeletion.indexOf(index); + if (i !== -1) { + this.markedForDeletion.splice(i, 1); + } + } + + deleteMarkedPatterns() { + this.markedForDeletion.sort((a, b) => b - a); + const patternsArray = this.formModel.get('notifyServiceInboundPatterns') as FormArray; + + for (const index of this.markedForDeletion) { + if (index >= 0 && index < patternsArray.length) { + this.deletedInboundPatterns.push(index); + patternsArray.removeAt(index); + } + } + + this.markedForDeletion = []; + } + + private createReplaceOperation(patchOperations: any[], formControlName: string, path: string): void { + if (this.formModel.get(formControlName).dirty) { + patchOperations.push({ + op: 'replace', + path, + value: this.formModel.get(formControlName).value, + }); + } + } + + private handlePatterns(patchOperations: any[], formArrayName: string): void { + const patternsArray = this.formModel.get(formArrayName) as FormArray; + + for (let i = 0; i < patternsArray.length; i++) { + const patternGroup = patternsArray.at(i) as FormGroup; + const patternValue = patternGroup.value; + + if (patternGroup.dirty) { + if (patternValue.isNew) { + delete patternValue.isNew; + const addOperation = { + op: 'add', + path: `${formArrayName}/-`, + value: patternValue, + }; + patchOperations.push(addOperation); + } else { + const replaceOperation = { + op: 'replace', + path: `${formArrayName}[${i}]`, + value: patternValue, + }; + patchOperations.push(replaceOperation); + } + } + } + } + + private sendBack() { + this.router.navigateByUrl('admin/ldn/services'); + } + + private createOutboundPatternFormGroup(): FormGroup { + return this.formBuilder.group({ + pattern: '', + constraint: '', + isNew: true, + }); + } + + private createInboundPatternFormGroup(): FormGroup { + return this.formBuilder.group({ + pattern: '', + constraint: '', + automatic: false, + isNew: true + }); + } + + private initializeOutboundPatternFormGroup(): FormGroup { + return this.formBuilder.group({ + pattern: '', + constraint: '', + }); + } + + private initializeInboundPatternFormGroup(): FormGroup { + return this.formBuilder.group({ + pattern: '', + constraint: '', + automatic: '', + }); + } } diff --git a/src/app/admin/admin-ldn-services/ldn-service-form/ldn-service-form.component.html b/src/app/admin/admin-ldn-services/ldn-service-form/ldn-service-form.component.html index b82b05af77..f1afa886f1 100644 --- a/src/app/admin/admin-ldn-services/ldn-service-form/ldn-service-form.component.html +++ b/src/app/admin/admin-ldn-services/ldn-service-form/ldn-service-form.component.html @@ -1,263 +1,266 @@
-
-
-

{{ 'ldn-create-service.title' | translate }}

-
- -
- - -
- -
-   -
- - -
- - -
- -
-   -
- - -
- - -
- -
-   -
- - -
- - -
- -
-   -
- - -
-
- -
-
- -
-
- -
-
-
-
- -
- - - - -
-
- + +
+

{{ 'ldn-create-service.title' | translate }}

+
+ +
+ +
- -
- - - +
+  
-
- -
-
-
+ +
+ +
-
- +
+  
-
- -
- {{ 'ldn-new-service.form.label.addPattern' | translate }} - - -
-   -
- - -
-
- -
-
- -
-
-
-
-
-
- -
- - - - -
-
- + +
+ +
-
- - + +
+   +
+ + +
+ + +
+ +
+   +
+ + +
+
+ +
+
+ +
+
+ +
+
+
+
+ +
+ + + + +
+
+ +
+ + +
+ + + +
+ +
+ +
+
+
+
+ +
+ +
+
-
- -
-
-
+ {{ 'ldn-new-service.form.label.addPattern' | translate }} + + +
+  
-
- + +
+
+ +
+
+ +
+
+
+
+
-
- -
+
- {{ 'ldn-new-service.form.label.addPattern' | translate }} + + + +
+
+ +
+
+ + + +
+ +
+ +
+
+
+
+ +
+ +
+
+
+ +
+ + {{ 'ldn-new-service.form.label.addPattern' | translate }} -
-   -
+
+   +
- + - +
-
+
- + - -
-
+
- + - -
diff --git a/src/app/admin/admin-ldn-services/ldn-service-form/ldn-service-form.component.scss b/src/app/admin/admin-ldn-services/ldn-service-form/ldn-service-form.component.scss index 523653381b..f0fdcd81a2 100644 --- a/src/app/admin/admin-ldn-services/ldn-service-form/ldn-service-form.component.scss +++ b/src/app/admin/admin-ldn-services/ldn-service-form/ldn-service-form.component.scss @@ -27,12 +27,13 @@ textarea { resize: none; } -.add-pattern-link{ +.add-pattern-link { color: #0048ff; cursor: pointer; margin-left: 10px; } -.remove-pattern-link{ + +.remove-pattern-link { color: #e34949; cursor: pointer; margin-left: 10px; @@ -75,7 +76,6 @@ textarea { } - .toggle-switch .slider { width: 22px; height: 22px; @@ -99,21 +99,21 @@ textarea { cursor: pointer; } -.label-box{ - margin-left:11px; +.label-box { + margin-left: 11px; } -.label-box-2{ - margin-left:14px; +.label-box-2 { + margin-left: 14px; } -.label-box-3{ - margin-left:5px; +.label-box-3 { + margin-left: 5px; } form button.btn.btn-primary[type="submit"] { position: absolute; - bottom: 0px; + bottom: 0; right: -10px; } diff --git a/src/app/admin/admin-ldn-services/ldn-service-form/ldn-service-form.component.spec.ts b/src/app/admin/admin-ldn-services/ldn-service-form/ldn-service-form.component.spec.ts index 3ae834d642..757b617091 100644 --- a/src/app/admin/admin-ldn-services/ldn-service-form/ldn-service-form.component.spec.ts +++ b/src/app/admin/admin-ldn-services/ldn-service-form/ldn-service-form.component.spec.ts @@ -3,23 +3,23 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { LdnServiceFormComponent } from './ldn-service-form.component'; describe('LdnServiceFormComponent', () => { - let component: LdnServiceFormComponent; - let fixture: ComponentFixture; + let component: LdnServiceFormComponent; + let fixture: ComponentFixture; - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [ LdnServiceFormComponent ] - }) - .compileComponents(); - }); + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [LdnServiceFormComponent] + }) + .compileComponents(); + }); - beforeEach(() => { - fixture = TestBed.createComponent(LdnServiceFormComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + beforeEach(() => { + fixture = TestBed.createComponent(LdnServiceFormComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it('should create', () => { + expect(component).toBeTruthy(); + }); }); diff --git a/src/app/admin/admin-ldn-services/ldn-service-form/ldn-service-form.component.ts b/src/app/admin/admin-ldn-services/ldn-service-form/ldn-service-form.component.ts index 7e9a1e148f..ff42ffb4dc 100644 --- a/src/app/admin/admin-ldn-services/ldn-service-form/ldn-service-form.component.ts +++ b/src/app/admin/admin-ldn-services/ldn-service-form/ldn-service-form.component.ts @@ -30,203 +30,193 @@ import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; @Component({ - selector: 'ds-ldn-service-form', - templateUrl: './ldn-service-form.component.html', - styleUrls: ['./ldn-service-form.component.scss'], - animations: [ - trigger('toggleAnimation', [ - state('true', style({})), - state('false', style({})), - transition('true <=> false', animate('300ms ease-in')), - ]), - ], + selector: 'ds-ldn-service-form', + templateUrl: './ldn-service-form.component.html', + styleUrls: ['./ldn-service-form.component.scss'], + animations: [ + trigger('toggleAnimation', [ + state('true', style({})), + state('false', style({})), + transition('true <=> false', animate('300ms ease-in')), + ]), + ], }) export class LdnServiceFormComponent implements OnInit { - formModel: FormGroup; - private modalRef: any; - @ViewChild('confirmModal', {static: true}) confirmModal: TemplateRef; - @ViewChild('resetFormModal', {static: true}) resetFormModal: TemplateRef; - - - public inboundPatterns: object[] = notifyPatterns; - public outboundPatterns: object[] = notifyPatterns; - itemfiltersRD$: Observable>>; - config: FindListOptions = Object.assign(new FindListOptions(), { - elementsPerPage: 20 - }); - pageConfig: PaginationComponentOptions = Object.assign(new PaginationComponentOptions(), { - id: 'po', - pageSize: 20 - }); - - - - @Input() public name: string; - @Input() public description: string; - @Input() public url: string; - @Input() public ldnUrl: string; - @Input() public inboundPattern: string; - @Input() public outboundPattern: string; - @Input() public constraint: string; - @Input() public automatic: boolean; - - @Input() public headerKey: string; - @Output() submitForm: EventEmitter = new EventEmitter(); - @Output() cancelForm: EventEmitter = new EventEmitter(); - - constructor( - private ldnServicesService: LdnServicesService, - private ldnItemfiltersService: LdnItemfiltersService, - private formBuilder: FormBuilder, - private router: Router, - private notificationsService: NotificationsService, - private translateService: TranslateService, - private cdRef: ChangeDetectorRef, - protected modalService: NgbModal, - - ) { - - this.formModel = this.formBuilder.group({ - enabled: true, - id: [''], - name: ['', Validators.required], - description: [''], - url: ['', Validators.required], - ldnUrl: ['', Validators.required], - inboundPattern: [''], - outboundPattern: [''], - constraintPattern: [''], - notifyServiceInboundPatterns: this.formBuilder.array([this.createInboundPatternFormGroup()]), - notifyServiceOutboundPatterns: this.formBuilder.array([this.createOutboundPatternFormGroup()]), - type: LDN_SERVICE.value, + formModel: FormGroup; + @ViewChild('confirmModal', {static: true}) confirmModal: TemplateRef; + @ViewChild('resetFormModal', {static: true}) resetFormModal: TemplateRef; + public inboundPatterns: object[] = notifyPatterns; + public outboundPatterns: object[] = notifyPatterns; + itemfiltersRD$: Observable>>; + config: FindListOptions = Object.assign(new FindListOptions(), { + elementsPerPage: 20 }); - } - - ngOnInit(): void { - this.setItemfilters(); - - } - setItemfilters() { - this.itemfiltersRD$ = this.ldnItemfiltersService.findAll().pipe( - getFirstCompletedRemoteData()); - this.itemfiltersRD$.subscribe((rd: RemoteData>) => { - if (rd.hasSucceeded) { - } + pageConfig: PaginationComponentOptions = Object.assign(new PaginationComponentOptions(), { + id: 'po', + pageSize: 20 }); - } + @Input() public name: string; + @Input() public description: string; + @Input() public url: string; + @Input() public ldnUrl: string; + @Input() public inboundPattern: string; + @Input() public outboundPattern: string; + @Input() public constraint: string; + @Input() public automatic: boolean; + @Input() public headerKey: string; + @Output() submitForm: EventEmitter = new EventEmitter(); + @Output() cancelForm: EventEmitter = new EventEmitter(); + private modalRef: any; - onSubmit() { - this.openConfirmModal(this.confirmModal); - } + constructor( + private ldnServicesService: LdnServicesService, + private ldnItemfiltersService: LdnItemfiltersService, + private formBuilder: FormBuilder, + private router: Router, + private notificationsService: NotificationsService, + private translateService: TranslateService, + private cdRef: ChangeDetectorRef, + protected modalService: NgbModal, + ) { - openConfirmModal(content) { - this.modalRef = this.modalService.open(content); - } - - openResetFormModal(content) { - this.modalRef = this.modalService.open(content); - } - createService() { - this.formModel.get('name').markAsTouched(); - this.formModel.get('url').markAsTouched(); - this.formModel.get('ldnUrl').markAsTouched(); - - const name = this.formModel.get('name').value; - const url = this.formModel.get('url').value; - const ldnUrl = this.formModel.get('ldnUrl').value; - - if (!name || !url || !ldnUrl) { - this.closeModal(); - return; + this.formModel = this.formBuilder.group({ + enabled: true, + id: [''], + name: ['', Validators.required], + description: [''], + url: ['', Validators.required], + ldnUrl: ['', Validators.required], + inboundPattern: [''], + outboundPattern: [''], + constraintPattern: [''], + notifyServiceInboundPatterns: this.formBuilder.array([this.createInboundPatternFormGroup()]), + notifyServiceOutboundPatterns: this.formBuilder.array([this.createOutboundPatternFormGroup()]), + type: LDN_SERVICE.value, + }); } - const values = this.formModel.value; + ngOnInit(): void { + this.setItemfilters(); - const inboundPatternValue = this.formModel.get('inboundPattern').value; - const outboundPatternValue = this.formModel.get('outboundPattern').value; - - if (inboundPatternValue === '') { - values.notifyServiceInboundPatterns = []; - } - if (outboundPatternValue === '') { - values.notifyServiceOutboundPatterns = []; } - const ldnServiceData = this.ldnServicesService.create(values); + setItemfilters() { + this.itemfiltersRD$ = this.ldnItemfiltersService.findAll().pipe( + getFirstCompletedRemoteData()); + } - ldnServiceData.pipe( - getFirstCompletedRemoteData() - ).subscribe((rd: RemoteData) => { - if (rd.hasSucceeded) { - this.notificationsService.success(this.translateService.get('ldn-service-notification.created.success.title')); - (this.translateService.get('ldn-service-notification.created.success.title'), - this.translateService.get('ldn-service-notification.created.success.body')); + onSubmit() { + this.openConfirmModal(this.confirmModal); + } + + openConfirmModal(content) { + this.modalRef = this.modalService.open(content); + } + + openResetFormModal(content) { + this.modalRef = this.modalService.open(content); + } + + createService() { + this.formModel.get('name').markAsTouched(); + this.formModel.get('url').markAsTouched(); + this.formModel.get('ldnUrl').markAsTouched(); + + const name = this.formModel.get('name').value; + const url = this.formModel.get('url').value; + const ldnUrl = this.formModel.get('ldnUrl').value; + + if (!name || !url || !ldnUrl) { + this.closeModal(); + return; + } + + const values = this.formModel.value; + + const inboundPatternValue = this.formModel.get('inboundPattern').value; + const outboundPatternValue = this.formModel.get('outboundPattern').value; + + if (inboundPatternValue === '') { + values.notifyServiceInboundPatterns = []; + } + if (outboundPatternValue === '') { + values.notifyServiceOutboundPatterns = []; + } + + const ldnServiceData = this.ldnServicesService.create(values); + + ldnServiceData.pipe( + getFirstCompletedRemoteData() + ).subscribe((rd: RemoteData) => { + if (rd.hasSucceeded) { + this.notificationsService.success(this.translateService.get('ldn-service-notification.created.success.title')); + (this.translateService.get('ldn-service-notification.created.success.title'), + this.translateService.get('ldn-service-notification.created.success.body')); + this.sendBack(); + this.closeModal(); + } else { + this.notificationsService.error(this.translateService.get('notification.created.failure')); + } + }); + } + + + resetFormAndLeave() { this.sendBack(); this.closeModal(); - } else { - this.notificationsService.error(this.translateService.get('notification.created.failure')); - } - }); - } - - - resetFormAndLeave() { - this.sendBack(); - this.closeModal(); - } - - closeModal() { - this.modalRef.close(); - this.cdRef.detectChanges(); - } - - addInboundPattern() { - const notifyServiceInboundPatternsArray = this.formModel.get('notifyServiceInboundPatterns') as FormArray; - notifyServiceInboundPatternsArray.push(this.createInboundPatternFormGroup()); - } - - removeInboundPattern(index: number) { - const notifyServiceInboundPatternsArray = this.formModel.get('notifyServiceInboundPatterns') as FormArray; - notifyServiceInboundPatternsArray.removeAt(index); - } - - addOutboundPattern() { - const notifyServiceOutboundPatternsArray = this.formModel.get('notifyServiceOutboundPatterns') as FormArray; - notifyServiceOutboundPatternsArray.push(this.createOutboundPatternFormGroup()); - } - - removeOutboundPattern(index: number) { - const notifyServiceOutboundPatternsArray = this.formModel.get('notifyServiceOutboundPatterns') as FormArray; - notifyServiceOutboundPatternsArray.removeAt(index); - } - - toggleAutomatic(i: number) { - const automaticControl = this.formModel.get(`notifyServiceInboundPatterns.${i}.automatic`); - if (automaticControl) { - automaticControl.setValue(!automaticControl.value); } - } - private sendBack() { - this.router.navigateByUrl('admin/ldn/services'); - } + closeModal() { + this.modalRef.close(); + this.cdRef.detectChanges(); + } + + addInboundPattern() { + const notifyServiceInboundPatternsArray = this.formModel.get('notifyServiceInboundPatterns') as FormArray; + notifyServiceInboundPatternsArray.push(this.createInboundPatternFormGroup()); + } + + removeInboundPattern(index: number) { + const notifyServiceInboundPatternsArray = this.formModel.get('notifyServiceInboundPatterns') as FormArray; + notifyServiceInboundPatternsArray.removeAt(index); + } + + addOutboundPattern() { + const notifyServiceOutboundPatternsArray = this.formModel.get('notifyServiceOutboundPatterns') as FormArray; + notifyServiceOutboundPatternsArray.push(this.createOutboundPatternFormGroup()); + } + + removeOutboundPattern(index: number) { + const notifyServiceOutboundPatternsArray = this.formModel.get('notifyServiceOutboundPatterns') as FormArray; + notifyServiceOutboundPatternsArray.removeAt(index); + } + + toggleAutomatic(i: number) { + const automaticControl = this.formModel.get(`notifyServiceInboundPatterns.${i}.automatic`); + if (automaticControl) { + automaticControl.setValue(!automaticControl.value); + } + } + + private sendBack() { + this.router.navigateByUrl('admin/ldn/services'); + } + private createOutboundPatternFormGroup(): FormGroup { + return this.formBuilder.group({ + pattern: [''], + constraint: [''], + }); + } - private createOutboundPatternFormGroup(): FormGroup { - return this.formBuilder.group({ - pattern: [''], - constraint: [''], - }); - } - - private createInboundPatternFormGroup(): FormGroup { - return this.formBuilder.group({ - pattern: [''], - constraint: [''], - automatic: false - }); - } + private createInboundPatternFormGroup(): FormGroup { + return this.formBuilder.group({ + pattern: [''], + constraint: [''], + automatic: false + }); + } } diff --git a/src/app/admin/admin-ldn-services/ldn-service-new/ldn-service-new.component.spec.ts b/src/app/admin/admin-ldn-services/ldn-service-new/ldn-service-new.component.spec.ts index 4994823004..d49d393195 100644 --- a/src/app/admin/admin-ldn-services/ldn-service-new/ldn-service-new.component.spec.ts +++ b/src/app/admin/admin-ldn-services/ldn-service-new/ldn-service-new.component.spec.ts @@ -3,23 +3,23 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { LdnServiceNewComponent } from './ldn-service-new.component'; describe('LdnServiceNewComponent', () => { - let component: LdnServiceNewComponent; - let fixture: ComponentFixture; + let component: LdnServiceNewComponent; + let fixture: ComponentFixture; - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [ LdnServiceNewComponent ] - }) - .compileComponents(); - }); + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [LdnServiceNewComponent] + }) + .compileComponents(); + }); - beforeEach(() => { - fixture = TestBed.createComponent(LdnServiceNewComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + beforeEach(() => { + fixture = TestBed.createComponent(LdnServiceNewComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it('should create', () => { + expect(component).toBeTruthy(); + }); }); diff --git a/src/app/admin/admin-ldn-services/ldn-service-new/ldn-service-new.component.ts b/src/app/admin/admin-ldn-services/ldn-service-new/ldn-service-new.component.ts index daf1653cd1..e92c06dc26 100644 --- a/src/app/admin/admin-ldn-services/ldn-service-new/ldn-service-new.component.ts +++ b/src/app/admin/admin-ldn-services/ldn-service-new/ldn-service-new.component.ts @@ -4,25 +4,24 @@ import { LdnService } from "../ldn-services-model/ldn-services.model"; import { ActivatedRoute } from "@angular/router"; import { ProcessDataService } from "../../../core/data/processes/process-data.service"; import { LinkService } from "../../../core/cache/builders/link.service"; -import { getFirstSucceededRemoteDataPayload } from "../../../core/shared/operators"; @Component({ - selector: 'ds-ldn-service-new', - templateUrl: './ldn-service-new.component.html', - styleUrls: ['./ldn-service-new.component.scss'] + selector: 'ds-ldn-service-new', + templateUrl: './ldn-service-new.component.html', + styleUrls: ['./ldn-service-new.component.scss'] }) export class LdnServiceNewComponent implements OnInit { - /** - * Emits preselected process if there is one - */ - ldnService$?: Observable; + /** + * Emits preselected process if there is one + */ + ldnService$?: Observable; - constructor(private route: ActivatedRoute, private processService: ProcessDataService, private linkService: LinkService) { - } + constructor(private route: ActivatedRoute, private processService: ProcessDataService, private linkService: LinkService) { + } - /** - * If there's an id parameter, use this the process with this identifier as presets for the form - */ - ngOnInit() { - } + /** + * If there's an id parameter, use this the process with this identifier as presets for the form + */ + ngOnInit() { + } } diff --git a/src/app/admin/admin-ldn-services/ldn-service-serviceMock/ldnServicesRD$-mock.ts b/src/app/admin/admin-ldn-services/ldn-service-serviceMock/ldnServicesRD$-mock.ts index fccb374b5f..b1a954b9d6 100644 --- a/src/app/admin/admin-ldn-services/ldn-service-serviceMock/ldnServicesRD$-mock.ts +++ b/src/app/admin/admin-ldn-services/ldn-service-serviceMock/ldnServicesRD$-mock.ts @@ -37,8 +37,6 @@ export const mockLdnService: LdnService = { }; - - const mockLdnServices = { payload: { elementsPerPage: 20, @@ -52,7 +50,7 @@ const mockLdnServices = { page: [mockLdnService], type: LDN_SERVICE, self: undefined, - getPageLength: function() { + getPageLength: function () { return this.page.length; }, _links: { @@ -67,7 +65,5 @@ const mockLdnServices = { }; - - // Create a mock ldnServicesRD$ observable export const mockLdnServicesRD$: Observable>> = of((mockLdnServices as unknown) as RemoteData>); diff --git a/src/app/admin/admin-ldn-services/ldn-services-data/ldn-itemfilters-data.service.ts b/src/app/admin/admin-ldn-services/ldn-services-data/ldn-itemfilters-data.service.ts index 692e1a5db9..babb00c959 100644 --- a/src/app/admin/admin-ldn-services/ldn-services-data/ldn-itemfilters-data.service.ts +++ b/src/app/admin/admin-ldn-services/ldn-services-data/ldn-itemfilters-data.service.ts @@ -17,7 +17,6 @@ import { Itemfilter } from '../ldn-services-model/ldn-service-itemfilters'; import { PaginatedList } from '../../../core/data/paginated-list.model'; - /** * A service responsible for fetching/sending data from/to the REST API on the itemfilters endpoint */ @@ -38,11 +37,11 @@ export class LdnItemfiltersService extends IdentifiableDataService i this.findAllData = new FindAllDataImpl(this.linkPath, requestService, rdbService, objectCache, halService, this.responseMsToLive); } - getEndpoint() { - return this.halService.getEndpoint(this.linkPath); - } + getEndpoint() { + return this.halService.getEndpoint(this.linkPath); + } - findAll(options?: FindListOptions, useCachedVersionIfAvailable?: boolean, reRequestOnStale?: boolean, ...linksToFollow: FollowLinkConfig[]): Observable>> { - return this.findAllData.findAll(options, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow); - } + findAll(options?: FindListOptions, useCachedVersionIfAvailable?: boolean, reRequestOnStale?: boolean, ...linksToFollow: FollowLinkConfig[]): Observable>> { + return this.findAllData.findAll(options, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow); + } } diff --git a/src/app/admin/admin-ldn-services/ldn-services-data/ldn-services-data.service.ts b/src/app/admin/admin-ldn-services/ldn-services-data/ldn-services-data.service.ts index d2ef16fada..35f9bee04f 100644 --- a/src/app/admin/admin-ldn-services/ldn-services-data/ldn-services-data.service.ts +++ b/src/app/admin/admin-ldn-services/ldn-services-data/ldn-services-data.service.ts @@ -38,90 +38,89 @@ import { hasValue } from 'src/app/shared/empty.util'; @Injectable() @dataService(LDN_SERVICE) export class LdnServicesService extends IdentifiableDataService implements FindAllData, DeleteData, PatchData, CreateData { - createData: CreateDataImpl; - private findAllData: FindAllDataImpl; - private deleteData: DeleteDataImpl; - private patchData: PatchDataImpl; - private comparator: ChangeAnalyzer; + createData: CreateDataImpl; + private findAllData: FindAllDataImpl; + private deleteData: DeleteDataImpl; + private patchData: PatchDataImpl; + private comparator: ChangeAnalyzer; - constructor( - protected requestService: RequestService, - protected rdbService: RemoteDataBuildService, - protected objectCache: ObjectCacheService, - protected halService: HALEndpointService, - protected notificationsService: NotificationsService, - ) { - super('ldnservices', requestService, rdbService, objectCache, halService); + constructor( + protected requestService: RequestService, + protected rdbService: RemoteDataBuildService, + protected objectCache: ObjectCacheService, + protected halService: HALEndpointService, + protected notificationsService: NotificationsService, + ) { + super('ldnservices', requestService, rdbService, objectCache, halService); - this.findAllData = new FindAllDataImpl(this.linkPath, requestService, rdbService, objectCache, halService, this.responseMsToLive); - this.deleteData = new DeleteDataImpl(this.linkPath, requestService, rdbService, objectCache, halService, notificationsService, this.responseMsToLive, this.constructIdEndpoint); - this.patchData = new PatchDataImpl(this.linkPath, requestService, rdbService, objectCache, halService, this.comparator, this.responseMsToLive, this.constructIdEndpoint); - this.createData = new CreateDataImpl(this.linkPath, requestService, rdbService, objectCache, halService, notificationsService, this.responseMsToLive); - } + this.findAllData = new FindAllDataImpl(this.linkPath, requestService, rdbService, objectCache, halService, this.responseMsToLive); + this.deleteData = new DeleteDataImpl(this.linkPath, requestService, rdbService, objectCache, halService, notificationsService, this.responseMsToLive, this.constructIdEndpoint); + this.patchData = new PatchDataImpl(this.linkPath, requestService, rdbService, objectCache, halService, this.comparator, this.responseMsToLive, this.constructIdEndpoint); + this.createData = new CreateDataImpl(this.linkPath, requestService, rdbService, objectCache, halService, notificationsService, this.responseMsToLive); + } - create(object: LdnService): Observable> { - return this.createData.create(object); - } + create(object: LdnService): Observable> { + return this.createData.create(object); + } - patch(object: LdnService, operations: Operation[]): Observable> { - return this.patchData.patch(object, operations); - } + patch(object: LdnService, operations: Operation[]): Observable> { + return this.patchData.patch(object, operations); + } - update(object: LdnService): Observable> { - return this.patchData.update(object); - } + update(object: LdnService): Observable> { + return this.patchData.update(object); + } - commitUpdates(method?: RestRequestMethod): void { - return this.patchData.commitUpdates(method); - } + commitUpdates(method?: RestRequestMethod): void { + return this.patchData.commitUpdates(method); + } - createPatchFromCache(object: LdnService): Observable { - return this.patchData.createPatchFromCache(object); - } + createPatchFromCache(object: LdnService): Observable { + return this.patchData.createPatchFromCache(object); + } - findAll(options?: FindListOptions, useCachedVersionIfAvailable?: boolean, reRequestOnStale?: boolean, ...linksToFollow: FollowLinkConfig[]): Observable>> { - return this.findAllData.findAll(options, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow); - } + findAll(options?: FindListOptions, useCachedVersionIfAvailable?: boolean, reRequestOnStale?: boolean, ...linksToFollow: FollowLinkConfig[]): Observable>> { + return this.findAllData.findAll(options, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow); + } - public delete(objectId: string, copyVirtualMetadata?: string[]): Observable> { - return this.deleteData.delete(objectId, copyVirtualMetadata); - } + public delete(objectId: string, copyVirtualMetadata?: string[]): Observable> { + return this.deleteData.delete(objectId, copyVirtualMetadata); + } - public deleteByHref(href: string, copyVirtualMetadata?: string[]): Observable> { - return this.deleteData.deleteByHref(href, copyVirtualMetadata); - } + public deleteByHref(href: string, copyVirtualMetadata?: string[]): Observable> { + return this.deleteData.deleteByHref(href, copyVirtualMetadata); + } - public invoke(serviceName: string, serviceId: string, parameters: ldnServiceConstrain[], files: File[]): Observable> { - const requestId = this.requestService.generateRequestId(); - this.getBrowseEndpoint().pipe( - take(1), - map((endpoint: string) => new URLCombiner(endpoint, serviceName, 'processes', serviceId).toString()), - map((endpoint: string) => { - const body = this.getInvocationFormData(parameters, files); - return new MultipartPostRequest(requestId, endpoint, body); - }) - ).subscribe((request: RestRequest) => this.requestService.send(request)); + public invoke(serviceName: string, serviceId: string, parameters: ldnServiceConstrain[], files: File[]): Observable> { + const requestId = this.requestService.generateRequestId(); + this.getBrowseEndpoint().pipe( + take(1), + map((endpoint: string) => new URLCombiner(endpoint, serviceName, 'processes', serviceId).toString()), + map((endpoint: string) => { + const body = this.getInvocationFormData(parameters, files); + return new MultipartPostRequest(requestId, endpoint, body); + }) + ).subscribe((request: RestRequest) => this.requestService.send(request)); - return this.rdbService.buildFromRequestUUID(requestId); - } + return this.rdbService.buildFromRequestUUID(requestId); + } + public ldnServiceWithNameExistsAndCanExecute(scriptName: string): Observable { + return this.findById(scriptName).pipe( + getFirstCompletedRemoteData(), + map((rd: RemoteData) => { + return hasValue(rd.payload); + }), + ); + } - private getInvocationFormData(constrain: ldnServiceConstrain[], files: File[]): FormData { - const form: FormData = new FormData(); - form.set('properties', JSON.stringify(constrain)); - files.forEach((file: File) => { - form.append('file', file); - }); - return form; - } - - public ldnServiceWithNameExistsAndCanExecute(scriptName: string): Observable { - return this.findById(scriptName).pipe( - getFirstCompletedRemoteData(), - map((rd: RemoteData) => { - return hasValue(rd.payload); - }), - ); - } + private getInvocationFormData(constrain: ldnServiceConstrain[], files: File[]): FormData { + const form: FormData = new FormData(); + form.set('properties', JSON.stringify(constrain)); + files.forEach((file: File) => { + form.append('file', file); + }); + return form; + } } diff --git a/src/app/admin/admin-ldn-services/ldn-services-directory/ldn-services-directory.component.html b/src/app/admin/admin-ldn-services/ldn-services-directory/ldn-services-directory.component.html index 6753c6e90c..45c2106468 100644 --- a/src/app/admin/admin-ldn-services/ldn-services-directory/ldn-services-directory.component.html +++ b/src/app/admin/admin-ldn-services/ldn-services-directory/ldn-services-directory.component.html @@ -15,34 +15,34 @@
- - - - - - + + + + + + @@ -72,7 +72,8 @@
-
diff --git a/src/app/admin/admin-ldn-services/ldn-services-directory/ldn-services-directory.component.spec.ts b/src/app/admin/admin-ldn-services/ldn-services-directory/ldn-services-directory.component.spec.ts index bedcabb271..0999c82c19 100644 --- a/src/app/admin/admin-ldn-services/ldn-services-directory/ldn-services-directory.component.spec.ts +++ b/src/app/admin/admin-ldn-services/ldn-services-directory/ldn-services-directory.component.spec.ts @@ -3,23 +3,23 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ServicesDirectoryComponent } from './services-directory.component'; describe('ServicesDirectoryComponent', () => { - let component: ServicesDirectoryComponent; - let fixture: ComponentFixture; + let component: ServicesDirectoryComponent; + let fixture: ComponentFixture; - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [ ServicesDirectoryComponent ] - }) - .compileComponents(); - }); + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ServicesDirectoryComponent] + }) + .compileComponents(); + }); - beforeEach(() => { - fixture = TestBed.createComponent(ServicesDirectoryComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + beforeEach(() => { + fixture = TestBed.createComponent(ServicesDirectoryComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it('should create', () => { + expect(component).toBeTruthy(); + }); }); diff --git a/src/app/admin/admin-ldn-services/ldn-services-directory/ldn-services-directory.component.ts b/src/app/admin/admin-ldn-services/ldn-services-directory/ldn-services-directory.component.ts index 91904d6bc5..3db9231ac2 100644 --- a/src/app/admin/admin-ldn-services/ldn-services-directory/ldn-services-directory.component.ts +++ b/src/app/admin/admin-ldn-services/ldn-services-directory/ldn-services-directory.component.ts @@ -1,4 +1,12 @@ -import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnDestroy, OnInit, TemplateRef, ViewChild } from '@angular/core'; +import { + ChangeDetectionStrategy, + ChangeDetectorRef, + Component, + OnDestroy, + OnInit, + TemplateRef, + ViewChild +} from '@angular/core'; import { Observable, Subscription } from 'rxjs'; import { RemoteData } from '../../../core/data/remote-data'; import { PaginatedList } from '../../../core/data/paginated-list.model'; @@ -11,130 +19,128 @@ import { PaginationService } from 'src/app/core/pagination/pagination.service'; import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; import { hasValue } from '../../../shared/empty.util'; import { Operation } from 'fast-json-patch'; -import { getFirstCompletedRemoteData } from '../../../core/shared/operators'; +import { getFirstCompletedRemoteData } from '../../../core/shared/operators'; import { NotificationsService } from '../../../shared/notifications/notifications.service'; import { TranslateService } from '@ngx-translate/core'; @Component({ - selector: 'ds-ldn-services-directory', - templateUrl: './ldn-services-directory.component.html', - styleUrls: ['./ldn-services-directory.component.scss'], - changeDetection: ChangeDetectionStrategy.Default + selector: 'ds-ldn-services-directory', + templateUrl: './ldn-services-directory.component.html', + styleUrls: ['./ldn-services-directory.component.scss'], + changeDetection: ChangeDetectionStrategy.Default }) export class LdnServicesOverviewComponent implements OnInit, OnDestroy { - selectedServiceId: string | number | null = null; - servicesData: any[] = []; - @ViewChild('deleteModal', {static: true}) deleteModal: TemplateRef; - ldnServicesRD$: Observable>>; - config: FindListOptions = Object.assign(new FindListOptions(), { - elementsPerPage: 20 - }); - pageConfig: PaginationComponentOptions = Object.assign(new PaginationComponentOptions(), { - id: 'po', - pageSize: 20 - }); - isProcessingSub: Subscription; - private modalRef: any; + selectedServiceId: string | number | null = null; + servicesData: any[] = []; + @ViewChild('deleteModal', {static: true}) deleteModal: TemplateRef; + ldnServicesRD$: Observable>>; + config: FindListOptions = Object.assign(new FindListOptions(), { + elementsPerPage: 20 + }); + pageConfig: PaginationComponentOptions = Object.assign(new PaginationComponentOptions(), { + id: 'po', + pageSize: 20 + }); + isProcessingSub: Subscription; + private modalRef: any; - constructor( - protected ldnServicesService: LdnServicesService, - protected paginationService: PaginationService, - protected modalService: NgbModal, - private cdRef: ChangeDetectorRef, - private notificationService: NotificationsService, - private translateService: TranslateService, - ) { - } - - ngOnInit(): void { - this.setLdnServices(); - } - - setLdnServices() { - this.ldnServicesRD$ = this.paginationService.getFindListOptions(this.pageConfig.id, this.config).pipe( - switchMap((config) => this.ldnServicesService.findAll(config, false, false).pipe( - getFirstCompletedRemoteData() - )) - ); - } - - ngOnDestroy(): void { - this.paginationService.clearPagination(this.pageConfig.id); - if (hasValue(this.isProcessingSub)) { - this.isProcessingSub.unsubscribe(); + constructor( + protected ldnServicesService: LdnServicesService, + protected paginationService: PaginationService, + protected modalService: NgbModal, + private cdRef: ChangeDetectorRef, + private notificationService: NotificationsService, + private translateService: TranslateService, + ) { } - } - openDeleteModal(content) { - this.modalRef = this.modalService.open(content); - } + ngOnInit(): void { + this.setLdnServices(); + } - closeModal() { - this.modalRef.close(); - this.cdRef.detectChanges(); - } + setLdnServices() { + this.ldnServicesRD$ = this.paginationService.getFindListOptions(this.pageConfig.id, this.config).pipe( + switchMap((config) => this.ldnServicesService.findAll(config, false, false).pipe( + getFirstCompletedRemoteData() + )) + ); + } - selectServiceToDelete(serviceId: number) { - this.selectedServiceId = serviceId; - this.openDeleteModal(this.deleteModal); - } + ngOnDestroy(): void { + this.paginationService.clearPagination(this.pageConfig.id); + if (hasValue(this.isProcessingSub)) { + this.isProcessingSub.unsubscribe(); + } + } - deleteSelected(serviceId: string, ldnServicesService: LdnServicesService): void { - if (this.selectedServiceId !== null) { - ldnServicesService.delete(serviceId).pipe(getFirstCompletedRemoteData()).subscribe((rd: RemoteData) => { - if (rd.hasSucceeded) { - this.servicesData = this.servicesData.filter(service => service.id !== serviceId); - this.ldnServicesRD$ = this.ldnServicesRD$.pipe( - map((remoteData: RemoteData>) => { - if (remoteData.hasSucceeded) { - remoteData.payload.page = remoteData.payload.page.filter(service => service.id.toString() !== serviceId); + openDeleteModal(content) { + this.modalRef = this.modalService.open(content); + } + + closeModal() { + this.modalRef.close(); + this.cdRef.detectChanges(); + } + + selectServiceToDelete(serviceId: number) { + this.selectedServiceId = serviceId; + this.openDeleteModal(this.deleteModal); + } + + deleteSelected(serviceId: string, ldnServicesService: LdnServicesService): void { + if (this.selectedServiceId !== null) { + ldnServicesService.delete(serviceId).pipe(getFirstCompletedRemoteData()).subscribe((rd: RemoteData) => { + if (rd.hasSucceeded) { + this.servicesData = this.servicesData.filter(service => service.id !== serviceId); + this.ldnServicesRD$ = this.ldnServicesRD$.pipe( + map((remoteData: RemoteData>) => { + if (remoteData.hasSucceeded) { + remoteData.payload.page = remoteData.payload.page.filter(service => service.id.toString() !== serviceId); + } + return remoteData; + }) + ); + this.cdRef.detectChanges(); + this.closeModal(); + this.notificationService.success(this.translateService.get('ldn-service-delete.notification.success.title'), + this.translateService.get('ldn-service-delete.notification.success.content')); + } else { + this.notificationService.error(this.translateService.get('ldn-service-delete.notification.error.title'), + this.translateService.get('ldn-service-delete.notification.error.content')); + this.cdRef.detectChanges(); } - return remoteData; - }) - ); - this.cdRef.detectChanges(); - this.closeModal(); - this.notificationService.success(this.translateService.get('ldn-service-delete.notification.success.title'), - this.translateService.get('ldn-service-delete.notification.success.content')); - } else { - this.notificationService.error(this.translateService.get('ldn-service-delete.notification.error.title'), - this.translateService.get('ldn-service-delete.notification.error.content')); - this.cdRef.detectChanges(); + }); } - }); } - } + toggleStatus(ldnService: any, ldnServicesService: LdnServicesService): void { + const newStatus = !ldnService.enabled; + const originalStatus = ldnService.enabled; + const patchOperation: Operation = { + op: 'replace', + path: '/enabled', + value: newStatus, + }; - toggleStatus(ldnService: any, ldnServicesService: LdnServicesService): void { - const newStatus = !ldnService.enabled; - const originalStatus = ldnService.enabled; - - const patchOperation: Operation = { - op: 'replace', - path: '/enabled', - value: newStatus, - }; - - ldnServicesService.patch(ldnService, [patchOperation]).pipe(getFirstCompletedRemoteData()).subscribe( - (rd: RemoteData) => { - if (rd.hasSucceeded) { - ldnService.enabled = newStatus; - this.notificationService.success(this.translateService.get('ldn-enable-service.notification.success.title'), - this.translateService.get('ldn-enable-service.notification.success.content')); - } else { - ldnService.enabled = originalStatus; - this.notificationService.error(this.translateService.get('ldn-enable-service.notification.error.title'), - this.translateService.get('ldn-enable-service.notification.error.content')); - } - } - ); - } + ldnServicesService.patch(ldnService, [patchOperation]).pipe(getFirstCompletedRemoteData()).subscribe( + (rd: RemoteData) => { + if (rd.hasSucceeded) { + ldnService.enabled = newStatus; + this.notificationService.success(this.translateService.get('ldn-enable-service.notification.success.title'), + this.translateService.get('ldn-enable-service.notification.success.content')); + } else { + ldnService.enabled = originalStatus; + this.notificationService.error(this.translateService.get('ldn-enable-service.notification.error.title'), + this.translateService.get('ldn-enable-service.notification.error.content')); + } + } + ); + } } diff --git a/src/app/admin/admin-ldn-services/ldn-services-guard/ldn-services-guard.service.ts b/src/app/admin/admin-ldn-services/ldn-services-guard/ldn-services-guard.service.ts index 21123ede4a..8919f06357 100644 --- a/src/app/admin/admin-ldn-services/ldn-services-guard/ldn-services-guard.service.ts +++ b/src/app/admin/admin-ldn-services/ldn-services-guard/ldn-services-guard.service.ts @@ -4,26 +4,28 @@ import { Observable } from 'rxjs'; @Injectable({ - providedIn: 'root' + providedIn: 'root' }) export class LdnServicesGuard implements CanActivate { - constructor( - //private notifyInfoService: NotifyInfoService, - private router: Router - ) {} - canActivate( - route: ActivatedRouteSnapshot, - state: RouterStateSnapshot): Observable | Promise | boolean | UrlTree { - return true; - /*return this.notifyInfoService.isCoarConfigEnabled().pipe( - map(coarLdnEnabled => { - if (coarLdnEnabled) { - return true; - } else { - return this.router.parseUrl('/404'); - } - }) - );*/ - } + constructor( + //private notifyInfoService: NotifyInfoService, + private router: Router + ) { + } + + canActivate( + route: ActivatedRouteSnapshot, + state: RouterStateSnapshot): Observable | Promise | boolean | UrlTree { + return true; + /*return this.notifyInfoService.isCoarConfigEnabled().pipe( + map(coarLdnEnabled => { + if (coarLdnEnabled) { + return true; + } else { + return this.router.parseUrl('/404'); + } + }) + );*/ + } } diff --git a/src/app/admin/admin-ldn-services/ldn-services-guard/ldn-services.guard.spec.ts b/src/app/admin/admin-ldn-services/ldn-services-guard/ldn-services.guard.spec.ts index 30af31cab8..9b66ad6788 100644 --- a/src/app/admin/admin-ldn-services/ldn-services-guard/ldn-services.guard.spec.ts +++ b/src/app/admin/admin-ldn-services/ldn-services-guard/ldn-services.guard.spec.ts @@ -3,15 +3,15 @@ import { TestBed } from '@angular/core/testing'; import { LdnServicesGuard } from './ldn-services-guard.service'; describe('LdnServicesGuard', () => { - let guard: LdnServicesGuard; + let guard: LdnServicesGuard; - beforeEach(() => { - TestBed.configureTestingModule({}); - guard = TestBed.inject(LdnServicesGuard); - }); + beforeEach(() => { + TestBed.configureTestingModule({}); + guard = TestBed.inject(LdnServicesGuard); + }); - it('should be created', () => { - // @ts-ignore - expect(guard).toBeTruthy(); - }); + it('should be created', () => { + // @ts-ignore + expect(guard).toBeTruthy(); + }); }); diff --git a/src/app/admin/admin-ldn-services/ldn-services-model/ldn-service-itemfilters.ts b/src/app/admin/admin-ldn-services/ldn-services-model/ldn-service-itemfilters.ts index 865fa0b3ea..6aceada3df 100644 --- a/src/app/admin/admin-ldn-services/ldn-services-model/ldn-service-itemfilters.ts +++ b/src/app/admin/admin-ldn-services/ldn-services-model/ldn-service-itemfilters.ts @@ -1,7 +1,6 @@ -import { autoserialize, inheritSerialization, deserialize } from 'cerialize'; +import { autoserialize, deserialize, inheritSerialization } from 'cerialize'; import { LDN_SERVICE_CONSTRAINT_FILTER } from './ldn-service.resource-type'; import { CacheableObject } from '../../../core/cache/cacheable-object.model'; -import { HALLink } from '../../../core/shared/hal-link.model'; import { typedObject } from '../../../core/cache/builders/build-decorators'; import { excludeFromEquals } from '../../../core/utilities/equals.decorators'; import { ResourceType } from '../../../core/shared/resource-type'; diff --git a/src/app/admin/admin-ldn-services/ldn-services-model/ldn-service-patterns.model.ts b/src/app/admin/admin-ldn-services/ldn-services-model/ldn-service-patterns.model.ts index 1e67ccfeee..1103056e47 100644 --- a/src/app/admin/admin-ldn-services/ldn-services-model/ldn-service-patterns.model.ts +++ b/src/app/admin/admin-ldn-services/ldn-services-model/ldn-service-patterns.model.ts @@ -4,10 +4,10 @@ import { autoserialize } from 'cerialize'; * notify service patterns */ export class NotifyServicePattern { - @autoserialize - pattern: string; - @autoserialize - constraint: string; - @autoserialize - automatic: string; + @autoserialize + pattern: string; + @autoserialize + constraint: string; + @autoserialize + automatic: string; } diff --git a/src/app/admin/admin-ldn-services/ldn-services-model/ldn-service-status.model.ts b/src/app/admin/admin-ldn-services/ldn-services-model/ldn-service-status.model.ts index 040e4d37b8..d9e45d91a9 100644 --- a/src/app/admin/admin-ldn-services/ldn-services-model/ldn-service-status.model.ts +++ b/src/app/admin/admin-ldn-services/ldn-services-model/ldn-service-status.model.ts @@ -2,7 +2,7 @@ * List of services statuses */ export enum LdnServiceStatus { - UNKOWN, - DISABLED, - ENABLED, + UNKOWN, + DISABLED, + ENABLED, } diff --git a/src/app/admin/admin-ldn-services/ldn-services-model/ldn-service.constrain.model.ts b/src/app/admin/admin-ldn-services/ldn-services-model/ldn-service.constrain.model.ts index 6eda194443..69a9baf273 100644 --- a/src/app/admin/admin-ldn-services/ldn-services-model/ldn-service.constrain.model.ts +++ b/src/app/admin/admin-ldn-services/ldn-services-model/ldn-service.constrain.model.ts @@ -1,3 +1,3 @@ export class ldnServiceConstrain { - void: any; + void: any; } diff --git a/src/app/admin/admin-ldn-services/ldn-services-model/ldn-services.model.ts b/src/app/admin/admin-ldn-services/ldn-services-model/ldn-services.model.ts index e0725b5851..8631ef2451 100644 --- a/src/app/admin/admin-ldn-services/ldn-services-model/ldn-services.model.ts +++ b/src/app/admin/admin-ldn-services/ldn-services-model/ldn-services.model.ts @@ -7,7 +7,6 @@ import { typedObject } from '../../../core/cache/builders/build-decorators'; import { NotifyServicePattern } from './ldn-service-patterns.model'; - /** An LdnService and its properties. */ @typedObject @inheritSerialization(CacheableObject) diff --git a/src/app/admin/admin-ldn-services/ldn-services-services/ldn-directory.service.spec.ts b/src/app/admin/admin-ldn-services/ldn-services-services/ldn-directory.service.spec.ts index e24508e942..ab4f78dc6b 100644 --- a/src/app/admin/admin-ldn-services/ldn-services-services/ldn-directory.service.spec.ts +++ b/src/app/admin/admin-ldn-services/ldn-services-services/ldn-directory.service.spec.ts @@ -3,15 +3,15 @@ import { TestBed } from '@angular/core/testing'; import { LdnDirectoryService } from './ldn-directory.service'; describe('LdnDirectoryService', () => { - let service: LdnDirectoryService; + let service: LdnDirectoryService; - beforeEach(() => { - TestBed.configureTestingModule({}); - service = TestBed.inject(LdnDirectoryService); - }); + beforeEach(() => { + TestBed.configureTestingModule({}); + service = TestBed.inject(LdnDirectoryService); + }); - it('should be created', () => { - // @ts-ignore - expect(service).toBeTruthy(); - }); + it('should be created', () => { + // @ts-ignore + expect(service).toBeTruthy(); + }); }); diff --git a/src/app/admin/admin-ldn-services/ldn-services-services/ldn-directory.service.ts b/src/app/admin/admin-ldn-services/ldn-services-services/ldn-directory.service.ts index 3499759f03..92446b4677 100644 --- a/src/app/admin/admin-ldn-services/ldn-services-services/ldn-directory.service.ts +++ b/src/app/admin/admin-ldn-services/ldn-services-services/ldn-directory.service.ts @@ -4,22 +4,24 @@ import { map, Observable } from 'rxjs'; import { LdnServicesService } from "../ldn-services-data/ldn-services-data.service"; @Injectable({ - providedIn: 'root', + providedIn: 'root', }) export class LdnDirectoryService { - private itemFilterEndpoint = 'http://localhost:8080/server/api/config/itemfilters'; + private itemFilterEndpoint = 'http://localhost:8080/server/api/config/itemfilters'; - constructor(private http: HttpClient, - private ldnServicesService: LdnServicesService) {} - public getItemFilters(): Observable { + constructor(private http: HttpClient, + private ldnServicesService: LdnServicesService) { + } - return this.ldnServicesService.findAll().pipe( - map((servicesData) => { - return servicesData; - }) - ); - } + public getItemFilters(): Observable { + + return this.ldnServicesService.findAll().pipe( + map((servicesData) => { + return servicesData; + }) + ); + } } diff --git a/src/app/admin/admin-ldn-services/ldn-services-services/ldn-service-bulk-delete.service.spec.ts b/src/app/admin/admin-ldn-services/ldn-services-services/ldn-service-bulk-delete.service.spec.ts index 38e1a4de2b..922b63a871 100644 --- a/src/app/admin/admin-ldn-services/ldn-services-services/ldn-service-bulk-delete.service.spec.ts +++ b/src/app/admin/admin-ldn-services/ldn-services-services/ldn-service-bulk-delete.service.spec.ts @@ -3,15 +3,15 @@ import { TestBed } from '@angular/core/testing'; import { LdnServicesBulkDeleteService } from './ldn-service-bulk-delete.service'; describe('LdnServiceBulkDeleteService', () => { - let service: LdnServicesBulkDeleteService; + let service: LdnServicesBulkDeleteService; - beforeEach(() => { - TestBed.configureTestingModule({}); - service = TestBed.inject(LdnServicesBulkDeleteService); - }); + beforeEach(() => { + TestBed.configureTestingModule({}); + service = TestBed.inject(LdnServicesBulkDeleteService); + }); - it('should be created', () => { - // @ts-ignore - expect(service).toBeTruthy(); - }); + it('should be created', () => { + // @ts-ignore + expect(service).toBeTruthy(); + }); });
{{ 'service.overview.table.name' | translate }}{{ 'service.overview.table.description' | translate }}{{ 'service.overview.table.status' | translate }}{{ 'service.overview.table.actions' | translate }}
{{ 'service.overview.table.name' | translate }}{{ 'service.overview.table.description' | translate }}{{ 'service.overview.table.status' | translate }}{{ 'service.overview.table.actions' | translate }}
{{ ldnService.name }} {{ ldnService.description }} - + {{ ldnService.enabled ? ('ldn-service.overview.table.enabled' | translate) : ('ldn-service.overview.table.disabled' | translate) }}
- - -
+ + +