CST-12498 Added last javadocs and removed console.log and comments

This commit is contained in:
Mattia Vianelli
2023-11-20 13:27:39 +01:00
parent f35e6ae0dc
commit 36778a09cb
5 changed files with 199 additions and 90 deletions

View File

@@ -21,6 +21,10 @@ import {FindListOptions} from '../../../core/data/find-list-options.model';
import {PaginationComponentOptions} from '../../../shared/pagination/pagination-component-options.model'; import {PaginationComponentOptions} from '../../../shared/pagination/pagination-component-options.model';
import {NotifyServicePattern} from "../ldn-services-model/ldn-service-patterns.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({ @Component({
selector: 'ds-ldn-service-form-edit', selector: 'ds-ldn-service-form-edit',
templateUrl: './ldn-service-form-edit.component.html', templateUrl: './ldn-service-form-edit.component.html',
@@ -109,12 +113,18 @@ export class LdnServiceFormEditComponent implements OnInit {
this.setItemfilters(); this.setItemfilters();
} }
/**
* Sets item filters using LDN item filters service
*/
setItemfilters() { setItemfilters() {
this.itemfiltersRD$ = this.ldnItemfiltersService.findAll().pipe( this.itemfiltersRD$ = this.ldnItemfiltersService.findAll().pipe(
getFirstCompletedRemoteData()); getFirstCompletedRemoteData());
} }
/**
* Fetches LDN service data by ID and updates the form
* @param serviceId - The ID of the LDN service
*/
fetchServiceData(serviceId: string): void { fetchServiceData(serviceId: string): void {
this.ldnServicesService.findById(serviceId).pipe( this.ldnServicesService.findById(serviceId).pipe(
getFirstCompletedRemoteData() getFirstCompletedRemoteData()
@@ -139,6 +149,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) { filterPatternObjectsAndPickLabel(formArrayName: string, isOutbound: boolean) {
const PatternsArray = this.formModel.get(formArrayName) as FormArray; const PatternsArray = this.formModel.get(formArrayName) as FormArray;
PatternsArray.clear(); PatternsArray.clear();
@@ -168,7 +183,10 @@ export class LdnServiceFormEditComponent implements OnInit {
} }
/**
* Generates an array of patch operations based on form changes
* @returns Array of patch operations
*/
generatePatchOperations(): any[] { generatePatchOperations(): any[] {
const patchOperations: any[] = []; const patchOperations: any[] = [];
@@ -201,44 +219,75 @@ export class LdnServiceFormEditComponent implements OnInit {
return patchOperations; return patchOperations;
} }
/**
* Submits the form by opening the confirmation modal
*/
onSubmit() { onSubmit() {
this.openConfirmModal(this.confirmModal); this.openConfirmModal(this.confirmModal);
} }
/**
* Adds a new inbound pattern form group to the array of inbound patterns in the form
*/
addInboundPattern() { addInboundPattern() {
const notifyServiceInboundPatternsArray = this.formModel.get('notifyServiceInboundPatterns') as FormArray; const notifyServiceInboundPatternsArray = this.formModel.get('notifyServiceInboundPatterns') as FormArray;
notifyServiceInboundPatternsArray.push(this.createInboundPatternFormGroup()); notifyServiceInboundPatternsArray.push(this.createInboundPatternFormGroup());
} }
/**
* Adds a new outbound pattern form group to the array of outbound patterns in the form
*/
addOutboundPattern() { addOutboundPattern() {
const notifyServiceOutboundPatternsArray = this.formModel.get('notifyServiceOutboundPatterns') as FormArray; const notifyServiceOutboundPatternsArray = this.formModel.get('notifyServiceOutboundPatterns') as FormArray;
notifyServiceOutboundPatternsArray.push(this.createOutboundPatternFormGroup()); 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 { selectOutboundPattern(patternValue: string, index: number): void {
const patternArray = (this.formModel.get('notifyServiceOutboundPatterns') as FormArray) const patternArray = (this.formModel.get('notifyServiceOutboundPatterns') as FormArray)
patternArray.controls[index].patchValue({pattern: patternValue}) patternArray.controls[index].patchValue({pattern: patternValue})
patternArray.controls[index].patchValue({patternLabel: this.translateService.instant('ldn-service.form.pattern.' + patternValue + '.label')}) patternArray.controls[index].patchValue({patternLabel: this.translateService.instant('ldn-service.form.pattern.' + patternValue + '.label')})
} }
/**
* 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) { selectOutboundItemFilter(filterValue: string, index: number) {
const filterArray = (this.formModel.get('notifyServiceOutboundPatterns') as FormArray) const filterArray = (this.formModel.get('notifyServiceOutboundPatterns') as FormArray)
filterArray.controls[index].patchValue({constraint: filterValue}) 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 { selectInboundPattern(patternValue: string, index: number): void {
const patternArray = (this.formModel.get('notifyServiceInboundPatterns') as FormArray) const patternArray = (this.formModel.get('notifyServiceInboundPatterns') as FormArray)
patternArray.controls[index].patchValue({pattern: patternValue}) patternArray.controls[index].patchValue({pattern: patternValue})
patternArray.controls[index].patchValue({patternLabel: this.translateService.instant('ldn-service.form.pattern.' + patternValue + '.label')}) 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 { selectInboundItemFilter(filterValue: string, index: number): void {
const filterArray = (this.formModel.get('notifyServiceInboundPatterns') as FormArray) const filterArray = (this.formModel.get('notifyServiceInboundPatterns') as FormArray)
filterArray.controls[index].patchValue({constraint: filterValue}) 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) { toggleAutomatic(i: number) {
const automaticControl = this.formModel.get(`notifyServiceInboundPatterns.${i}.automatic`); const automaticControl = this.formModel.get(`notifyServiceInboundPatterns.${i}.automatic`);
if (automaticControl) { if (automaticControl) {
@@ -246,6 +295,9 @@ export class LdnServiceFormEditComponent implements OnInit {
} }
} }
/**
* Toggles the enabled status of the LDN service by sending a patch request
*/
toggleEnabled() { toggleEnabled() {
const newStatus = !this.formModel.get('enabled').value; const newStatus = !this.formModel.get('enabled').value;
@@ -266,20 +318,33 @@ export class LdnServiceFormEditComponent implements OnInit {
); );
} }
/**
* Closes the modal
*/
closeModal() { closeModal() {
this.modalRef.close(); this.modalRef.close();
this.cdRef.detectChanges(); this.cdRef.detectChanges();
} }
/**
* Opens a confirmation modal with the specified content
* @param content - The content to be displayed in the modal
*/
openConfirmModal(content) { openConfirmModal(content) {
this.modalRef = this.modalService.open(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) { openResetFormModal(content) {
this.modalRef = this.modalService.open(content); this.modalRef = this.modalService.open(content);
} }
/**
* Patches the LDN service by retrieving and sending patch operations geenrated in generatePatchOperations()
*/
patchService() { patchService() {
this.deleteMarkedInboundPatterns(); this.deleteMarkedInboundPatterns();
this.deleteMarkedOutboundPatterns(); this.deleteMarkedOutboundPatterns();
@@ -304,17 +369,28 @@ export class LdnServiceFormEditComponent implements OnInit {
}); });
} }
/**
* Resets the form and navigates back to the LDN services page
*/
resetFormAndLeave() { resetFormAndLeave() {
this.sendBack(); this.sendBack();
this.closeModal(); this.closeModal();
} }
/**
* Marks the specified inbound pattern for deletion
* @param index - The index of the inbound pattern in the array
*/
markForInboundPatternDeletion(index: number) { markForInboundPatternDeletion(index: number) {
if (!this.markedForDeletionInboundPattern.includes(index)) { if (!this.markedForDeletionInboundPattern.includes(index)) {
this.markedForDeletionInboundPattern.push(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) { unmarkForInboundPatternDeletion(index: number) {
const i = this.markedForDeletionInboundPattern.indexOf(index); const i = this.markedForDeletionInboundPattern.indexOf(index);
if (i !== -1) { if (i !== -1) {
@@ -322,19 +398,29 @@ 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) { markForOutboundPatternDeletion(index: number) {
if (!this.markedForDeletionOutboundPattern.includes(index)) { if (!this.markedForDeletionOutboundPattern.includes(index)) {
this.markedForDeletionOutboundPattern.push(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) { unmarkForOutboundPatternDeletion(index: number) {
const i = this.markedForDeletionOutboundPattern.indexOf(index); const i = this.markedForDeletionOutboundPattern.indexOf(index);
if (i !== -1) { if (i !== -1) {
this.markedForDeletionOutboundPattern.splice(i, 1); this.markedForDeletionOutboundPattern.splice(i, 1);
} }
} }
/**
* Deletes marked inbound patterns from the form model
*/
deleteMarkedInboundPatterns() { deleteMarkedInboundPatterns() {
this.markedForDeletionInboundPattern.sort((a, b) => b - a); this.markedForDeletionInboundPattern.sort((a, b) => b - a);
const patternsArray = this.formModel.get('notifyServiceInboundPatterns') as FormArray; const patternsArray = this.formModel.get('notifyServiceInboundPatterns') as FormArray;
@@ -354,7 +440,9 @@ export class LdnServiceFormEditComponent implements OnInit {
this.markedForDeletionInboundPattern = []; this.markedForDeletionInboundPattern = [];
} }
/**
* Deletes marked outbound patterns from the form model
*/
deleteMarkedOutboundPatterns() { deleteMarkedOutboundPatterns() {
this.markedForDeletionOutboundPattern.sort((a, b) => b - a); this.markedForDeletionOutboundPattern.sort((a, b) => b - a);
const patternsArray = this.formModel.get('notifyServiceOutboundPatterns') as FormArray; const patternsArray = this.formModel.get('notifyServiceOutboundPatterns') as FormArray;
@@ -375,7 +463,12 @@ export class LdnServiceFormEditComponent implements OnInit {
this.markedForDeletionOutboundPattern = []; 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 { private createReplaceOperation(patchOperations: any[], formControlName: string, path: string): void {
if (this.formModel.get(formControlName).dirty) { if (this.formModel.get(formControlName).dirty) {
patchOperations.push({ patchOperations.push({
@@ -386,6 +479,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 { private handlePatterns(patchOperations: any[], formArrayName: string): void {
const patternsArray = this.formModel.get(formArrayName) as FormArray const patternsArray = this.formModel.get(formArrayName) as FormArray
@@ -416,10 +514,17 @@ export class LdnServiceFormEditComponent implements OnInit {
} }
} }
/**
* Navigates back to the LDN services page
*/
private sendBack() { private sendBack() {
this.router.navigateByUrl('admin/ldn/services'); this.router.navigateByUrl('admin/ldn/services');
} }
/**
* Creates a form group for outbound patterns
* @returns The form group for outbound patterns
*/
private createOutboundPatternFormGroup(): FormGroup { private createOutboundPatternFormGroup(): FormGroup {
return this.formBuilder.group({ return this.formBuilder.group({
pattern: '', pattern: '',
@@ -429,6 +534,10 @@ export class LdnServiceFormEditComponent implements OnInit {
}); });
} }
/**
* Creates a form group for inbound patterns
* @returns The form group for inbound patterns
*/
private createInboundPatternFormGroup(): FormGroup { private createInboundPatternFormGroup(): FormGroup {
return this.formBuilder.group({ return this.formBuilder.group({
pattern: '', pattern: '',
@@ -439,6 +548,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 { private initializeOutboundPatternFormGroup(): FormGroup {
return this.formBuilder.group({ return this.formBuilder.group({
pattern: '', pattern: '',
@@ -447,6 +560,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 { private initializeInboundPatternFormGroup(): FormGroup {
return this.formBuilder.group({ return this.formBuilder.group({
pattern: '', pattern: '',

View File

@@ -44,8 +44,6 @@ export const mockLdnService: LdnService = {
}, },
}; };
//export const mockLdnServiceRD$: Observable<RemoteData<PaginatedList<LdnService>>> = of((mockLdnService as unknown) as RemoteData<PaginatedList<LdnService>>);
//export const mockLdnServiceRD$ = createSuccessfulRemoteDataObject$(createPaginatedList(mockLdnService[0])as PaginatedList<LdnService>);
export const mockLdnServiceRD$ = createSuccessfulRemoteDataObject$(mockLdnService); export const mockLdnServiceRD$ = createSuccessfulRemoteDataObject$(mockLdnService);
@@ -126,62 +124,3 @@ export const mockLdnServices: LdnService[] = [{
} }
] ]
export const mockLdnServicesRD$: Observable<RemoteData<PaginatedList<LdnService>>> = of((mockLdnServices as unknown) as RemoteData<PaginatedList<LdnService>>); export const mockLdnServicesRD$: Observable<RemoteData<PaginatedList<LdnService>>> = of((mockLdnServices as unknown) as RemoteData<PaginatedList<LdnService>>);
/*export const mockLdnServiceRD$: RemoteData<PaginatedList<LdnService>> = {
errorMessage: null,
lastUpdated: 1700176600821,
msToLive: 900000,
payload: {
page: [mockLdnService],
pageInfo: {
elementsPerPage: 20,
totalPages: 1,
totalElements: 1,
currentPage: 1,
},
type: {value: "paginated-list"},
_links: {
self: {
href: "http://localhost:8080/server/api/ldn/ldnservices?size=20&sort=dc.title,ASC"
},
page: [
{
"href": "http://localhost/api/ldn/ldnservices/1"
}
]
},
},
statusCode: 200,
state: 'Success',
timeCompleted: 1700176600821,
}*/
const mockLdnServices2 = {
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;
},
_links: {
self: {
href: 'http://localhost/api/ldn/ldnservices/1',
},
page: [],
},
},
hasSucceeded: true,
msToLive: 0,
};

View File

@@ -35,7 +35,15 @@ import {SearchDataImpl} from '../../../core/data/base/search-data';
import {RequestParam} from '../../../core/cache/models/request-param.model'; 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() @Injectable()
@dataService(LDN_SERVICE) @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); 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>> { create(object: LdnService): Observable<RemoteData<LdnService>> {
return this.createData.create(object); 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>> { patch(object: LdnService, operations: Operation[]): Observable<RemoteData<LdnService>> {
return this.patchData.patch(object, operations); 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>> { update(object: LdnService): Observable<RemoteData<LdnService>> {
return this.patchData.update(object); 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 { commitUpdates(method?: RestRequestMethod): void {
return this.patchData.commitUpdates(method); 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[]> { createPatchFromCache(object: LdnService): Observable<Operation[]> {
return this.patchData.createPatchFromCache(object); 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>>> { findAll(options?: FindListOptions, useCachedVersionIfAvailable?: boolean, reRequestOnStale?: boolean, ...linksToFollow: FollowLinkConfig<LdnService>[]): Observable<RemoteData<PaginatedList<LdnService>>> {
return this.findAllData.findAll(options, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow); 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>>> { findByInboundPattern(pattern: string, options?: FindListOptions, useCachedVersionIfAvailable?: boolean, reRequestOnStale?: boolean, ...linksToFollow: FollowLinkConfig<LdnService>[]): Observable<RemoteData<PaginatedList<LdnService>>> {
const params = [new RequestParam('pattern', pattern)]; const params = [new RequestParam('pattern', pattern)];
const findListOptions = Object.assign(new FindListOptions(), options, {searchParams: params}); const findListOptions = Object.assign(new FindListOptions(), options, {searchParams: params});
return this.searchData.searchBy(this.findByPatternEndpoint, findListOptions, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow); 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>> { public delete(objectId: string, copyVirtualMetadata?: string[]): Observable<RemoteData<NoContent>> {
return this.deleteData.delete(objectId, copyVirtualMetadata); 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>> { public deleteByHref(href: string, copyVirtualMetadata?: string[]): Observable<RemoteData<NoContent>> {
return this.deleteData.deleteByHref(href, copyVirtualMetadata); return this.deleteData.deleteByHref(href, copyVirtualMetadata);
} }

View File

@@ -22,7 +22,6 @@ 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 {NotificationsService} from '../../../shared/notifications/notifications.service';
import {TranslateService} from '@ngx-translate/core'; import {TranslateService} from '@ngx-translate/core';
import { mockLdnServiceRD$ } from "../ldn-service-serviceMock/ldnServicesRD$-mock";
/** /**
@@ -42,9 +41,6 @@ export class LdnServicesOverviewComponent implements OnInit, OnDestroy {
servicesData: any[] = []; servicesData: any[] = [];
@ViewChild('deleteModal', {static: true}) deleteModal: TemplateRef<any>; @ViewChild('deleteModal', {static: true}) deleteModal: TemplateRef<any>;
ldnServicesRD$: Observable<RemoteData<PaginatedList<LdnService>>>; ldnServicesRD$: Observable<RemoteData<PaginatedList<LdnService>>>;
//TODO: remove mocks an put in test after finishing
//mockLdnServiceRD$: Observable<RemoteData<LdnService>>;
// mockLdnServicesRD$: Observable<RemoteData<PaginatedList<LdnService>>>;
config: FindListOptions = Object.assign(new FindListOptions(), { config: FindListOptions = Object.assign(new FindListOptions(), {
elementsPerPage: 20 elementsPerPage: 20
}); });
@@ -79,20 +75,7 @@ export class LdnServicesOverviewComponent implements OnInit, OnDestroy {
switchMap((config) => this.ldnServicesService.findAll(config, false, false).pipe( switchMap((config) => this.ldnServicesService.findAll(config, false, false).pipe(
getFirstCompletedRemoteData() getFirstCompletedRemoteData()
)) ))
);
);/*
this.mockLdnServiceRD$ = mockLdnServiceRD$
this.mockLdnServicesRD$ = this.paginationService.getFindListOptions(this.pageConfig.id, this.config).pipe(
switchMap((config) => this.ldnServicesService.findAll(config, false, false).pipe(
getFirstCompletedRemoteData()
))
);this.paginationService.getFindListOptions(this.pageConfig.id, this.config)
this.ldnServicesRD$.subscribe((rd: RemoteData<PaginatedList<LdnService>>) => {console.log('realremotedata:',rd);})
this.mockLdnServiceRD$.subscribe((rd: RemoteData<LdnService>) => {console.log('mockremotedata:',rd);})
this.mockLdnServicesRD$.subscribe((rd: RemoteData<PaginatedList<LdnService>>) => {console.log('mockremotedata[ldnservice]:',rd);})*/
} }
ngOnDestroy(): void { ngOnDestroy(): void {

View File

@@ -1,7 +1,7 @@
import {autoserialize} from 'cerialize'; import {autoserialize} from 'cerialize';
/** /**
* notify service patterns * A single notify service pattern and his properties
*/ */
export class NotifyServicePattern { export class NotifyServicePattern {
@autoserialize @autoserialize