fitzee opened a new pull request, #40008:
URL: https://github.com/apache/superset/pull/40008
### SUMMARY
**Root cause:** Display controls (`chart_customization_config` entries in
dashboard JSON metadata) store dataset references as integer `datasetId` in
their `targets` array. During dashboard export, the existing code converts
`datasetId` → `datasetUuid` for `native_filter_configuration` entries, but the
same conversion was missing for `chart_customization_config` (display
controls). Similarly, the import path restored `datasetUuid` → `datasetId` for
native filters but not for display controls.
**Impact:** Exporting a dashboard with display controls that reference a
dataset, then importing it into another environment, left display controls
pointing at the wrong dataset (or no dataset) because the integer ID was
environment-specific and was never converted to a portable UUID.
**Fix:** Applied the same `datasetId` ↔ `datasetUuid` conversion logic to
`chart_customization_config` in both export and import paths:
- `superset/commands/dashboard/export.py` (`_file_content`): Replace
`datasetId` with `datasetUuid` in display control targets during export
- `superset/commands/dashboard/export.py` (`_export`): Export datasets
referenced by display controls (so the dataset YAML files are included in the
export bundle)
- `superset/commands/dashboard/importers/v1/utils.py`
(`find_native_filter_datasets`): Collect dataset UUIDs from display controls so
the importer knows which datasets to look up
- `superset/commands/dashboard/importers/v1/utils.py` (`update_id_refs`):
Restore `datasetId` from `datasetUuid` in display control targets during import
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Not applicable (backend serialization change — no UI difference).
### TESTING INSTRUCTIONS
1. Create a dashboard with a display control ("Add display control") that
references a dataset and a column
2. Export the dashboard (dashboard > ... > Export)
3. Open the exported ZIP and inspect the dashboard YAML — confirm
`chart_customization_config` targets now contain `datasetUuid` (not `datasetId`)
4. Import the ZIP into a fresh Superset instance that has the same dataset —
confirm the display control is functional with the correct dataset/column
Or run the new unit tests:
```bash
pytest tests/unit_tests/commands/dashboard/export_test.py -v
pytest
tests/unit_tests/dashboards/commands/importers/v1/utils_test.py::test_find_native_filter_datasets_includes_display_controls
-v
pytest
tests/unit_tests/dashboards/commands/importers/v1/utils_test.py::test_update_id_refs_fixes_display_control_dataset_references
-v
```
### ADDITIONAL INFORMATION
- [x] Has associated issue: SC-104655 (Shortcut)
- [ ] Required feature flags:
- [ ] Changes UI
- [ ] Includes DB Migration
- [ ] Introduces new feature or API
- [ ] Removes existing feature or API
Fixes SC-104655 — bluelabs.eu (P3)
--
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]