You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by be...@apache.org on 2021/12/14 15:25:18 UTC
[superset] branch master updated: fix: import dashboard stale filter_scopes (#17741)
This is an automated email from the ASF dual-hosted git repository.
beto pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git
The following commit(s) were added to refs/heads/master by this push:
new 2633bcc fix: import dashboard stale filter_scopes (#17741)
2633bcc is described below
commit 2633bcccc372f0059a23cd5a8367a983f388dcb2
Author: Beto Dealmeida <ro...@dealmeida.net>
AuthorDate: Tue Dec 14 07:23:55 2021 -0800
fix: import dashboard stale filter_scopes (#17741)
---
superset/dashboards/commands/importers/v1/utils.py | 2 ++
tests/unit_tests/dashboards/commands/importers/v1/utils_test.py | 5 ++++-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/superset/dashboards/commands/importers/v1/utils.py b/superset/dashboards/commands/importers/v1/utils.py
index 0067c2c..c3dee15 100644
--- a/superset/dashboards/commands/importers/v1/utils.py
+++ b/superset/dashboards/commands/importers/v1/utils.py
@@ -84,6 +84,7 @@ def update_id_refs( # pylint: disable=too-many-locals
metadata["filter_scopes"] = {
str(id_map[int(old_id)]): columns
for old_id, columns in metadata["filter_scopes"].items()
+ if int(old_id) in id_map
}
# now update columns to use new IDs:
@@ -107,6 +108,7 @@ def update_id_refs( # pylint: disable=too-many-locals
{
str(id_map[int(old_id)]): value
for old_id, value in default_filters.items()
+ if int(old_id) in id_map
}
)
diff --git a/tests/unit_tests/dashboards/commands/importers/v1/utils_test.py b/tests/unit_tests/dashboards/commands/importers/v1/utils_test.py
index 7ff8294..d0ee315 100644
--- a/tests/unit_tests/dashboards/commands/importers/v1/utils_test.py
+++ b/tests/unit_tests/dashboards/commands/importers/v1/utils_test.py
@@ -45,7 +45,10 @@ def test_update_id_refs_immune_missing( # pylint: disable=invalid-name
},
},
"metadata": {
- "filter_scopes": {"101": {"filter_name": {"immune": [102, 103],},},},
+ "filter_scopes": {
+ "101": {"filter_name": {"immune": [102, 103]}},
+ "104": {"filter_name": {"immune": [102, 103]}},
+ },
},
"native_filter_configuration": [],
}