From 393d6a28b6b4a8ecff27b3fdec5c8e7a18c4b495 Mon Sep 17 00:00:00 2001 From: Ville Brofeldt Date: Wed, 9 Mar 2022 23:06:59 +0200 Subject: [PATCH] fix(dashboard): import handle missing excluded charts --- superset/dashboards/commands/importers/v1/utils.py | 2 +- tests/unit_tests/dashboards/commands/importers/v1/utils_test.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/superset/dashboards/commands/importers/v1/utils.py b/superset/dashboards/commands/importers/v1/utils.py index a8dbc46c0be91..513d1efcdb212 100644 --- a/superset/dashboards/commands/importers/v1/utils.py +++ b/superset/dashboards/commands/importers/v1/utils.py @@ -137,7 +137,7 @@ def update_id_refs( # pylint: disable=too-many-locals scope_excluded = native_filter.get("scope", {}).get("excluded", []) if scope_excluded: native_filter["scope"]["excluded"] = [ - id_map[old_id] for old_id in scope_excluded + id_map[old_id] for old_id in scope_excluded if old_id in id_map ] return fixed 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 320482a0e3947..5f3015b1b01fa 100644 --- a/tests/unit_tests/dashboards/commands/importers/v1/utils_test.py +++ b/tests/unit_tests/dashboards/commands/importers/v1/utils_test.py @@ -93,7 +93,7 @@ def test_update_native_filter_config_scope_excluded(app_context: None): }, }, "metadata": { - "native_filter_configuration": [{"scope": {"excluded": [101, 102]}}], + "native_filter_configuration": [{"scope": {"excluded": [101, 102, 103]}}], }, } chart_ids = {"uuid1": 1, "uuid2": 2}