-
Notifications
You must be signed in to change notification settings - Fork 16.1k
fix(dashboard import): Importing existing dashboard via UI won't update charts and datasets #34880
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
base: master
Are you sure you want to change the base?
Conversation
This commit fixes a bug when importing a dashboard via the UI it wouldn't update the charts or datasets within that dashboard. The fix involved in using the overwrite parameter to the sub-imports instead of having a hard coded False value. A unit test was also added to test/unit_tests/commands/dashboard/importers/v1/assets_test.py to run the import procedure and compare the changed_on fields of dashboard, charts and datasets and ensure they are updating. Fixes: apache#34879
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.
I've completed my review and didn't find any issues.
Files scanned
| File Path | Reviewed |
|---|---|
| superset/commands/dashboard/importers/v1/init.py | ✅ |
Explore our documentation to understand the languages and file types we support and the files we ignore.
Check out our docs on how you can make Korbit work best for you and your team.
|
@adolfotcar do we want to actually revert back by default? Let's say you exported a chart or dashboard a week ago. Since then we've updated a dataset by adding more columns or added an extra dimension or even created new charts off this updated dashboard. Someone goes in and imports an old dashboard, if the columns are now missing that other charts use, wouldn't this then lead to broken charts? I think @rusackas and I have had discussions before about this problem and it might be if there is a change we should ask the person if they want to overwrite or create new. Such that your imported dataset and chart might just be a new chart or a duplicate to prevent breaking changes. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #34880 +/- ##
===========================================
+ Coverage 0 72.36% +72.36%
===========================================
Files 0 584 +584
Lines 0 42512 +42512
Branches 0 4482 +4482
===========================================
+ Hits 0 30764 +30764
- Misses 0 10566 +10566
- Partials 0 1182 +1182
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. |
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.
Do we need this file?
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.
Nope, not needed...
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. |
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.
Same here... not sure this was intended/needed.
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.
same....not needed, my bad
|
@sadpandajoe I think that not reverting leads to more issues. Imagine you have a dashboard that has chart's column as a filter and you export it. Over the next few days you remove that column from the dataset and chart and also remove the filter from the dashboard but then you want to revert your job back to the way it was before the changes, it will import the dashboard back again with that column as filter but now the chart and datasets won't have that column anymore. When you have multiple environments as well it makes much easier for the development to have everything being overwritten: you do all the changes in dashboards, charts and dataset in a test environment and when moving to production you export only the dashboard and import it rather than having to keep track of all your changes and export one by one. In the end, the user is asked whether they want to overwrite and their answer is what defines if the assets will be overwritten or not. Maybe there should be more explicit message about what happens when overwriting? Another solution I guess would be to have an option to "overwrite only dashboard" or "overwrite all assets". A simpler solution to this would be to have an option in the config.py file this way the UI won't require any changes. |
|
Thanks for the PR! Looks quite approvable, just a couple questions about empty files :) |
|
Looks like there's also this to contend with: Superset uses Git pre-commit hooks courtesy of pre-commit. To install run the following: A series of checks will now run when you make a git commit. Alternatively it is possible to run pre-commit by running pre-commit manually: |
|
@adolfotcar I think this is good, but I just would like to see a confirmation of some sort and the user acknowledges that it can break or undo existing work. I just don't want to see this and then a couple of months later someone else comes in and say "hey whenever i import a dashboard, it breaks my dataset and charts". So I guess what I'm proposing is either some kind of message to let people know, that if you upload this it'll overwrite all charts and datasets in this dashboard or maybe a checkbox that when checks lets them know it overwrites all assets. |
…firm if they want to overwrite all assets inside the dasboard; Expanded the unit test to import overwritting only the dashboard and import overwritting all assets
…rset into fix-dashboard-import-bug
|
@sadpandajoe I just added a checkbox there. |
SUMMARY
This commit fixes a bug when importing a dashboard via the UI it wouldn't update the charts or datasets within that dashboard.
The fix involved in using the overwrite parameter to the sub-imports instead of having a hard coded False value.
A unit test was also added to test/unit_tests/commands/dashboard/importers/v1/assets_test.py to run the import procedure and compare the changed_on fields of dashboard, charts and datasets and ensure they are updating.
Fixes: #34879
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TESTING INSTRUCTIONS
Same Environment
Multiple Environments
ADDITIONAL INFORMATION