apache / superset

Apache Superset is a Data Visualization and Data Exploration Platform
https://superset.apache.org/
Apache License 2.0
61.73k stars 13.49k forks source link

`chartsInScope` references are not fixed during a Dashboard import #26338

Open rdubois-kh opened 8 months ago

rdubois-kh commented 8 months ago

When a dashboard is imported using the ImportDashboardsCommand (v1), the charts id references are replaced from withing the position_metadata and json_metadata with the ids of the newly created charts in the target instance. During that process, it looks like some IDs have been missed in the native filters configuration. Indeed, the chartsInScope references are never replaced with the newly created charts ids.

How to reproduce the bug

  1. Create a dummy dashboard, with a dummy chart
  2. Export the dashboard
  3. Update the ZIP file chart file, by replacing the uuid of the chart with a new random uuid
  4. Update the ZIP file dashboard file, by replacing the uuid of the chart with a new random uuid, and by replacing the position.CHART.meta.uuid entry with the chart new uuid generated in step 3 above
  5. Re-import the dashboard
  6. Look at the newly create dashboard payload. The json_metadata native filters chartsInScope is still made of the former chart ID

Expected results

The imported dashboard json_metadata payload chartsInScope should be made of charts ID which compose this dashboard, in order the filtersInScope and filtersOutScope to be accuratelly computed.

Actual results

The imported dashboard json_metadata payload chartsInScope is made of old charts ID which don't compose this new dashboard. It results in the filtersInScope and filtersOutScope to not be correct after import.

Screenshots

Environment

(please complete the following information):

Checklist

Make sure to follow these steps before submitting your issue - thank you!

Additional context

Add any other context about the problem here.

rusackas commented 4 months ago

There's some discussion happening about using UUIDs for charts, which may impact this workflow a bit (cc @ville). Meanwhile, we'll try to get some attention on the PR... thanks for opening that (and the tests)!

rdubois-kh commented 4 months ago

Thanks @rusackas. We recently found some related issues with import of dashboards and charts in scope, at some other places of the JSON metadata. Please hold off in reviewing the PR. I'll adjust it with some additional fixes.

rdubois-kh commented 4 months ago

@rusackas the PR has been updated with a more complete/exhaustive fix. Thanks.