graceguo-supercat commented on a change in pull request #9213: [fix] remove
chart id from filter_scopes metadata if chart is not in dash anymore
URL:
https://github.com/apache/incubator-superset/pull/9213#discussion_r384813744
##########
File path: superset/views/core.py
##########
@@ -1207,6 +1207,14 @@ def copy_dash(self, dashboard_id):
data["filter_scopes"] = json.dumps(new_filter_scopes)
else:
dash.slices = original_dash.slices
+ # remove slice id from filter_scopes metadata if slice is removed
from dashboard
+ if "filter_scopes" in data:
+ new_filter_scopes = copy_filter_scopes(
Review comment:
the idea here is to reuse `copy_filter_scopes` function.
in the case where user wants to copy all charts, `old_to_new_slc_id_dict`
will look like: `{1: 101, 2: 102, 3: 103}`.
and when user don't want to copy all charts, `old_to_new_slc_id_dict` will
look like: `{1: 1, 2: 2, 3: 3}`. and all entries in the dict should be slices
included in the dash.
`copy_filter_scopes` will scan slice id. it will replace filter_scopes
metadata with new slice_ids from dict or just copy with old slice_id. But I
don't have to write another function just to remove old slice ids.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]