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
[Enhancement] Add pluginName=Keplergl
url parameter to Mapbox API requests
#56
Conversation
Keplergl
appid to Mapbox API requestsKeplergl
app-id to Mapbox API requests
Keplergl
app-id to Mapbox API requestspluginName=Keplergl
url parameter to Mapbox API requests
src/components/map-container.js
Outdated
onViewportChange: updateMap | ||
onViewportChange: updateMap, | ||
transformRequest: (url, resourceType) => { | ||
let transformedUrl; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let transformedUrl = url;
src/components/map-container.js
Outdated
// Add parameter to identify kepler.gl Mapbox app traffic | ||
transformedUrl = [url.slice(0, url.indexOf("?")+1), "pluginName=Keplergl&", url.slice(url.indexOf("?")+1)].join(''); | ||
} | ||
else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't need this else
statement here
What do you mean by |
I see what you mean now. You should also add the prop to |
Thanks, @heshan0131 for pointing me in the right direction! I added new props using the same format as in map-container.js into add-map-style-modal.js and confirmed that the URL parameter is added to Mapbox custom styles now. Let me know your final review. Travis tests seem to be failing for an unrelated reason -- all lint and test commands pass locally. Here's the Travis log -- I'll try pushing again in a few hours and see if it reproduces. |
travis build is fixed, rebase and it should work now |
@heshan0131 thanks for the help with the NPM changes, all tests are passing now. Apologies for the slightly ugly rebase commits above - they are all duplicates of previous commits except for the last merge master into this branch change. Ready to merge if you are. Tested on both custom Mapbox map styles, default map styles, and map styles with non-Mapbox-api resources. |
@ryanbaumann, I updated the branch to only include your changes, also moved the code to a util |
pluginName=Keplergl
url parameter to Mapbox API requestspluginName=Keplergl
url parameter to Mapbox API requests
[BUBR-833] small fixes
Adds a URL parameter
pluginName=Keplergl
to all Mapbox API requests made from the mapboxgl.map object cc/ @heshan0131 @chrisirhcExample transformed API request:
api.mapbox.com
or*.tiles.mapbox.com
) remain unchangedKnown issue
When adding a custom Mapbox style, the map options for
transformRequest
are not maintained. Map options fortransformRequest
are maintained when selecting from the list of Kepler.gl stylesmuted light
,light,
etc.@heshan0131 is the map initialization handled for custom Mapbox GL style sheets differently than Uber-sourced styles?
Tests are failing on Travis but pass locally running with
yarn run test
. Not sure why.To Do:
transformRequest
map options are not maintained when using a custom map style