mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-15 14:03:06 +00:00
Merge remote-tracking branch 'origin/CST-12498' into coar-notify-7
This commit is contained in:
@@ -21,6 +21,10 @@ import {FindListOptions} from '../../../core/data/find-list-options.model';
|
||||
import {PaginationComponentOptions} from '../../../shared/pagination/pagination-component-options.model';
|
||||
import {NotifyServicePattern} from '../ldn-services-model/ldn-service-patterns.model';
|
||||
|
||||
|
||||
/**
|
||||
* Component for editing LDN service through a form that allows to edit the properties of the selected service
|
||||
*/
|
||||
@Component({
|
||||
selector: 'ds-ldn-service-form-edit',
|
||||
templateUrl: './ldn-service-form-edit.component.html',
|
||||
@@ -110,12 +114,18 @@ export class LdnServiceFormEditComponent implements OnInit {
|
||||
this.setItemfilters();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets item filters using LDN item filters service
|
||||
*/
|
||||
setItemfilters() {
|
||||
this.itemfiltersRD$ = this.ldnItemfiltersService.findAll().pipe(
|
||||
getFirstCompletedRemoteData());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fetches LDN service data by ID and updates the form
|
||||
* @param serviceId - The ID of the LDN service
|
||||
*/
|
||||
fetchServiceData(serviceId: string): void {
|
||||
this.ldnServicesService.findById(serviceId).pipe(
|
||||
getFirstCompletedRemoteData()
|
||||
@@ -140,6 +150,11 @@ export class LdnServiceFormEditComponent implements OnInit {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters pattern objects, initializes form groups, assigns labels, and adds them to the specified form array so the correct string is shown in the dropdown..
|
||||
* @param formArrayName - The name of the form array to be populated
|
||||
* @param isOutbound - A boolean indicating whether the patterns are outbound (true) or inbound (false)
|
||||
*/
|
||||
filterPatternObjectsAndPickLabel(formArrayName: string, isOutbound: boolean) {
|
||||
const PatternsArray = this.formModel.get(formArrayName) as FormArray;
|
||||
PatternsArray.clear();
|
||||
@@ -170,6 +185,10 @@ export class LdnServiceFormEditComponent implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates an array of patch operations based on form changes
|
||||
* @returns Array of patch operations
|
||||
*/
|
||||
generatePatchOperations(): any[] {
|
||||
const patchOperations: any[] = [];
|
||||
|
||||
@@ -202,21 +221,34 @@ export class LdnServiceFormEditComponent implements OnInit {
|
||||
return patchOperations;
|
||||
}
|
||||
|
||||
/**
|
||||
* Submits the form by opening the confirmation modal
|
||||
*/
|
||||
onSubmit() {
|
||||
this.openConfirmModal(this.confirmModal);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new inbound pattern form group to the array of inbound patterns in the form
|
||||
*/
|
||||
addInboundPattern() {
|
||||
const notifyServiceInboundPatternsArray = this.formModel.get('notifyServiceInboundPatterns') as FormArray;
|
||||
notifyServiceInboundPatternsArray.push(this.createInboundPatternFormGroup());
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new outbound pattern form group to the array of outbound patterns in the form
|
||||
*/
|
||||
addOutboundPattern() {
|
||||
const notifyServiceOutboundPatternsArray = this.formModel.get('notifyServiceOutboundPatterns') as FormArray;
|
||||
notifyServiceOutboundPatternsArray.push(this.createOutboundPatternFormGroup());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Selects an outbound pattern by updating its values based on the provided pattern value and index
|
||||
* @param patternValue - The selected pattern value
|
||||
* @param index - The index of the outbound pattern in the array
|
||||
*/
|
||||
selectOutboundPattern(patternValue: string, index: number): void {
|
||||
const patternArray = (this.formModel.get('notifyServiceOutboundPatterns') as FormArray);
|
||||
patternArray.controls[index].patchValue({pattern: patternValue});
|
||||
@@ -224,22 +256,41 @@ export class LdnServiceFormEditComponent implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Selects an outbound item filter by updating its value based on the provided filter value and index
|
||||
* @param filterValue - The selected filter value
|
||||
* @param index - The index of the inbound pattern in the array
|
||||
*/
|
||||
selectOutboundItemFilter(filterValue: string, index: number) {
|
||||
const filterArray = (this.formModel.get('notifyServiceOutboundPatterns') as FormArray);
|
||||
filterArray.controls[index].patchValue({constraint: filterValue});
|
||||
}
|
||||
|
||||
/**
|
||||
* Selects an inbound pattern by updating its values based on the provided pattern value and index
|
||||
* @param patternValue - The selected pattern value
|
||||
* @param index - The index of the inbound pattern in the array
|
||||
*/
|
||||
selectInboundPattern(patternValue: string, index: number): void {
|
||||
const patternArray = (this.formModel.get('notifyServiceInboundPatterns') as FormArray);
|
||||
patternArray.controls[index].patchValue({pattern: patternValue});
|
||||
patternArray.controls[index].patchValue({patternLabel: this.translateService.instant('ldn-service.form.pattern.' + patternValue + '.label')});
|
||||
}
|
||||
|
||||
/**
|
||||
* Selects an inbound item filter by updating its value based on the provided filter value and index
|
||||
* @param filterValue - The selected filter value
|
||||
* @param index - The index of the inbound pattern in the array
|
||||
*/
|
||||
selectInboundItemFilter(filterValue: string, index: number): void {
|
||||
const filterArray = (this.formModel.get('notifyServiceInboundPatterns') as FormArray);
|
||||
filterArray.controls[index].patchValue({constraint: filterValue});
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles the automatic property of an inbound pattern at the specified index
|
||||
* @param i - The index of the inbound pattern in the array
|
||||
*/
|
||||
toggleAutomatic(i: number) {
|
||||
const automaticControl = this.formModel.get(`notifyServiceInboundPatterns.${i}.automatic`);
|
||||
if (automaticControl) {
|
||||
@@ -247,6 +298,9 @@ export class LdnServiceFormEditComponent implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles the enabled status of the LDN service by sending a patch request
|
||||
*/
|
||||
toggleEnabled() {
|
||||
const newStatus = !this.formModel.get('enabled').value;
|
||||
|
||||
@@ -267,20 +321,33 @@ export class LdnServiceFormEditComponent implements OnInit {
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Closes the modal
|
||||
*/
|
||||
closeModal() {
|
||||
this.modalRef.close();
|
||||
this.cdRef.detectChanges();
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens a confirmation modal with the specified content
|
||||
* @param content - The content to be displayed in the modal
|
||||
*/
|
||||
openConfirmModal(content) {
|
||||
this.modalRef = this.modalService.open(content);
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens a reset form modal with the specified content
|
||||
* @param content - The content to be displayed in the modal
|
||||
*/
|
||||
openResetFormModal(content) {
|
||||
this.modalRef = this.modalService.open(content);
|
||||
}
|
||||
|
||||
/**
|
||||
* Patches the LDN service by retrieving and sending patch operations geenrated in generatePatchOperations()
|
||||
*/
|
||||
patchService() {
|
||||
this.deleteMarkedInboundPatterns();
|
||||
this.deleteMarkedOutboundPatterns();
|
||||
@@ -305,17 +372,28 @@ export class LdnServiceFormEditComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the form and navigates back to the LDN services page
|
||||
*/
|
||||
resetFormAndLeave() {
|
||||
this.sendBack();
|
||||
this.closeModal();
|
||||
}
|
||||
|
||||
/**
|
||||
* Marks the specified inbound pattern for deletion
|
||||
* @param index - The index of the inbound pattern in the array
|
||||
*/
|
||||
markForInboundPatternDeletion(index: number) {
|
||||
if (!this.markedForDeletionInboundPattern.includes(index)) {
|
||||
this.markedForDeletionInboundPattern.push(index);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unmarks the specified inbound pattern for deletion
|
||||
* @param index - The index of the inbound pattern in the array
|
||||
*/
|
||||
unmarkForInboundPatternDeletion(index: number) {
|
||||
const i = this.markedForDeletionInboundPattern.indexOf(index);
|
||||
if (i !== -1) {
|
||||
@@ -323,12 +401,20 @@ export class LdnServiceFormEditComponent implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Marks the specified outbound pattern for deletion
|
||||
* @param index - The index of the outbound pattern in the array
|
||||
*/
|
||||
markForOutboundPatternDeletion(index: number) {
|
||||
if (!this.markedForDeletionOutboundPattern.includes(index)) {
|
||||
this.markedForDeletionOutboundPattern.push(index);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unmarks the specified outbound pattern for deletion
|
||||
* @param index - The index of the outbound pattern in the array
|
||||
*/
|
||||
unmarkForOutboundPatternDeletion(index: number) {
|
||||
const i = this.markedForDeletionOutboundPattern.indexOf(index);
|
||||
if (i !== -1) {
|
||||
@@ -336,6 +422,9 @@ export class LdnServiceFormEditComponent implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes marked inbound patterns from the form model
|
||||
*/
|
||||
deleteMarkedInboundPatterns() {
|
||||
this.markedForDeletionInboundPattern.sort((a, b) => b - a);
|
||||
const patternsArray = this.formModel.get('notifyServiceInboundPatterns') as FormArray;
|
||||
@@ -355,7 +444,9 @@ export class LdnServiceFormEditComponent implements OnInit {
|
||||
this.markedForDeletionInboundPattern = [];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Deletes marked outbound patterns from the form model
|
||||
*/
|
||||
deleteMarkedOutboundPatterns() {
|
||||
this.markedForDeletionOutboundPattern.sort((a, b) => b - a);
|
||||
const patternsArray = this.formModel.get('notifyServiceOutboundPatterns') as FormArray;
|
||||
@@ -376,7 +467,12 @@ export class LdnServiceFormEditComponent implements OnInit {
|
||||
this.markedForDeletionOutboundPattern = [];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates a replace operation and adds it to the patch operations if the form control is dirty
|
||||
* @param patchOperations - The array to store patch operations
|
||||
* @param formControlName - The name of the form control
|
||||
* @param path - The JSON Patch path for the operation
|
||||
*/
|
||||
private createReplaceOperation(patchOperations: any[], formControlName: string, path: string): void {
|
||||
if (this.formModel.get(formControlName).dirty) {
|
||||
patchOperations.push({
|
||||
@@ -387,6 +483,11 @@ export class LdnServiceFormEditComponent implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles patterns in the form array, checking if an add or replace operations is required
|
||||
* @param patchOperations - The array to store patch operations
|
||||
* @param formArrayName - The name of the form array
|
||||
*/
|
||||
private handlePatterns(patchOperations: any[], formArrayName: string): void {
|
||||
const patternsArray = this.formModel.get(formArrayName) as FormArray;
|
||||
|
||||
@@ -417,10 +518,17 @@ export class LdnServiceFormEditComponent implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Navigates back to the LDN services page
|
||||
*/
|
||||
private sendBack() {
|
||||
this.router.navigateByUrl('admin/ldn/services');
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a form group for outbound patterns
|
||||
* @returns The form group for outbound patterns
|
||||
*/
|
||||
private createOutboundPatternFormGroup(): FormGroup {
|
||||
return this.formBuilder.group({
|
||||
pattern: '',
|
||||
@@ -430,6 +538,10 @@ export class LdnServiceFormEditComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a form group for inbound patterns
|
||||
* @returns The form group for inbound patterns
|
||||
*/
|
||||
private createInboundPatternFormGroup(): FormGroup {
|
||||
return this.formBuilder.group({
|
||||
pattern: '',
|
||||
@@ -440,6 +552,10 @@ export class LdnServiceFormEditComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes an existing form group for outbound patterns
|
||||
* @returns The initialized form group for outbound patterns
|
||||
*/
|
||||
private initializeOutboundPatternFormGroup(): FormGroup {
|
||||
return this.formBuilder.group({
|
||||
pattern: '',
|
||||
@@ -448,6 +564,10 @@ export class LdnServiceFormEditComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes an existing form group for inbound patterns
|
||||
* @returns The initialized form group for inbound patterns
|
||||
*/
|
||||
private initializeInboundPatternFormGroup(): FormGroup {
|
||||
return this.formBuilder.group({
|
||||
pattern: '',
|
||||
|
@@ -19,7 +19,10 @@ import {PaginationComponentOptions} from '../../../shared/pagination/pagination-
|
||||
import {LdnItemfiltersService} from '../ldn-services-data/ldn-itemfilters-data.service';
|
||||
import {NgbModal} from '@ng-bootstrap/ng-bootstrap';
|
||||
|
||||
|
||||
/**
|
||||
* Angular component representing the form for creating or editing LDN services.
|
||||
* This component handles the creation, validation, and submission of LDN service data.
|
||||
*/
|
||||
@Component({
|
||||
selector: 'ds-ldn-service-form',
|
||||
templateUrl: './ldn-service-form.component.html',
|
||||
@@ -101,23 +104,43 @@ export class LdnServiceFormComponent implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets up the item filters by fetching and observing the paginated list of item filters.
|
||||
*/
|
||||
setItemfilters() {
|
||||
this.itemfiltersRD$ = this.ldnItemfiltersService.findAll().pipe(
|
||||
getFirstCompletedRemoteData());
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the form submission by opening the confirmation modal.
|
||||
*/
|
||||
onSubmit() {
|
||||
this.openConfirmModal(this.confirmModal);
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens the confirmation modal.
|
||||
*
|
||||
* @param {any} content - The content of the modal.
|
||||
*/
|
||||
openConfirmModal(content) {
|
||||
this.modalRef = this.modalService.open(content);
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens the reset form modal.
|
||||
*
|
||||
* @param {any} content - The content of the modal.
|
||||
*/
|
||||
openResetFormModal(content) {
|
||||
this.modalRef = this.modalService.open(content);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the creation of an LDN service by retrieving and validating form fields,
|
||||
* and submitting the form data to the LDN services endpoint.
|
||||
*/
|
||||
createService() {
|
||||
this.formModel.get('name').markAsTouched();
|
||||
this.formModel.get('score').markAsTouched();
|
||||
@@ -176,6 +199,12 @@ export class LdnServiceFormComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if at least one pattern in the specified form array has a value.
|
||||
*
|
||||
* @param {FormArray} formArray - The form array containing patterns to check.
|
||||
* @returns {boolean} - True if at least one pattern has a value, otherwise false.
|
||||
*/
|
||||
checkPatterns(formArray: FormArray): boolean {
|
||||
for (let i = 0; i < formArray.length; i++) {
|
||||
const pattern = formArray.at(i).get('pattern').value;
|
||||
@@ -186,37 +215,65 @@ export class LdnServiceFormComponent implements OnInit {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Closes the currently open modal and returns to the services directory..
|
||||
*/
|
||||
resetFormAndLeave() {
|
||||
this.sendBack();
|
||||
this.closeModal();
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes the currently open modal and triggers change detection.
|
||||
*/
|
||||
closeModal() {
|
||||
this.modalRef.close();
|
||||
this.cdRef.detectChanges();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new inbound pattern form group to the notifyServiceInboundPatterns form array.
|
||||
*/
|
||||
addInboundPattern() {
|
||||
const notifyServiceInboundPatternsArray = this.formModel.get('notifyServiceInboundPatterns') as FormArray;
|
||||
notifyServiceInboundPatternsArray.push(this.createInboundPatternFormGroup());
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the inbound pattern form group at the specified index from the notifyServiceInboundPatterns form array.
|
||||
*
|
||||
* @param {number} index - The index of the inbound pattern form group to remove.
|
||||
* @memberof LdnServiceFormComponent
|
||||
*/
|
||||
removeInboundPattern(index: number) {
|
||||
const notifyServiceInboundPatternsArray = this.formModel.get('notifyServiceInboundPatterns') as FormArray;
|
||||
notifyServiceInboundPatternsArray.removeAt(index);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new outbound pattern form group to the notifyServiceOutboundPatterns form array.
|
||||
*/
|
||||
addOutboundPattern() {
|
||||
const notifyServiceOutboundPatternsArray = this.formModel.get('notifyServiceOutboundPatterns') as FormArray;
|
||||
notifyServiceOutboundPatternsArray.push(this.createOutboundPatternFormGroup());
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the outbound pattern form group at the specified index from the notifyServiceOutboundPatterns form array.
|
||||
*
|
||||
* @param {number} index - The index of the outbound pattern form group to remove.
|
||||
*/
|
||||
removeOutboundPattern(index: number) {
|
||||
const notifyServiceOutboundPatternsArray = this.formModel.get('notifyServiceOutboundPatterns') as FormArray;
|
||||
notifyServiceOutboundPatternsArray.removeAt(index);
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles the value of the 'automatic' control at the specified index in the notifyServiceInboundPatterns form array.
|
||||
*
|
||||
* @param {number} i - The index of the 'automatic' control to toggle.
|
||||
* @memberof LdnServiceFormComponent
|
||||
*/
|
||||
toggleAutomatic(i: number) {
|
||||
const automaticControl = this.formModel.get(`notifyServiceInboundPatterns.${i}.automatic`);
|
||||
if (automaticControl) {
|
||||
@@ -224,7 +281,12 @@ export class LdnServiceFormComponent implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Selects an outbound pattern for a specific index in the notifyServiceOutboundPatterns form array.
|
||||
*
|
||||
* @param {string} patternValue - The selected pattern value.
|
||||
* @param {number} index - The index of the outbound pattern in the form array.
|
||||
*/
|
||||
selectOutboundPattern(patternValue: string, index: number): void {
|
||||
const patternArray = (this.formModel.get('notifyServiceOutboundPatterns') as FormArray);
|
||||
patternArray.controls[index].patchValue({pattern: patternValue});
|
||||
@@ -232,6 +294,12 @@ export class LdnServiceFormComponent implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Selects an inbound pattern for a specific index in the form array.
|
||||
*
|
||||
* @param {string} patternValue - The selected pattern value.
|
||||
* @param {number} index - The index of the inbound pattern in the form array.
|
||||
*/
|
||||
selectInboundPattern(patternValue: string, index: number): void {
|
||||
const patternArray = (this.formModel.get('notifyServiceInboundPatterns') as FormArray);
|
||||
patternArray.controls[index].patchValue({pattern: patternValue});
|
||||
@@ -239,21 +307,41 @@ export class LdnServiceFormComponent implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Selects an inbound item filter for a specific index in the form array.
|
||||
*
|
||||
* @param {string} filterValue - The selected item filter value.
|
||||
* @param {number} index - The index of the inbound item filter in the form array.
|
||||
*/
|
||||
selectInboundItemFilter(filterValue: string, index: number): void {
|
||||
const filterArray = (this.formModel.get('notifyServiceInboundPatterns') as FormArray);
|
||||
filterArray.controls[index].patchValue({constraint: filterValue});
|
||||
}
|
||||
|
||||
/**
|
||||
* Selects an outbound item filter for a specific index in the form array.
|
||||
*
|
||||
* @param {string} filterValue - The selected item filter value.
|
||||
* @param {number} index - The index of the outbound item filter in the form array.
|
||||
*/
|
||||
selectOutboundItemFilter(filterValue: string, index: number) {
|
||||
const filterArray = (this.formModel.get('notifyServiceOutboundPatterns') as FormArray);
|
||||
filterArray.controls[index].patchValue({constraint: filterValue});
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends the user back to the LDN services list.
|
||||
*/
|
||||
private sendBack() {
|
||||
this.router.navigateByUrl('admin/ldn/services');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates a form group for an outbound pattern in the notifyServiceOutboundPatterns form array.
|
||||
*
|
||||
* @private
|
||||
* @returns {FormGroup} - The created form group.
|
||||
*/
|
||||
private createOutboundPatternFormGroup(): FormGroup {
|
||||
return this.formBuilder.group({
|
||||
pattern: [''],
|
||||
@@ -262,6 +350,12 @@ export class LdnServiceFormComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a form group for an inbound pattern in the notifyServiceInboundPatterns form array.
|
||||
*
|
||||
* @private
|
||||
* @returns {FormGroup} - The created form group.
|
||||
*/
|
||||
private createInboundPatternFormGroup(): FormGroup {
|
||||
return this.formBuilder.group({
|
||||
pattern: [''],
|
||||
|
@@ -2,9 +2,13 @@ import {LdnService} from '../ldn-services-model/ldn-services.model';
|
||||
import {LDN_SERVICE} from '../ldn-services-model/ldn-service.resource-type';
|
||||
import {RemoteData} from '../../../core/data/remote-data';
|
||||
import {PaginatedList} from '../../../core/data/paginated-list.model';
|
||||
import {Observable, of} from 'rxjs';
|
||||
// Create a mock data object for a single LDN notify service
|
||||
import {Observable, of} from "rxjs";
|
||||
import {createSuccessfulRemoteDataObject$} from "../../../shared/remote-data.utils";
|
||||
|
||||
export const mockLdnService: LdnService = {
|
||||
uuid: "1",
|
||||
enabled: false,
|
||||
score: 0,
|
||||
id: 1,
|
||||
name: 'Service Name',
|
||||
description: 'Service Description',
|
||||
@@ -14,56 +18,109 @@ export const mockLdnService: LdnService = {
|
||||
{
|
||||
pattern: 'patternA',
|
||||
constraint: 'itemFilterA',
|
||||
automatic: false,
|
||||
automatic: 'false',
|
||||
},
|
||||
{
|
||||
pattern: 'patternB',
|
||||
constraint: 'itemFilterB',
|
||||
automatic: true,
|
||||
automatic: 'true',
|
||||
},
|
||||
],
|
||||
notifyServiceOutboundPatterns: [
|
||||
{
|
||||
pattern: 'patternC',
|
||||
constraint: 'itemFilterC',
|
||||
automatic: 'true',
|
||||
},
|
||||
],
|
||||
type: LDN_SERVICE,
|
||||
_links: {
|
||||
self: {
|
||||
href: 'http://localhost/api/ldn/ldnservices/1',
|
||||
href: 'http://localhost/api/ldn/ldnservices/1'
|
||||
},
|
||||
},
|
||||
get self(): string {
|
||||
return "";
|
||||
},
|
||||
};
|
||||
|
||||
export const mockLdnServiceRD$ = createSuccessfulRemoteDataObject$(mockLdnService);
|
||||
|
||||
const mockLdnServices = {
|
||||
payload: {
|
||||
elementsPerPage: 20,
|
||||
totalPages: 1,
|
||||
totalElements: 1,
|
||||
currentPage: 1,
|
||||
first: undefined,
|
||||
prev: undefined,
|
||||
next: undefined,
|
||||
last: undefined,
|
||||
page: [mockLdnService],
|
||||
type: LDN_SERVICE,
|
||||
self: undefined,
|
||||
getPageLength: function () {
|
||||
return this.page.length;
|
||||
|
||||
export const mockLdnServices: LdnService[] = [{
|
||||
uuid: "1",
|
||||
enabled: false,
|
||||
score: 0,
|
||||
id: 1,
|
||||
name: 'Service Name',
|
||||
description: 'Service Description',
|
||||
url: 'Service URL',
|
||||
ldnUrl: 'Service LDN URL',
|
||||
notifyServiceInboundPatterns: [
|
||||
{
|
||||
pattern: 'patternA',
|
||||
constraint: 'itemFilterA',
|
||||
automatic: 'false',
|
||||
},
|
||||
_links: {
|
||||
self: {
|
||||
href: 'http://localhost/api/ldn/ldnservices/1',
|
||||
},
|
||||
page: [],
|
||||
{
|
||||
pattern: 'patternB',
|
||||
constraint: 'itemFilterB',
|
||||
automatic: 'true',
|
||||
},
|
||||
],
|
||||
notifyServiceOutboundPatterns: [
|
||||
{
|
||||
pattern: 'patternC',
|
||||
constraint: 'itemFilterC',
|
||||
automatic: 'true',
|
||||
},
|
||||
],
|
||||
type: LDN_SERVICE,
|
||||
_links: {
|
||||
self: {
|
||||
href: 'http://localhost/api/ldn/ldnservices/1'
|
||||
},
|
||||
},
|
||||
hasSucceeded: true,
|
||||
msToLive: 0,
|
||||
};
|
||||
|
||||
|
||||
// Create a mock ldnServicesRD$ observable
|
||||
get self(): string {
|
||||
return "";
|
||||
},
|
||||
}, {
|
||||
uuid: "2",
|
||||
enabled: false,
|
||||
score: 0,
|
||||
id: 2,
|
||||
name: 'Service Name',
|
||||
description: 'Service Description',
|
||||
url: 'Service URL',
|
||||
ldnUrl: 'Service LDN URL',
|
||||
notifyServiceInboundPatterns: [
|
||||
{
|
||||
pattern: 'patternA',
|
||||
constraint: 'itemFilterA',
|
||||
automatic: 'false',
|
||||
},
|
||||
{
|
||||
pattern: 'patternB',
|
||||
constraint: 'itemFilterB',
|
||||
automatic: 'true',
|
||||
},
|
||||
],
|
||||
notifyServiceOutboundPatterns: [
|
||||
{
|
||||
pattern: 'patternC',
|
||||
constraint: 'itemFilterC',
|
||||
automatic: 'true',
|
||||
},
|
||||
],
|
||||
type: LDN_SERVICE,
|
||||
_links: {
|
||||
self: {
|
||||
href: 'http://localhost/api/ldn/ldnservices/1'
|
||||
},
|
||||
},
|
||||
get self(): string {
|
||||
return "";
|
||||
},
|
||||
}
|
||||
]
|
||||
export const mockLdnServicesRD$: Observable<RemoteData<PaginatedList<LdnService>>> = of((mockLdnServices as unknown) as RemoteData<PaginatedList<LdnService>>);
|
||||
|
@@ -37,10 +37,24 @@ export class LdnItemfiltersService extends IdentifiableDataService<Itemfilter> i
|
||||
this.findAllData = new FindAllDataImpl(this.linkPath, requestService, rdbService, objectCache, halService, this.responseMsToLive);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the endpoint URL for the itemfilters.
|
||||
*
|
||||
* @returns {string} - The endpoint URL.
|
||||
*/
|
||||
getEndpoint() {
|
||||
return this.halService.getEndpoint(this.linkPath);
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds all itemfilters based on the provided options and link configurations.
|
||||
*
|
||||
* @param {FindListOptions} options - The options for finding a list of itemfilters.
|
||||
* @param {boolean} useCachedVersionIfAvailable - Whether to use the cached version if available.
|
||||
* @param {boolean} reRequestOnStale - Whether to re-request the data if it's stale.
|
||||
* @param {...FollowLinkConfig<Itemfilter>[]} linksToFollow - Configurations for following specific links.
|
||||
* @returns {Observable<RemoteData<PaginatedList<Itemfilter>>>} - An observable of remote data containing a paginated list of itemfilters.
|
||||
*/
|
||||
findAll(options?: FindListOptions, useCachedVersionIfAvailable?: boolean, reRequestOnStale?: boolean, ...linksToFollow: FollowLinkConfig<Itemfilter>[]): Observable<RemoteData<PaginatedList<Itemfilter>>> {
|
||||
return this.findAllData.findAll(options, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow);
|
||||
}
|
||||
|
@@ -35,7 +35,15 @@ import {SearchDataImpl} from '../../../core/data/base/search-data';
|
||||
import {RequestParam} from '../../../core/cache/models/request-param.model';
|
||||
|
||||
/**
|
||||
* A service responsible for fetching/sending data from/to the REST API on the ldnservices endpoint
|
||||
* Injectable service responsible for fetching/sending data from/to the REST API on the ldnservices endpoint.
|
||||
*
|
||||
* @export
|
||||
* @class LdnServicesService
|
||||
* @extends {IdentifiableDataService<LdnService>}
|
||||
* @implements {FindAllData<LdnService>}
|
||||
* @implements {DeleteData<LdnService>}
|
||||
* @implements {PatchData<LdnService>}
|
||||
* @implements {CreateData<LdnService>}
|
||||
*/
|
||||
@Injectable()
|
||||
@dataService(LDN_SERVICE)
|
||||
@@ -65,41 +73,103 @@ export class LdnServicesService extends IdentifiableDataService<LdnService> impl
|
||||
this.createData = new CreateDataImpl(this.linkPath, requestService, rdbService, objectCache, halService, notificationsService, this.responseMsToLive);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates an LDN service by sending a POST request to the REST API.
|
||||
*
|
||||
* @param {LdnService} object - The LDN service object to be created.
|
||||
* @returns {Observable<RemoteData<LdnService>>} - Observable containing the result of the creation operation.
|
||||
*/
|
||||
create(object: LdnService): Observable<RemoteData<LdnService>> {
|
||||
return this.createData.create(object);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates an LDN service by applying a set of operations through a PATCH request to the REST API.
|
||||
*
|
||||
* @param {LdnService} object - The LDN service object to be updated.
|
||||
* @param {Operation[]} operations - The patch operations to be applied.
|
||||
* @returns {Observable<RemoteData<LdnService>>} - Observable containing the result of the update operation.
|
||||
*/
|
||||
patch(object: LdnService, operations: Operation[]): Observable<RemoteData<LdnService>> {
|
||||
return this.patchData.patch(object, operations);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates an LDN service by sending a PUT request to the REST API.
|
||||
*
|
||||
* @param {LdnService} object - The LDN service object to be updated.
|
||||
* @returns {Observable<RemoteData<LdnService>>} - Observable containing the result of the update operation.
|
||||
*/
|
||||
update(object: LdnService): Observable<RemoteData<LdnService>> {
|
||||
return this.patchData.update(object);
|
||||
}
|
||||
|
||||
/**
|
||||
* Commits pending updates by sending a PATCH request to the REST API.
|
||||
*
|
||||
* @param {RestRequestMethod} [method] - The HTTP method to be used for the request.
|
||||
*/
|
||||
commitUpdates(method?: RestRequestMethod): void {
|
||||
return this.patchData.commitUpdates(method);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a patch representing the changes made to the LDN service in the cache.
|
||||
*
|
||||
* @param {LdnService} object - The LDN service object for which to create the patch.
|
||||
* @returns {Observable<Operation[]>} - Observable containing the patch operations.
|
||||
*/
|
||||
createPatchFromCache(object: LdnService): Observable<Operation[]> {
|
||||
return this.patchData.createPatchFromCache(object);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves all LDN services from the REST API based on the provided options.
|
||||
*
|
||||
* @param {FindListOptions} [options] - The options to be applied to the request.
|
||||
* @param {boolean} [useCachedVersionIfAvailable] - Flag indicating whether to use cached data if available.
|
||||
* @param {boolean} [reRequestOnStale] - Flag indicating whether to re-request data if it's stale.
|
||||
* @param {...FollowLinkConfig<LdnService>[]} linksToFollow - Optional links to follow during the request.
|
||||
* @returns {Observable<RemoteData<PaginatedList<LdnService>>>} - Observable containing the result of the request.
|
||||
*/
|
||||
findAll(options?: FindListOptions, useCachedVersionIfAvailable?: boolean, reRequestOnStale?: boolean, ...linksToFollow: FollowLinkConfig<LdnService>[]): Observable<RemoteData<PaginatedList<LdnService>>> {
|
||||
return this.findAllData.findAll(options, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves LDN services based on the inbound pattern from the REST API.
|
||||
*
|
||||
* @param {string} pattern - The inbound pattern to be used in the search.
|
||||
* @param {FindListOptions} [options] - The options to be applied to the request.
|
||||
* @param {boolean} [useCachedVersionIfAvailable] - Flag indicating whether to use cached data if available.
|
||||
* @param {boolean} [reRequestOnStale] - Flag indicating whether to re-request data if it's stale.
|
||||
* @param {...FollowLinkConfig<LdnService>[]} linksToFollow - Optional links to follow during the request.
|
||||
* @returns {Observable<RemoteData<PaginatedList<LdnService>>>} - Observable containing the result of the request.
|
||||
*/
|
||||
findByInboundPattern(pattern: string, options?: FindListOptions, useCachedVersionIfAvailable?: boolean, reRequestOnStale?: boolean, ...linksToFollow: FollowLinkConfig<LdnService>[]): Observable<RemoteData<PaginatedList<LdnService>>> {
|
||||
const params = [new RequestParam('pattern', pattern)];
|
||||
const findListOptions = Object.assign(new FindListOptions(), options, {searchParams: params});
|
||||
return this.searchData.searchBy(this.findByPatternEndpoint, findListOptions, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes an LDN service by sending a DELETE request to the REST API.
|
||||
*
|
||||
* @param {string} objectId - The ID of the LDN service to be deleted.
|
||||
* @param {string[]} [copyVirtualMetadata] - Optional virtual metadata to be copied during the deletion.
|
||||
* @returns {Observable<RemoteData<NoContent>>} - Observable containing the result of the deletion operation.
|
||||
*/
|
||||
public delete(objectId: string, copyVirtualMetadata?: string[]): Observable<RemoteData<NoContent>> {
|
||||
return this.deleteData.delete(objectId, copyVirtualMetadata);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes an LDN service by its HATEOAS link.
|
||||
*
|
||||
* @param {string} href - The HATEOAS link of the LDN service to be deleted.
|
||||
* @param {string[]} [copyVirtualMetadata] - Optional virtual metadata to be copied during the deletion.
|
||||
* @returns {Observable<RemoteData<NoContent>>} - Observable containing the result of the deletion operation.
|
||||
*/
|
||||
public deleteByHref(href: string, copyVirtualMetadata?: string[]): Observable<RemoteData<NoContent>> {
|
||||
return this.deleteData.deleteByHref(href, copyVirtualMetadata);
|
||||
}
|
||||
|
@@ -1,5 +1,4 @@
|
||||
import {ComponentFixture, TestBed} from '@angular/core/testing';
|
||||
import {LdnServicesOverviewComponent} from './ldn-services-directory.component';
|
||||
import {ComponentFixture, fakeAsync, TestBed, tick} from '@angular/core/testing';
|
||||
import {ChangeDetectorRef, EventEmitter} from '@angular/core';
|
||||
import {NotificationsService} from '../../../shared/notifications/notifications.service';
|
||||
import {NotificationsServiceStub} from '../../../shared/testing/notifications-service.stub';
|
||||
@@ -9,10 +8,21 @@ import {LdnServicesService} from '../ldn-services-data/ldn-services-data.service
|
||||
import {PaginationService} from '../../../core/pagination/pagination.service';
|
||||
import {PaginationServiceStub} from '../../../shared/testing/pagination-service.stub';
|
||||
import {of} from 'rxjs';
|
||||
import {LdnService} from "../ldn-services-model/ldn-services.model";
|
||||
import {PaginatedList} from "../../../core/data/paginated-list.model";
|
||||
import {RemoteData} from "../../../core/data/remote-data";
|
||||
import {LdnServicesOverviewComponent} from './ldn-services-directory.component';
|
||||
import {createSuccessfulRemoteDataObject$} from "../../../shared/remote-data.utils";
|
||||
import {createPaginatedList} from "../../../shared/testing/utils.test";
|
||||
|
||||
describe('LdnServicesOverviewComponent', () => {
|
||||
let component: LdnServicesOverviewComponent;
|
||||
let fixture: ComponentFixture<LdnServicesOverviewComponent>;
|
||||
let ldnServicesService;
|
||||
let paginationService;
|
||||
let modalService: NgbModal;
|
||||
let notificationsService: NotificationsService;
|
||||
let translateService: TranslateService;
|
||||
|
||||
const translateServiceStub = {
|
||||
get: () => of('translated-text'),
|
||||
@@ -22,15 +32,20 @@ describe('LdnServicesOverviewComponent', () => {
|
||||
};
|
||||
|
||||
beforeEach(async () => {
|
||||
paginationService = new PaginationServiceStub();
|
||||
ldnServicesService = jasmine.createSpyObj('LdnServicesService', ['findAll', 'delete', 'patch'])
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [TranslateModule.forRoot()],
|
||||
declarations: [LdnServicesOverviewComponent],
|
||||
providers: [
|
||||
{provide: LdnServicesService, useValue: {}},
|
||||
{provide: PaginationService, useValue: new PaginationServiceStub()},
|
||||
{
|
||||
provide: LdnServicesService,
|
||||
useValue: ldnServicesService
|
||||
},
|
||||
{provide: PaginationService, useValue: paginationService},
|
||||
{
|
||||
provide: NgbModal, useValue: {
|
||||
open: () => {/*comment*/
|
||||
open: () => { /*comment*/
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -38,17 +53,92 @@ describe('LdnServicesOverviewComponent', () => {
|
||||
{provide: NotificationsService, useValue: NotificationsServiceStub},
|
||||
{provide: TranslateService, useValue: translateServiceStub},
|
||||
]
|
||||
})
|
||||
.compileComponents();
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(LdnServicesOverviewComponent);
|
||||
component = fixture.componentInstance;
|
||||
ldnServicesService = TestBed.inject(LdnServicesService);
|
||||
paginationService = TestBed.inject(PaginationService);
|
||||
modalService = TestBed.inject(NgbModal);
|
||||
notificationsService = TestBed.inject(NotificationsService);
|
||||
translateService = TestBed.inject(TranslateService);
|
||||
component.modalRef = jasmine.createSpyObj({close: null});
|
||||
component.isProcessingSub = jasmine.createSpyObj({unsubscribe: null});
|
||||
component.ldnServicesRD$ = of({} as RemoteData<PaginatedList<LdnService>>);
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
|
||||
describe('ngOnInit', () => {
|
||||
it('should call setLdnServices', fakeAsync(() => {
|
||||
spyOn(component, 'setLdnServices').and.callThrough();
|
||||
component.ngOnInit();
|
||||
tick();
|
||||
expect(component.setLdnServices).toHaveBeenCalled();
|
||||
}));
|
||||
|
||||
it('should set ldnServicesRD$ with mock data', fakeAsync(() => {
|
||||
spyOn(component, 'setLdnServices').and.callThrough();
|
||||
const testData: LdnService[] = Object.assign([new LdnService()], [
|
||||
{id: 1, name: 'Service 1', description: 'Description 1', enabled: true},
|
||||
{id: 2, name: 'Service 2', description: 'Description 2', enabled: false},
|
||||
{id: 3, name: 'Service 3', description: 'Description 3', enabled: true}]);
|
||||
|
||||
const mockLdnServicesRD = createPaginatedList(testData)
|
||||
component.ldnServicesRD$ = createSuccessfulRemoteDataObject$(mockLdnServicesRD);
|
||||
fixture.detectChanges();
|
||||
|
||||
const tableRows = fixture.debugElement.nativeElement.querySelectorAll('tbody tr');
|
||||
expect(tableRows.length).toBe(testData.length);
|
||||
const firstRowContent = tableRows[0].textContent;
|
||||
expect(firstRowContent).toContain('Service 1');
|
||||
expect(firstRowContent).toContain('Description 1');
|
||||
}));
|
||||
});
|
||||
|
||||
describe('ngOnDestroy', () => {
|
||||
it('should call paginationService.clearPagination and unsubscribe', () => {
|
||||
// spyOn(paginationService, 'clearPagination');
|
||||
// spyOn(component.isProcessingSub, 'unsubscribe');
|
||||
component.ngOnDestroy();
|
||||
expect(paginationService.clearPagination).toHaveBeenCalledWith(component.pageConfig.id);
|
||||
expect(component.isProcessingSub.unsubscribe).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
describe('openDeleteModal', () => {
|
||||
it('should open delete modal', () => {
|
||||
spyOn(modalService, 'open');
|
||||
component.openDeleteModal(component.deleteModal);
|
||||
expect(modalService.open).toHaveBeenCalledWith(component.deleteModal);
|
||||
});
|
||||
});
|
||||
|
||||
describe('closeModal', () => {
|
||||
it('should close modal and detect changes', () => {
|
||||
// spyOn(component.modalRef, 'close');
|
||||
spyOn(component.cdRef, 'detectChanges');
|
||||
component.closeModal();
|
||||
expect(component.modalRef.close).toHaveBeenCalled();
|
||||
expect(component.cdRef.detectChanges).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
describe('deleteSelected', () => {
|
||||
it('should delete selected service and update data', fakeAsync(() => {
|
||||
const serviceId = '123';
|
||||
const mockRemoteData = { /* just an empty object to retrieve as as RemoteData<PaginatedList<LdnService>> */};
|
||||
spyOn(component, 'setLdnServices').and.callThrough();
|
||||
const deleteSpy = ldnServicesService.delete.and.returnValue(of(mockRemoteData as RemoteData<PaginatedList<LdnService>>));
|
||||
component.selectedServiceId = serviceId;
|
||||
component.deleteSelected(serviceId, ldnServicesService);
|
||||
tick();
|
||||
expect(deleteSpy).toHaveBeenCalledWith(serviceId);
|
||||
}));
|
||||
});
|
||||
});
|
||||
|
@@ -24,6 +24,11 @@ import {NotificationsService} from '../../../shared/notifications/notifications.
|
||||
import {TranslateService} from '@ngx-translate/core';
|
||||
|
||||
|
||||
/**
|
||||
* The `LdnServicesOverviewComponent` is a component that provides an overview of LDN (Linked Data Notifications) services.
|
||||
* It displays a paginated list of LDN services, allows users to edit and delete services,
|
||||
* toggle the status of each service directly form the page and allows for creation of new services redirecting the user on the creation/edit form
|
||||
*/
|
||||
@Component({
|
||||
selector: 'ds-ldn-services-directory',
|
||||
templateUrl: './ldn-services-directory.component.html',
|
||||
@@ -44,14 +49,14 @@ export class LdnServicesOverviewComponent implements OnInit, OnDestroy {
|
||||
pageSize: 20
|
||||
});
|
||||
isProcessingSub: Subscription;
|
||||
private modalRef: any;
|
||||
modalRef: any;
|
||||
|
||||
|
||||
constructor(
|
||||
protected ldnServicesService: LdnServicesService,
|
||||
protected paginationService: PaginationService,
|
||||
protected modalService: NgbModal,
|
||||
private cdRef: ChangeDetectorRef,
|
||||
public cdRef: ChangeDetectorRef,
|
||||
private notificationService: NotificationsService,
|
||||
private translateService: TranslateService,
|
||||
) {
|
||||
@@ -61,12 +66,14 @@ export class LdnServicesOverviewComponent implements OnInit, OnDestroy {
|
||||
this.setLdnServices();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets up the LDN services by fetching and observing the paginated list of services.
|
||||
*/
|
||||
setLdnServices() {
|
||||
this.ldnServicesRD$ = this.paginationService.getFindListOptions(this.pageConfig.id, this.config).pipe(
|
||||
switchMap((config) => this.ldnServicesService.findAll(config, false, false).pipe(
|
||||
getFirstCompletedRemoteData()
|
||||
))
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
@@ -77,20 +84,39 @@ export class LdnServicesOverviewComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens the delete confirmation modal.
|
||||
*
|
||||
* @param {any} content - The content of the modal.
|
||||
*/
|
||||
openDeleteModal(content) {
|
||||
this.modalRef = this.modalService.open(content);
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes the currently open modal and triggers change detection.
|
||||
*/
|
||||
closeModal() {
|
||||
this.modalRef.close();
|
||||
this.cdRef.detectChanges();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the selected LDN service ID for deletion and opens the delete confirmation modal.
|
||||
*
|
||||
* @param {number} serviceId - The ID of the service to be deleted.
|
||||
*/
|
||||
selectServiceToDelete(serviceId: number) {
|
||||
this.selectedServiceId = serviceId;
|
||||
this.openDeleteModal(this.deleteModal);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes the selected LDN service.
|
||||
*
|
||||
* @param {string} serviceId - The ID of the service to be deleted.
|
||||
* @param {LdnServicesService} ldnServicesService - The service for managing LDN services.
|
||||
*/
|
||||
deleteSelected(serviceId: string, ldnServicesService: LdnServicesService): void {
|
||||
if (this.selectedServiceId !== null) {
|
||||
ldnServicesService.delete(serviceId).pipe(getFirstCompletedRemoteData()).subscribe((rd: RemoteData<LdnService>) => {
|
||||
@@ -117,7 +143,12 @@ export class LdnServicesOverviewComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Toggles the status (enabled/disabled) of an LDN service.
|
||||
*
|
||||
* @param {any} ldnService - The LDN service object.
|
||||
* @param {LdnServicesService} ldnServicesService - The service for managing LDN services.
|
||||
*/
|
||||
toggleStatus(ldnService: any, ldnServicesService: LdnServicesService): void {
|
||||
const newStatus = !ldnService.enabled;
|
||||
const originalStatus = ldnService.enabled;
|
||||
@@ -142,6 +173,4 @@ export class LdnServicesOverviewComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import {autoserialize} from 'cerialize';
|
||||
|
||||
/**
|
||||
* notify service patterns
|
||||
* A single notify service pattern and his properties
|
||||
*/
|
||||
export class NotifyServicePattern {
|
||||
@autoserialize
|
||||
|
Reference in New Issue
Block a user