Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fixes #976] Fix missing required accessToken for MapBox background when adding a map to a geostory #977

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions geonode_mapstore_client/client/js/utils/ResourceUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,10 @@ export const parseMapConfig = (mapResponse, resource = {}) => {
if (layer.group === 'background' && (layer.type === 'ol' || layer.type === 'OpenLayers.Layer')) {
layer.type = 'empty';
}
if (layer.provider === 'MapBoxStyle' || layer.provider === 'MapBox') {
const { mapboxAccessToken } = getConfigProp('geoNodeSettings') || {};
layer.accessToken = mapboxAccessToken || '';
}
return layer;
}));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@

{% get_menu_json 'CARDS_MENU' as CARDS_MENU %}
{{ CARDS_MENU|json_script:"menu-CARDS_MENU" }}

{% mapbox_access_token as MAPBOX_ACCESS_TOKEN %}

{% generate_proxyurl PROXY_URL|default:"/proxy/?url=" request as UPDATED_PROXY_URL %}
{% retrieve_apikey request as user_apikey %}

Expand Down Expand Up @@ -121,7 +124,8 @@
isMobile: isMobile,
datasetMaxUploadSize: datasetMaxUploadSize,
documentMaxUploadSize: documentMaxUploadSize,
maxParallelUploads: maxParallelUploads
maxParallelUploads: maxParallelUploads,
mapboxAccessToken: '{{ MAPBOX_ACCESS_TOKEN }}'
},
geoNodeConfiguration: {
cardsMenu: {
Expand Down