From ab835e904ebac8cd9132513cb98b7982b38924d5 Mon Sep 17 00:00:00 2001 From: Willem Dantuma Date: Sat, 31 Oct 2020 11:45:03 +0100 Subject: [PATCH] Fix routes --- .../src/fm-map/common-map-routing.module.ts | 24 +++-------- .../src/fm-map/common-map.module.ts | 41 ++++++++----------- .../fm-map/components/map/map.component.ts | 12 +++--- 3 files changed, 30 insertions(+), 47 deletions(-) diff --git a/projects/common-map/src/fm-map/common-map-routing.module.ts b/projects/common-map/src/fm-map/common-map-routing.module.ts index f92d534..dc30dff 100644 --- a/projects/common-map/src/fm-map/common-map-routing.module.ts +++ b/projects/common-map/src/fm-map/common-map-routing.module.ts @@ -5,28 +5,16 @@ import { AuthGuard } from '@farmmaps/common'; const routes = [ { - path: '', children: [ - { - path: '', - component: MapComponent - } - ] + path: '', + component: MapComponent }, { - path: ':xCenter/:yCenter/:zoom/:rotation/:baseLayer/:queryState', children: [ - { - path: '', - component: MapComponent - } - ] + path: ':xCenter/:yCenter/:zoom/:rotation/:baseLayer/:queryState', + component: MapComponent }, { - path: ':queryState', children: [ - { - path: '', - component: MapComponent - } - ] + path: ':queryState', + component: MapComponent } ]; diff --git a/projects/common-map/src/fm-map/common-map.module.ts b/projects/common-map/src/fm-map/common-map.module.ts index 45bd227..3115ed8 100644 --- a/projects/common-map/src/fm-map/common-map.module.ts +++ b/projects/common-map/src/fm-map/common-map.module.ts @@ -251,31 +251,26 @@ export { FeatureListCropfieldComponent, FeatureListFeatureContainerComponent, ZoomToExtentComponent + ], + providers: [ + FeatureIconService, + GeolocationService, + DeviceOrientationService, + { provide: AbstractFeatureListComponent, useClass: FeatureListCroppingschemeComponent, multi: true }, + { provide: AbstractFeatureListComponent, useClass: FeatureListCropfieldComponent, multi: true }, + { provide: AbstractFeatureListFeatureComponent, useClass: FeatureListFeatureComponent, multi: true }, + { provide: AbstractFeatureListFeatureComponent, useClass: FeatureListFeatureCroppingschemeComponent, multi: true }, + { provide: AbstractFeatureListFeatureComponent, useClass: FeatureListFeatureCropfieldComponent, multi: true }, + { provide: AbstractSelectedItemComponent, useClass: SelectedItemComponent, multi: true }, + { provide: AbstractSelectedItemComponent, useClass: SelectedItemCropfieldComponent, multi: true }, + { provide: AbstractSelectedItemComponent, useClass: SelectedItemGeotiffComponent, multi: true }, + { provide: AbstractSelectedItemComponent, useClass: SelectedItemTemporalComponent, multi: true }, + { provide: AbstractSelectedItemComponent, useClass: SelectedItemShapeComponent, multi: true }, + { provide: AbstractItemListItemComponent, useClass: ItemListItemComponent, multi: true }, + { provide: AbstractItemListComponent, useClass: ItemListComponent, multi: true } ] }) -export class AppCommonMapModule { - static forRoot(): ModuleWithProviders { - return { - ngModule: AppCommonMapModule, - providers: [ - FeatureIconService, - GeolocationService, - DeviceOrientationService, - { provide: AbstractFeatureListComponent, useClass: FeatureListCroppingschemeComponent, multi: true }, - { provide: AbstractFeatureListComponent, useClass: FeatureListCropfieldComponent, multi: true }, - { provide: AbstractFeatureListFeatureComponent, useClass: FeatureListFeatureComponent, multi: true }, - { provide: AbstractFeatureListFeatureComponent, useClass: FeatureListFeatureCroppingschemeComponent, multi: true }, - { provide: AbstractFeatureListFeatureComponent, useClass: FeatureListFeatureCropfieldComponent, multi: true }, - { provide: AbstractSelectedItemComponent, useClass: SelectedItemComponent, multi: true }, - { provide: AbstractSelectedItemComponent, useClass: SelectedItemCropfieldComponent, multi: true }, - { provide: AbstractSelectedItemComponent, useClass: SelectedItemGeotiffComponent, multi: true }, - { provide: AbstractSelectedItemComponent, useClass: SelectedItemTemporalComponent, multi: true }, - { provide: AbstractSelectedItemComponent, useClass: SelectedItemShapeComponent, multi: true }, - { provide: AbstractItemListItemComponent, useClass: ItemListItemComponent, multi: true }, - { provide: AbstractItemListComponent, useClass: ItemListComponent, multi: true } - ] - }; - } +export class AppCommonMapModule { } diff --git a/projects/common-map/src/fm-map/components/map/map.component.ts b/projects/common-map/src/fm-map/components/map/map.component.ts index 5f3be61..0368cf3 100644 --- a/projects/common-map/src/fm-map/components/map/map.component.ts +++ b/projects/common-map/src/fm-map/components/map/map.component.ts @@ -81,7 +81,6 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit { public styles$:Observable = this.store.select(mapReducers.selectGetStyles); private lastUrl = ""; private initialized: boolean = false; - private rootItems: Observable = this.store.select(commonReducers.getRootItems); @ViewChild('map') map; @@ -123,11 +122,12 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit { } } }); - this.rootItems.subscribe((l) => { - if(l && l.length>0) { - this.store.dispatch(new mapActions.Init()); - } - }); + this.store.dispatch(new mapActions.Init()); + // this.store.select(commonReducers.getRootItems).subscribe((l) => { + // if(l && l.length>0) { + // this.store.dispatch(new mapActions.Init()); + // } + // }); } @HostListener('document:keyup', ['$event'])