Naktibalda opened a new pull request, #42356:
URL: https://github.com/apache/superset/pull/42356
### SUMMARY
Migrates the World Map chart from the deprecated legacy data endpoint
(`/superset/explore_json/`) to the v1 chart data API (`POST
/api/v1/chart/data`), and renames the package
`@superset-ui/legacy-plugin-chart-world-map` →
`@superset-ui/plugin-chart-world-map` (1.0.0), following the precedent set by
`preset-chart-deckgl` in #38035.
**Rationale**: besides moving one more chart off the deprecated endpoint,
this fixes World Map charts in **embedded dashboards**:
`/superset/explore_json/` rejects guest tokens unconditionally, so embedded
users get "Access is Denied" on every World Map chart while all v1-API
charts on the same dashboard work.
**Design decisions**:
- `buildQuery` replicates the legacy `WorldMapViz.query_obj`
(`superset/viz.py`) exactly: group by the entity column, request the metric
plus the bubble-size metric when distinct (compared via
`getMetricLabel`, so adhoc metrics dedupe correctly), and translate
`sort_by_metric` into an `orderby`.
- The v1 endpoint returns generic rows keyed by the entity column and
metric labels, so `transformProps` now rebuilds the
`country/code/name/latitude/longitude/m1/m2` shape the renderer consumes — the
country-code conversion and centroid/name enrichment that
`WorldMapViz.get_data` performed server-side via
`superset/examples/countries.py`. The country table is mirrored client-side
(`src/countries.ts`,
case-insensitive lookup like the Python `get()`), including the legacy `m2
= m1` fallback and the `XXX` sentinel for unmappable values.
- The `world_map` viz key is unchanged, so existing charts keep working
without migration. Existing charts should be re-saved (Save → overwrite) to
refresh their stored `query_context` before use behind guest
tokens, since the guest `query_context_modified` check compares against it.
- The legacy `WorldMapViz` Python class is intentionally left in place; it
can be removed in a follow-up together with the other `explore_json` cleanups.
- Rendering (`WorldMap.ts`/datamaps) is untouched — no visual changes.
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
No visual changes — same renderer, new data path. (Before/after of an
embedded dashboard: previously "Access is Denied" on World Map charts under a
guest token, now rendering.)
### TESTING INSTRUCTIONS
1. Open any World Map chart (e.g. from the World Bank's Data example
dashboard) in Explore and on a dashboard: choropleth, bubbles (enable "Show
Bubbles" with a secondary metric), tooltips, color-by
country/metric, cross-filtering and drill-to-detail/drill-by all behave as
before.
2. In the network tab, confirm the chart now fetches via `POST
/api/v1/chart/data` (no `/superset/explore_json/` request).
3. Verify each `country_fieldtype` option still maps correctly
(cca2/cca3/cioc/full name), including lower-cased values, and that unmappable
values are simply omitted from the map.
4. Embedded regression: with `EMBEDDED_SUPERSET` enabled, embed a
dashboard containing a World Map chart and render it with a guest token — the
chart loads (previously failed with "Access is Denied"). Re-save
the chart first if it existed before this change.
5. Unit tests: `npm run test -- plugins/plugin-chart-world-map` (new
`buildQuery`/`transformProps` suites plus the existing renderer suite).
### ADDITIONAL INFORMATION
- [ ] Has associated issue:
- [ ] Required feature flags:
- [ ] Changes UI
- [ ] Includes DB Migration (follow approval process in
[SIP-59](https://github.com/apache/superset/issues/13351))
- [ ] Migration is atomic, supports rollback & is backwards-compatible
- [ ] Confirm DB migration upgrade and downgrade tested
- [ ] Runtime estimates and downtime expectations provided
- [ ] Introduces new feature or API
- [x] Removes existing feature or API
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]