fix: removes old deprecated sqllab endpoints (#27117)

This commit is contained in:
Daniel Vaz Gaspar 2024-02-15 15:58:48 +00:00 committed by GitHub
parent 753ef69529
commit c96e38c07c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 30 additions and 67 deletions

View File

@ -28,6 +28,7 @@ assists people when migrating to a new version.
### Breaking Changes
- [27117](https://github.com/apache/superset/pull/27117): Removes the following deprecated endpoints: `/superset/sqllab`, `/superset/sqllab/history`, `/sqllab/my_queries` use `/sqllab`, `/sqllab/history`, `/savedqueryview/list/?_flt_0_user={get_user_id()}` instead.
- [26347](https://github.com/apache/superset/issues/26347): Removes the deprecated `VERSIONED_EXPORT` feature flag. The previous value of the feature flag was `True` and now the feature is permanently enabled.
- [26328](https://github.com/apache/superset/issues/26328): Removes the deprecated Filter Box code and it's associated dependencies `react-select` and `array-move`. It also removes the `DeprecatedSelect` and `AsyncSelect` components that were exclusively used by filter boxes. Existing filter boxes will be automatically migrated to native filters.
- [26330](https://github.com/apache/superset/issues/26330): Removes the deprecated `DASHBOARD_FILTERS_EXPERIMENTAL` feature flag. The previous value of the feature flag was `False` and now the feature is permanently removed.

View File

@ -123,9 +123,6 @@ describe('SqlLab query panel', () => {
.eq(0) // save
.click();
// visit saved queries
cy.visit('/sqllab/my_queries/');
// first row contains most recent link, follow back to SqlLab
cy.get('table tr:first-child a[href*="savedQueryId"').click();

View File

@ -185,7 +185,6 @@ class SupersetAppInitializer: # pylint: disable=too-many-public-methods
from superset.views.sql_lab.views import (
SavedQueryView,
SavedQueryViewApi,
SqlLab,
TableSchemaView,
TabStateView,
)
@ -310,7 +309,6 @@ class SupersetAppInitializer: # pylint: disable=too-many-public-methods
appbuilder.add_view_no_menu(SavedQueryView)
appbuilder.add_view_no_menu(SavedQueryViewApi)
appbuilder.add_view_no_menu(SliceAsync)
appbuilder.add_view_no_menu(SqlLab)
appbuilder.add_view_no_menu(SqllabView)
appbuilder.add_view_no_menu(SqlMetricInlineView)
appbuilder.add_view_no_menu(Superset)

View File

@ -231,7 +231,6 @@ class SupersetSecurityManager( # pylint: disable=too-many-public-methods
ACCESSIBLE_PERMS = {"can_userinfo", "resetmypassword", "can_recent_activity"}
SQLLAB_ONLY_PERMISSIONS = {
("can_my_queries", "SqlLab"),
("can_read", "SavedQuery"),
("can_write", "SavedQuery"),
("can_export", "SavedQuery"),

View File

@ -121,7 +121,7 @@ PARAMETER_MISSING_ERR = __(
SqlResults = dict[str, Any]
class Superset(BaseSupersetView): # pylint: disable=too-many-public-methods
class Superset(BaseSupersetView):
"""The base views for Superset!"""
logger = logging.getLogger(__name__)
@ -916,24 +916,6 @@ class Superset(BaseSupersetView): # pylint: disable=too-many-public-methods
),
)
@has_access
@event_logger.log_this
@expose(
"/sqllab/",
methods=(
"GET",
"POST",
),
)
@deprecated(new_target="/sqllab")
def sqllab(self) -> FlaskResponse:
"""SQL Editor"""
url = "/sqllab"
if url_params := request.args:
params = parse.urlencode(url_params)
url = f"{url}?{params}"
return redirect(url)
@has_access
@event_logger.log_this
@expose("/sqllab/history/", methods=("GET",))

View File

@ -17,7 +17,7 @@
import logging
import simplejson as json
from flask import redirect, request, Response
from flask import request, Response
from flask_appbuilder import expose
from flask_appbuilder.models.sqla.interface import SQLAInterface
from flask_appbuilder.security.decorators import has_access, has_access_api
@ -264,16 +264,3 @@ class TableSchemaView(BaseSupersetView):
db.session.commit()
response = json.dumps({"id": table_schema_id, "expanded": payload})
return json_success(response)
class SqlLab(BaseSupersetView):
"""The base views for Superset!"""
@expose("/my_queries/")
@has_access
def my_queries(self) -> FlaskResponse:
"""Assigns a list of found users to the given role."""
logger.warning(
"This endpoint is deprecated and will be removed in the next major release"
)
return redirect(f"/savedqueryview/list/?_flt_0_user={get_user_id()}")

View File

@ -1190,25 +1190,6 @@ class TestCore(SupersetTestCase):
is True
)
def test_redirect_new_sqllab(self):
self.login(username="admin")
resp = self.client.get(
"/superset/sqllab?savedQueryId=1&testParams=2",
follow_redirects=True,
)
assert resp.request.path == "/sqllab/"
assert (
resp.request.query_string.decode("utf-8") == "savedQueryId=1&testParams=2"
)
resp = self.client.post("/superset/sqllab/")
assert resp.status_code == 302
def test_redirect_new_sqllab_history(self):
self.login(username="admin")
resp = self.client.get("/superset/sqllab/history/")
assert resp.status_code == 302
if __name__ == "__main__":
unittest.main()

View File

@ -1470,15 +1470,33 @@ class TestRolePermission(SupersetTestCase):
def test_sql_lab_permissions(self):
sql_lab_set = get_perm_tuples("sql_lab")
self.assertIn(("can_csv", "Superset"), sql_lab_set)
self.assertIn(("can_read", "Database"), sql_lab_set)
self.assertIn(("can_read", "SavedQuery"), sql_lab_set)
self.assertIn(("can_sqllab", "Superset"), sql_lab_set)
self.assertIn(("menu_access", "SQL Lab"), sql_lab_set)
self.assertIn(("menu_access", "SQL Editor"), sql_lab_set)
self.assertIn(("menu_access", "Saved Queries"), sql_lab_set)
self.assertIn(("menu_access", "Query Search"), sql_lab_set)
self.assertEqual(
sql_lab_set,
{
("can_activate", "TabStateView"),
("can_csv", "Superset"),
("can_delete_query", "TabStateView"),
("can_delete", "TabStateView"),
("can_execute_sql_query", "SQLLab"),
("can_export", "SavedQuery"),
("can_export_csv", "SQLLab"),
("can_get", "TabStateView"),
("can_get_results", "SQLLab"),
("can_migrate_query", "TabStateView"),
("can_sqllab_history", "Superset"),
("can_put", "TabStateView"),
("can_post", "TabStateView"),
("can_write", "SavedQuery"),
("can_read", "Query"),
("can_read", "Database"),
("can_read", "SQLLab"),
("can_read", "SavedQuery"),
("menu_access", "Query Search"),
("menu_access", "Saved Queries"),
("menu_access", "SQL Editor"),
("menu_access", "SQL Lab"),
},
)
self.assert_cannot_alpha(sql_lab_set)