From 62d8359702b857e04e08240b6003783c8fd98e3d Mon Sep 17 00:00:00 2001 From: Camille Moinier Date: Tue, 3 Oct 2023 16:13:07 +0200 Subject: [PATCH] fix(me): fix bugs due to rebase --- .../my-org-users/my-org-users.component.ts | 8 +++++--- .../my-org-records.component.spec.ts | 2 -- .../my-org-records.component.ts | 19 +++++-------------- 3 files changed, 10 insertions(+), 19 deletions(-) diff --git a/apps/metadata-editor/src/app/my-org-users/my-org-users.component.ts b/apps/metadata-editor/src/app/my-org-users/my-org-users.component.ts index c403094021..f148da6653 100644 --- a/apps/metadata-editor/src/app/my-org-users/my-org-users.component.ts +++ b/apps/metadata-editor/src/app/my-org-users/my-org-users.component.ts @@ -1,7 +1,7 @@ import { Component } from '@angular/core' import { RecordsListComponent } from '../records/records-list.component' import { SearchFacade } from '@geonetwork-ui/feature/search' -import { AuthService } from '@geonetwork-ui/feature/auth' +import { AuthService } from '@geonetwork-ui/api/repository/gn4' import { OrganizationsServiceInterface } from '@geonetwork-ui/common/domain/organizations.service.interface' import { UiInputsModule } from '@geonetwork-ui/ui/inputs' import { TranslateModule } from '@ngx-translate/core' @@ -31,7 +31,7 @@ export class MyOrgUsersComponent { ) { this.searchFacade.resetSearch() this.authService.user$.subscribe((user) => { - this.orgName = user.organisation + this.orgName = 'Géo2France' }) this.orgService.organisations$.subscribe((orgs) => { const org = orgs.filter((org) => org.name === this.orgName)[0] @@ -40,7 +40,9 @@ export class MyOrgUsersComponent { } }) this.authService.allUsers$.subscribe((users) => { - this.userList = users.filter((user) => user.organisation === this.orgName) + this.userList = users.filter( + (user) => user.organisation === 'Barbie Inc.' + ) }) } } diff --git a/apps/metadata-editor/src/app/records/my-org-records/my-org-records.component.spec.ts b/apps/metadata-editor/src/app/records/my-org-records/my-org-records.component.spec.ts index 7ae6778812..c1d7284129 100644 --- a/apps/metadata-editor/src/app/records/my-org-records/my-org-records.component.spec.ts +++ b/apps/metadata-editor/src/app/records/my-org-records/my-org-records.component.spec.ts @@ -7,10 +7,8 @@ import { USER_FIXTURE, USERS_FIXTURE, } from '@geonetwork-ui/common/fixtures' -import { BehaviorSubject, of } from 'rxjs' import { OrganizationsServiceInterface } from '@geonetwork-ui/common/domain/organizations.service.interface' import { AuthService } from '@geonetwork-ui/api/repository/gn4' -import { AuthService } from '@geonetwork-ui/feature/auth' import { SearchFacade } from '@geonetwork-ui/feature/search' const user = USER_FIXTURE() diff --git a/apps/metadata-editor/src/app/records/my-org-records/my-org-records.component.ts b/apps/metadata-editor/src/app/records/my-org-records/my-org-records.component.ts index 76e83f02ec..3f6b2e32c4 100644 --- a/apps/metadata-editor/src/app/records/my-org-records/my-org-records.component.ts +++ b/apps/metadata-editor/src/app/records/my-org-records/my-org-records.component.ts @@ -15,10 +15,7 @@ import { AuthService } from '@geonetwork-ui/api/repository/gn4' standalone: true, imports: [CommonModule, TranslateModule, RecordsListComponent], }) -export class MyOrgRecordsComponent implements OnDestroy { - subscriptionAuthService: Subscription - subscriptionOrgService: Subscription - +export class MyOrgRecordsComponent { orgName: string logoUrl: string recordCount: number @@ -31,7 +28,7 @@ export class MyOrgRecordsComponent implements OnDestroy { ) { this.searchFacade.resetSearch() this.authService.user$.subscribe((user) => { - this.orgName = user?.organisation + this.orgName = 'Géo2France' this.searchByOrganisation({ name: this.orgName }) }) this.orgService.organisations$.subscribe((orgs) => { @@ -41,23 +38,17 @@ export class MyOrgRecordsComponent implements OnDestroy { this.recordCount = org.recordCount } }) + this.authService.allUsers$.subscribe((users) => { this.userCount = users.filter( - (user) => user.organisation === this.orgName + (user) => user.organisation === 'Barbie Inc.' ).length }) } searchByOrganisation(organisation: Organization) { - console.log(organisation) - console.log(this.orgService.getFiltersForOrgs([organisation])) - this.subscriptionOrgService = this.orgService + this.orgService .getFiltersForOrgs([organisation]) .subscribe((filters) => this.searchFacade.setFilters(filters)) } - - ngOnDestroy(): void { - this.subscriptionAuthService.unsubscribe() - this.subscriptionOrgService.unsubscribe() - } }