diff --git a/alfa-client/libs/admin/settings/src/lib/organisationseinheit/organisationseinheit-container/organisationseinheit-container.component.ts b/alfa-client/libs/admin/settings/src/lib/organisationseinheit/organisationseinheit-container/organisationseinheit-container.component.ts index fa7e4dcaa5331be06a5053b3bfeb0315991f513e..ca1097d75771a13f6ff1af77edf30cb55b83c8d5 100644 --- a/alfa-client/libs/admin/settings/src/lib/organisationseinheit/organisationseinheit-container/organisationseinheit-container.component.ts +++ b/alfa-client/libs/admin/settings/src/lib/organisationseinheit/organisationseinheit-container/organisationseinheit-container.component.ts @@ -18,5 +18,5 @@ export class OrganisationsEinheitContainerComponent implements OnInit { this.organisationsEinheitListStateResource$ = this.organisationsEinheitService.getList(); } - protected readonly organisationsEinheitListLinkRel = OrganisationsEinheitListLinkRel; + public readonly organisationsEinheitListLinkRel = OrganisationsEinheitListLinkRel; } diff --git a/alfa-client/libs/admin/settings/src/lib/organisationseinheit/organisationseinheit-container/organisationseinheit-list/organisationseinheit-list.component.html b/alfa-client/libs/admin/settings/src/lib/organisationseinheit/organisationseinheit-container/organisationseinheit-list/organisationseinheit-list.component.html index 0887f0c89c94d726f6f0c2056c437977f5e2e6f9..9d95617c210484008aa836d6894cdcfbdb4e19e9 100644 --- a/alfa-client/libs/admin/settings/src/lib/organisationseinheit/organisationseinheit-container/organisationseinheit-list/organisationseinheit-list.component.html +++ b/alfa-client/libs/admin/settings/src/lib/organisationseinheit/organisationseinheit-container/organisationseinheit-list/organisationseinheit-list.component.html @@ -1,7 +1,7 @@ <ods-list *ngIf="organisationsEinheitResources.length > 0" data-test-id="organisations-einheit-list"> <ods-list-item *ngFor="let organisationsEinheitResource of organisationsEinheitResources" - [routerLink]="getEncodedSelfLink(organisationsEinheitResource)" + [routerLink]="organisationsEinheitResource | toResourceUri: OrganisationsEinheitLinkRel.SELF" [class.text-red-500]=" organisationsEinheitResource.syncResult === AdminOrganisationsEinheitSyncResult.NOT_FOUND_IN_PVOG || organisationsEinheitResource.syncResult === AdminOrganisationsEinheitSyncResult.ORGANISATIONSEINHEIT_ID_NOT_UNIQUE diff --git a/alfa-client/libs/admin/settings/src/lib/organisationseinheit/organisationseinheit-container/organisationseinheit-list/organisationseinheit-list.component.spec.ts b/alfa-client/libs/admin/settings/src/lib/organisationseinheit/organisationseinheit-container/organisationseinheit-list/organisationseinheit-list.component.spec.ts index 3a7d8487416e4ca5319f29e07a2a93ec71400371..9a7b6e13c5e495b577e041b755b49e2d871d4cb3 100644 --- a/alfa-client/libs/admin/settings/src/lib/organisationseinheit/organisationseinheit-container/organisationseinheit-list/organisationseinheit-list.component.spec.ts +++ b/alfa-client/libs/admin/settings/src/lib/organisationseinheit/organisationseinheit-container/organisationseinheit-list/organisationseinheit-list.component.spec.ts @@ -10,7 +10,6 @@ import { import { ComponentFixture, TestBed } from '@angular/core/testing'; import { MatTooltipModule } from '@angular/material/tooltip'; import { ActivatedRoute } from '@angular/router'; -import { ResourceUri } from '@ngxp/rest'; import { ExclamationIconComponent, ListComponent, ListItemComponent } from '@ods/system'; import { getDataTestIdOf } from 'libs/tech-shared/test/data-test'; import { MockModule } from 'ng-mocks'; @@ -25,6 +24,7 @@ describe('OrganisationsEinheitListComponent', () => { const listItemSelector: string = getDataTestIdOf('organisations-einheit-list-item'); const organisationsEinheitResource: AdminOrganisationsEinheitResource = createAdminOrganisationsEinheitResource(); + organisationsEinheitResource.syncResult = AdminOrganisationsEinheitSyncResult.NOT_FOUND_IN_PVOG; beforeEach(async () => { await TestBed.configureTestingModule({ @@ -49,8 +49,6 @@ describe('OrganisationsEinheitListComponent', () => { describe('input', () => { describe('organisationsEinheitResources', () => { - organisationsEinheitResource.syncResult = AdminOrganisationsEinheitSyncResult.NOT_FOUND_IN_PVOG; - let listItemElement: HTMLElement; let nameElement: Element; let idElement: Element; @@ -108,15 +106,6 @@ describe('OrganisationsEinheitListComponent', () => { expect(component.organisationsEinheitResources[2].isChild).toBeTruthy(); }); }); - - describe('getEncodedSelfLink', () => { - it('should return encoded self link', () => { - const organisationsEinheitResource: AdminOrganisationsEinheitResource = createAdminOrganisationsEinheitResource(); - const result: ResourceUri = component.getEncodedSelfLink(organisationsEinheitResource); - - expect(result).toBeDefined(); - }); - }); }); describe('template', () => { diff --git a/alfa-client/libs/admin/settings/src/lib/organisationseinheit/organisationseinheit-container/organisationseinheit-list/organisationseinheit-list.component.ts b/alfa-client/libs/admin/settings/src/lib/organisationseinheit/organisationseinheit-container/organisationseinheit-list/organisationseinheit-list.component.ts index 0c532ac0041273d0ffbe8476e455eaea4fe62a1c..390737c28a28a76edc10fa6fe8b9e44519270239 100644 --- a/alfa-client/libs/admin/settings/src/lib/organisationseinheit/organisationseinheit-container/organisationseinheit-list/organisationseinheit-list.component.ts +++ b/alfa-client/libs/admin/settings/src/lib/organisationseinheit/organisationseinheit-container/organisationseinheit-list/organisationseinheit-list.component.ts @@ -1,7 +1,5 @@ import { AdminOrganisationsEinheitResource, AdminOrganisationsEinheitSyncResult } from '@admin-client/admin-settings'; -import { encodeUrlForEmbedding, toResourceUri } from '@alfa-client/tech-shared'; import { Component, Input } from '@angular/core'; -import { ResourceUri } from '@ngxp/rest'; import { OrganisationsEinheitLinkRel } from '../../organisations-einheit.linkrel'; @Component({ @@ -20,10 +18,8 @@ export class OrganisationsEinheitListComponent { this.moveChildrenIntoParentLevel(list); } - public readonly AdminOrganisationsEinheitSyncResult = AdminOrganisationsEinheitSyncResult; - moveChildrenIntoParentLevel(list: AdminOrganisationsEinheitResource[]): void { - list.forEach((parent) => { + list.forEach((parent: AdminOrganisationsEinheitResource) => { this._organisationsEinheitResources.push(parent); if (parent._embedded && Array.isArray(parent._embedded.childList)) { @@ -35,8 +31,6 @@ export class OrganisationsEinheitListComponent { }); } - getEncodedSelfLink(organisationsEinheitResource: AdminOrganisationsEinheitResource): ResourceUri { - const resourceUri: ResourceUri = toResourceUri(organisationsEinheitResource, OrganisationsEinheitLinkRel.SELF); - return encodeUrlForEmbedding(resourceUri); - } + public readonly AdminOrganisationsEinheitSyncResult = AdminOrganisationsEinheitSyncResult; + public readonly OrganisationsEinheitLinkRel = OrganisationsEinheitLinkRel; } diff --git a/alfa-client/libs/tech-shared/src/lib/resource/resource.service.ts b/alfa-client/libs/tech-shared/src/lib/resource/resource.service.ts index 8b88355c613425c12bd7dfdf4e4006561a15e290..a19ce64d7eaaa7d7163636dae46701ebf3b7aa00 100644 --- a/alfa-client/libs/tech-shared/src/lib/resource/resource.service.ts +++ b/alfa-client/libs/tech-shared/src/lib/resource/resource.service.ts @@ -120,11 +120,11 @@ export abstract class ResourceService<B extends Resource, T extends Resource> { } public save(toSave: unknown): Observable<StateResource<T>> { - return this.persist(this.doSave, toSave); + return this.persist(this.doSave.bind(this), toSave); } public patch(toPatch: unknown): Observable<StateResource<T>> { - return this.persist(this.doPatch, toPatch); + return this.persist(this.doPatch.bind(this), toPatch); } private persist(