-
Notifications
You must be signed in to change notification settings - Fork 14.1k
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
feat(datasets): Allow swap dataset after deletion #30364
feat(datasets): Allow swap dataset after deletion #30364
Conversation
/testenv up |
@Antonio-RiveroMartnez Ephemeral environment spinning up at http://35.162.103.7:8080. Credentials are |
/testenv up |
@Antonio-RiveroMartnez Ephemeral environment spinning up at http://54.218.73.54:8080. Credentials are |
Wow, that is a nice quality of life improvement for users! Huge potential time saver. |
I think this PR is a fantastic step in the right direction ❤️ If there's interest/bandwidth to take things a step further, it's worth noting that deleting a dataset might break HUNDREDS of charts. While this PR allows you to restore them one at a time, it might be a great idea to (also) allow this swap/substitution in the Dataset deletion modal. You could give the user any/all of these choices:
Of course, taking it even further over the horizon, we probably shouldn't be deleting anything but rather doing "soft deletes" where rows are tagged as deleted, so that they can be restored by a DBA. (Note, this is not the same as "Archiving" which requires UI changes and un-archiving capabilities. Love the PR, but just saying this is the entry of a longer tunnel ;) |
superset-frontend/src/explore/controlUtils/getControlValuesCompatibleWithDatasource.ts
Outdated
Show resolved
Hide resolved
superset-frontend/src/explore/controlUtils/getControlValuesCompatibleWithDatasource.ts
Outdated
Show resolved
Hide resolved
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.
Looks great! Left some non-blocking comments.
Unrelated to this PR, but I'd love to see a more verbose error than "Not found" in the chart area
Ephemeral environment shutdown and build artifacts deleted. |
SUMMARY
Currently, if you delete a dataset, the charts that were using it don't keep the controls config when swapping to a dataset that have similar structure.
This is because the state gets overwritten with form data that doesn't have the controls configs so the sync method is not able to fetch the correct values for them.
This PR keeps the values and other configs when the API response doesn't include dataset id (deleted) and fallback to read from the datasource when getting the controls values in case there's nothing in the state.
One thing to notice is that before, when you first loaded a chart that have no dataset because it was deleted, the explore data was a fallback and didn't trigger the API requests, now, because we're not using this fallback explore but keeping the form data info from the API response, the UI will show a
Not Found
error until you swap the dataset and update the chart.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Before:
before.mov
Now:
test_2.mov
TESTING INSTRUCTIONS
Create two datasets with the same schema (columns and metrics).
Create a chart using one of these and save it.
Delete this dataset.
Access the chart -- you'll see an option to swap the dataset.
Remap the chart to use the other dataset.
Your controls config must be kept
ADDITIONAL INFORMATION