Skip to content

Commit

Permalink
put map config as injection tokens in ui/map
Browse files Browse the repository at this point in the history
  • Loading branch information
jahow committed Jul 24, 2024
1 parent a39e2f5 commit 88db592
Show file tree
Hide file tree
Showing 11 changed files with 198 additions and 672 deletions.
23 changes: 23 additions & 0 deletions apps/datahub/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import {
import { UiSearchModule } from '@geonetwork-ui/ui/search'
import {
getGlobalConfig,
getOptionalMapConfig,
getOptionalSearchConfig,
getThemeConfig,
TRANSLATE_WITH_OVERRIDES_CONFIG,
Expand Down Expand Up @@ -95,6 +96,12 @@ import { UiWidgetsModule } from '@geonetwork-ui/ui/widgets'
import { RecordUserFeedbacksComponent } from './record/record-user-feedbacks/record-user-feedbacks.component'
import { LetDirective } from '@ngrx/component'
import { OrganizationPageComponent } from './organization/organization-page/organization-page.component'
import {
BASEMAP_LAYERS,
DO_NOT_USE_DEFAULT_BASEMAP,
MAP_VIEW_CONSTRAINTS,
} from '@geonetwork-ui/ui/map'
import { getMapContextLayerFromConfig } from '../../../../libs/util/app-config/src/lib/map-layers'

export const metaReducers: MetaReducer[] = !environment.production ? [] : []

Expand Down Expand Up @@ -229,6 +236,22 @@ export const metaReducers: MetaReducer[] = !environment.production ? [] : []
provide: ORGANIZATION_URL_TOKEN,
useValue: `${ROUTER_ROUTE_SEARCH}?${ROUTE_PARAMS.PUBLISHER}=\${name}`,
},
{
provide: DO_NOT_USE_DEFAULT_BASEMAP,
useFactory: () => getOptionalMapConfig()?.DO_NOT_USE_DEFAULT_BASEMAP,
},
{
provide: BASEMAP_LAYERS,
useFactory: () =>
getOptionalMapConfig()?.MAP_LAYERS.map(getMapContextLayerFromConfig),
},
{
provide: MAP_VIEW_CONSTRAINTS,
useFactory: () => ({
maxExtent: getOptionalMapConfig()?.MAX_EXTENT,
maxZoom: getOptionalMapConfig()?.MAX_ZOOM,
}),
},
],
bootstrap: [AppComponent],
})
Expand Down
1 change: 0 additions & 1 deletion libs/feature/map/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ export * from './lib/+state/map.selectors'
export * from './lib/+state/map.reducer'
export * from './lib/+state/map.actions'
export * from './lib/feature-map.module'
export * from './lib/map-context/map-context.service'
export * from './lib/map-state-container/map-state-container.component'
export * from './lib/constant'
export * from './lib/utils'
Expand Down
Loading

0 comments on commit 88db592

Please sign in to comment.