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 2023/03/17 23:50:34 UTC
[superset] branch master updated: fix(dashboard): `show_native_filters` leftover (#23389)
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 022213972b fix(dashboard): `show_native_filters` leftover (#23389)
022213972b is described below
commit 022213972bed516787deb9fd0e9e833d646cca80
Author: Beto Dealmeida <ro...@dealmeida.net>
AuthorDate: Fri Mar 17 16:50:26 2023 -0700
fix(dashboard): `show_native_filters` leftover (#23389)
---
superset/dashboards/commands/importers/v1/utils.py | 5 +++++
superset/dashboards/schemas.py | 19 ++++++++++++++++++-
2 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/superset/dashboards/commands/importers/v1/utils.py b/superset/dashboards/commands/importers/v1/utils.py
index 090c64e21c..4d5e2ece81 100644
--- a/superset/dashboards/commands/importers/v1/utils.py
+++ b/superset/dashboards/commands/importers/v1/utils.py
@@ -162,6 +162,11 @@ def import_dashboard(
# TODO (betodealmeida): move this logic to import_from_dict
config = config.copy()
+
+ # removed in https://github.com/apache/superset/pull/23228
+ if "metadata" in config and "show_native_filters" in config["metadata"]:
+ del config["metadata"]["show_native_filters"]
+
for key, new_name in JSON_KEYS.items():
if config.get(key) is not None:
value = config.pop(key)
diff --git a/superset/dashboards/schemas.py b/superset/dashboards/schemas.py
index c74c7ba52a..17e9509f06 100644
--- a/superset/dashboards/schemas.py
+++ b/superset/dashboards/schemas.py
@@ -18,7 +18,7 @@ import json
import re
from typing import Any, Dict, Union
-from marshmallow import fields, post_load, Schema
+from marshmallow import fields, post_load, pre_load, Schema
from marshmallow.validate import Length, ValidationError
from superset.exceptions import SupersetException
@@ -135,6 +135,23 @@ class DashboardJSONMetadataSchema(Schema):
remote_id = fields.Integer()
filter_bar_orientation = fields.Str(allow_none=True)
+ @pre_load
+ def remove_show_native_filters( # pylint: disable=unused-argument, no-self-use
+ self,
+ data: Dict[str, Any],
+ **kwargs: Any,
+ ) -> Dict[str, Any]:
+ """
+ Remove ``show_native_filters`` from the JSON metadata.
+
+ This field was removed in https://github.com/apache/superset/pull/23228, but might
+ be present in old exports.
+ """
+ if "show_native_filters" in data:
+ del data["show_native_filters"]
+
+ return data
+
class UserSchema(Schema):
id = fields.Int()