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: always allow tags to be returned via the API #24060

Merged
merged 5 commits into from
May 22, 2023
Merged
Show file tree
Hide file tree
Changes from 3 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
17 changes: 8 additions & 9 deletions superset/charts/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,10 @@ def ensure_thumbnails_enabled(self) -> Optional[Response]:
"viz_type",
"query_context",
"is_managed_externally",
"tags.id",
"tags.name",
"tags.type",
]
if is_feature_enabled("TAGGING_SYSTEM"):
show_columns += ["tags.id", "tags.name", "tags.type"]

show_select_columns = show_columns + ["table.id"]
list_columns = [
Expand Down Expand Up @@ -194,9 +195,10 @@ def ensure_thumbnails_enabled(self) -> Optional[Response]:
"thumbnail_url",
"url",
"viz_type",
"tags.id",
"tags.name",
"tags.type",
]
if is_feature_enabled("TAGGING_SYSTEM"):
list_columns += ["tags.id", "tags.name", "tags.type"]
list_select_columns = list_columns + ["changed_by_fk", "changed_on"]
order_columns = [
"changed_by.first_name",
Expand Down Expand Up @@ -224,9 +226,8 @@ def ensure_thumbnails_enabled(self) -> Optional[Response]:
"dashboards",
"slice_name",
"viz_type",
"tags",
]
if is_feature_enabled("TAGGING_SYSTEM"):
search_columns += ["tags"]
base_order = ("changed_on", "desc")
base_filters = [["id", ChartFilter, lambda: []]]
search_filters = {
Expand All @@ -237,10 +238,8 @@ def ensure_thumbnails_enabled(self) -> Optional[Response]:
],
"slice_name": [ChartAllTextFilter],
"created_by": [ChartHasCreatedByFilter, ChartCreatedByMeFilter],
"tags": [ChartTagFilter],
}
if is_feature_enabled("TAGGING_SYSTEM"):
search_filters["tags"] = [ChartTagFilter]

# Will just affect _info endpoint
edit_columns = ["slice_name"]
add_columns = edit_columns
Expand Down
3 changes: 2 additions & 1 deletion superset/charts/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@
class TagSchema(Schema):
id = fields.Int()
name = fields.String()
type = fields.String()
type = fields.Int()


class ChartEntityResponseSchema(Schema):
Expand Down Expand Up @@ -290,6 +290,7 @@ class ChartPutSchema(Schema):
)
is_managed_externally = fields.Boolean(allow_none=True, dump_default=False)
external_url = fields.String(allow_none=True)
tags = fields.Nested(TagSchema, many=True)


class ChartGetDatasourceObjectDataResponseSchema(Schema):
Expand Down
2 changes: 1 addition & 1 deletion superset/dashboards/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ class RolesSchema(Schema):
class TagSchema(Schema):
id = fields.Int()
name = fields.String()
type = fields.String()
type = fields.Int()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What changed here? Does this map to an enum? If so, can we use fields.Enum instead?



class DashboardGetResponseSchema(Schema):
Expand Down