mirror of
https://github.com/apache/superset.git
synced 2026-04-22 17:45:21 +00:00
[dashboard] fix filter_scopes when copy dashboard with duplicate_slices (#9188)
* [dashboard] fix filter_scopes when copy dashboard with duplicate_slices * code cleanup
This commit is contained in:
@@ -70,3 +70,17 @@ def convert_filter_scopes(json_metadata: Dict, filters: List[Slice]):
|
||||
filter_scopes[filter_id] = filter_fields
|
||||
|
||||
return filter_scopes
|
||||
|
||||
|
||||
def copy_filter_scopes(
|
||||
old_to_new_slc_id_dict: Dict[int, int], old_filter_scopes: Dict[str, Dict]
|
||||
) -> Dict:
|
||||
new_filter_scopes = {}
|
||||
for (slice_id, scopes) in old_filter_scopes.items():
|
||||
new_filter_key = old_to_new_slc_id_dict[int(slice_id)]
|
||||
new_filter_scopes[str(new_filter_key)] = scopes
|
||||
for scope in scopes.values():
|
||||
scope["immune"] = [
|
||||
old_to_new_slc_id_dict[slice_id] for slice_id in scope.get("immune")
|
||||
]
|
||||
return new_filter_scopes
|
||||
|
||||
Reference in New Issue
Block a user