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

chore: remove and deprecate old CSS templates endpoints #28387

Merged
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
31 changes: 16 additions & 15 deletions superset/views/css_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,36 +15,30 @@
# specific language governing permissions and limitations
# under the License.
from flask_appbuilder.api import expose
from flask_appbuilder.baseviews import expose_api
from flask_appbuilder.models.sqla.interface import SQLAInterface
from flask_appbuilder.security.decorators import has_access
from flask_babel import lazy_gettext as _
from flask_appbuilder.security.decorators import (
has_access,
has_access_api,
permission_name,
)

from superset.constants import MODEL_VIEW_RW_METHOD_PERMISSION_MAP, RouteMethod
from superset.models import core as models
from superset.superset_typing import FlaskResponse
from superset.views.base import DeleteMixin, SupersetModelView
from superset.views.base import DeleteMixin, deprecated, SupersetModelView


class CssTemplateModelView( # pylint: disable=too-many-ancestors
SupersetModelView,
DeleteMixin,
):
datamodel = SQLAInterface(models.CssTemplate)
include_route_methods = RouteMethod.CRUD_SET
include_route_methods = RouteMethod.LIST

class_permission_name = "CssTemplate"
method_permission_name = MODEL_VIEW_RW_METHOD_PERMISSION_MAP

list_title = _("CSS Templates")
show_title = _("Show CSS Template")
add_title = _("Add CSS Template")
edit_title = _("Edit CSS Template")

list_columns = ["template_name"]
edit_columns = ["template_name", "css"]
add_columns = edit_columns
label_columns = {"template_name": _("Template Name")}

@expose("/list/")
@has_access
def list(self) -> FlaskResponse:
Expand All @@ -54,8 +48,15 @@ def list(self) -> FlaskResponse:
class CssTemplateAsyncModelView( # pylint: disable=too-many-ancestors
CssTemplateModelView
):
include_route_methods = {RouteMethod.API_READ}
include_route_methods = RouteMethod.API_READ
class_permission_name = "CssTemplate"
method_permission_name = MODEL_VIEW_RW_METHOD_PERMISSION_MAP

list_columns = ["template_name", "css"]

@expose_api(name="read", url="/api/read", methods=["GET"])
@has_access_api
@permission_name("list")
@deprecated(eol_version="5.0.0")
Copy link
Member Author

Choose a reason for hiding this comment

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

Could we just remove this? not used on the frontend and a REST API exists for this for some time now

Copy link
Member

Choose a reason for hiding this comment

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

@dpgaspar We discussed this during the release meeting and we agreed to remove these legacy endpoints during a breaking window even if they are not under v1. That's what we did in the past and we just want to be mindful that someone out there might still be using the endpoint.

def api_read(self) -> FlaskResponse:
return self.api_read()
Loading