From 899cb7bd4505faa7892e35b757fb643abba11c1e Mon Sep 17 00:00:00 2001 From: Grace Guo Date: Tue, 18 Aug 2020 18:10:06 -0700 Subject: [PATCH] refactor: remove slice level label_colors from dashboard init load (#10603) --- superset/config.py | 1 + superset/views/core.py | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/superset/config.py b/superset/config.py index b4803e8c8d186..a974f85ac1d05 100644 --- a/superset/config.py +++ b/superset/config.py @@ -304,6 +304,7 @@ def _try_json_readsha( # pylint: disable=unused-argument # Exposes API endpoint to compute thumbnails "THUMBNAILS": False, "REDUCE_DASHBOARD_BOOTSTRAP_PAYLOAD": True, + "REMOVE_SLICE_LEVEL_LABEL_COLORS": False, "SHARE_QUERIES_VIA_KV_STORE": False, "SIP_38_VIZ_REARCHITECTURE": False, "TAGGING_SYSTEM": False, diff --git a/superset/views/core.py b/superset/views/core.py index 48cd4583d4cb6..cee8a618c83d6 100755 --- a/superset/views/core.py +++ b/superset/views/core.py @@ -1652,6 +1652,13 @@ def dashboard(**_: Any) -> None: ) dashboard_data = dash.data + if is_feature_enabled("REMOVE_SLICE_LEVEL_LABEL_COLORS"): + # dashboard metadata has dashboard-level label_colors, + # so remove slice-level label_colors from its form_data + for slc in dashboard_data.get("slices"): + form_data = slc.get("form_data") + form_data.pop("label_colors", None) + dashboard_data.update( { "standalone_mode": standalone_mode,