From 579230200abc3f24c375a4363980ae65b607e14a Mon Sep 17 00:00:00 2001 From: Florent Gravin Date: Fri, 8 Sep 2023 14:12:34 +0200 Subject: [PATCH 1/2] fix(wc): add missing dependencies AuthService and BrowserDynamicModule --- apps/webcomponents/src/app/webcomponents.module.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/apps/webcomponents/src/app/webcomponents.module.ts b/apps/webcomponents/src/app/webcomponents.module.ts index d5274d25eb..452151d851 100644 --- a/apps/webcomponents/src/app/webcomponents.module.ts +++ b/apps/webcomponents/src/app/webcomponents.module.ts @@ -32,6 +32,8 @@ import { FeatureMapModule } from '@geonetwork-ui/feature/map' import { GnDatasetViewChartComponent } from './components/gn-dataset-view-chart/gn-dataset-view-chart.component' import { FeatureDatavizModule } from '@geonetwork-ui/feature/dataviz' import { EmbeddedTranslateLoader } from '@geonetwork-ui/util/i18n' +import { FeatureAuthModule } from '@geonetwork-ui/feature/auth' +import { BrowserAnimationsModule } from '@angular/platform-browser/animations' const CUSTOM_ELEMENTS: [new (...args) => BaseComponent, string][] = [ [GnFacetsComponent, 'gn-facets'], @@ -78,6 +80,8 @@ const CUSTOM_ELEMENTS: [new (...args) => BaseComponent, string][] = [ }), MatIconModule, FeatureDatavizModule, + FeatureAuthModule, + BrowserAnimationsModule, ], providers: [ { From a61361c6e36c4ca94b0ccd0267009ad5c12aca6c Mon Sep 17 00:00:00 2001 From: Florent Gravin Date: Fri, 8 Sep 2023 14:14:54 +0200 Subject: [PATCH 2/2] fix(wc): remove gn4API service call during service initialization For web components, the API_URL is not defined yet during Angular Service initialization. Use cold Observable instead to avoid calling an API while not subscribed yet --- .../organizations-from-metadata.service.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libs/api/repository/src/lib/gn4/organizations/organizations-from-metadata.service.ts b/libs/api/repository/src/lib/gn4/organizations/organizations-from-metadata.service.ts index 9c4441c323..20b79e78c9 100644 --- a/libs/api/repository/src/lib/gn4/organizations/organizations-from-metadata.service.ts +++ b/libs/api/repository/src/lib/gn4/organizations/organizations-from-metadata.service.ts @@ -53,14 +53,16 @@ interface IncompleteOrganization { export class OrganizationsFromMetadataService implements OrganizationsServiceInterface { - geonetworkVersion$ = this.siteApiService.getSiteOrPortalDescription().pipe( + geonetworkVersion$ = of(true).pipe( + switchMap(() => this.siteApiService.getSiteOrPortalDescription()), map((info) => info['system/platform/version']), shareReplay(1) ) - private groups$: Observable = this.groupsApiService - .getGroups() - .pipe(shareReplay()) + private groups$: Observable = of(true).pipe( + switchMap(() => this.groupsApiService.getGroups()), + shareReplay() + ) private organisationsAggs$: Observable = this.geonetworkVersion$.pipe( switchMap((version) =>