Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(dashboard): show_native_filters leftover #23389

Merged
merged 1 commit into from
Mar 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions superset/dashboards/commands/importers/v1/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
19 changes: 18 additions & 1 deletion superset/dashboards/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
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
Expand Down Expand Up @@ -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()
Expand Down