-
Notifications
You must be signed in to change notification settings - Fork 14.5k
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
fix: Copy dashboard filters when copying dashboard #24303
fix: Copy dashboard filters when copying dashboard #24303
Conversation
Codecov Report
@@ Coverage Diff @@
## master #24303 +/- ##
==========================================
+ Coverage 66.53% 68.31% +1.78%
==========================================
Files 1957 1957
Lines 75623 75624 +1
Branches 8224 8224
==========================================
+ Hits 50312 51663 +1351
+ Misses 23202 21852 -1350
Partials 2109 2109
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 95 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
@@ -154,6 +154,34 @@ def test_copy_dashboard(self, mock_g): | |||
db.session.delete(dash) | |||
db.session.commit() | |||
|
|||
@pytest.mark.usefixtures("load_world_bank_dashboard_with_slices") | |||
@patch("superset.dashboards.dao.g") | |||
def test_copy_dashboard_copies_native_filters(self, mock_g): |
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.
test fails without this fix
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. Especially when the test is more code than the fix! :)
(cherry picked from commit e791ba5)
🏷️ preset:2023.23 |
SUMMARY
This PR will make it so that dashboard native filters are properly copied when copying a dashboard using the "Save as" option in the UI. This functionality broke as a result of an api v1 migration.
set_dash_metadata
just takes the current dash's params and adds certain keys from the data dict passed in. Before callingset_dash_metadata
, the newly copied dashboard should share the same metadata as the original dash so that no keys are lost, in this casenative_filter_configuration
was being lost.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Before:

After:

TESTING INSTRUCTIONS
ADDITIONAL INFORMATION