fix: always allow tags to be returned via the API (#24060)
This commit is contained in:
parent
c3b96d12de
commit
7891cea7f7
|
|
@ -143,9 +143,10 @@ class ChartRestApi(BaseSupersetModelRestApi):
|
|||
"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 = [
|
||||
|
|
@ -192,9 +193,10 @@ class ChartRestApi(BaseSupersetModelRestApi):
|
|||
"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",
|
||||
|
|
@ -222,9 +224,8 @@ class ChartRestApi(BaseSupersetModelRestApi):
|
|||
"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 = {
|
||||
|
|
@ -235,10 +236,8 @@ class ChartRestApi(BaseSupersetModelRestApi):
|
|||
],
|
||||
"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
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ from marshmallow_enum import EnumField
|
|||
from superset import app
|
||||
from superset.common.chart_data import ChartDataResultFormat, ChartDataResultType
|
||||
from superset.db_engine_specs.base import builtin_time_grains
|
||||
from superset.tags.models import TagTypes
|
||||
from superset.utils import pandas_postprocessing, schema as utils
|
||||
from superset.utils.core import (
|
||||
AnnotationType,
|
||||
|
|
@ -152,7 +153,7 @@ openapi_spec_methods_override = {
|
|||
class TagSchema(Schema):
|
||||
id = fields.Int()
|
||||
name = fields.String()
|
||||
type = fields.String()
|
||||
type = EnumField(TagTypes, by_value=True)
|
||||
|
||||
|
||||
class ChartEntityResponseSchema(Schema):
|
||||
|
|
@ -290,6 +291,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):
|
||||
|
|
|
|||
|
|
@ -20,8 +20,10 @@ from typing import Any, Dict, Union
|
|||
|
||||
from marshmallow import fields, post_load, pre_load, Schema
|
||||
from marshmallow.validate import Length, ValidationError
|
||||
from marshmallow_enum import EnumField
|
||||
|
||||
from superset.exceptions import SupersetException
|
||||
from superset.tags.models import TagTypes
|
||||
from superset.utils import core as utils
|
||||
|
||||
get_delete_ids_schema = {"type": "array", "items": {"type": "integer"}}
|
||||
|
|
@ -172,7 +174,7 @@ class RolesSchema(Schema):
|
|||
class TagSchema(Schema):
|
||||
id = fields.Int()
|
||||
name = fields.String()
|
||||
type = fields.String()
|
||||
type = EnumField(TagTypes, by_value=True)
|
||||
|
||||
|
||||
class DashboardGetResponseSchema(Schema):
|
||||
|
|
|
|||
Loading…
Reference in New Issue