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: Cleaning up ENABLE_REACT_CRUD_VIEWS config #11496

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
9 changes: 4 additions & 5 deletions superset/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,10 @@ def _try_json_readsha( # pylint: disable=unused-argument
"TAGGING_SYSTEM": False,
"SQLLAB_BACKEND_PERSISTENCE": False,
"LISTVIEWS_DEFAULT_CARD_VIEW": False,
# Enables the replacement React views for all the FAB views (list, edit, show) with
# designs introduced in https://github.com/apache/incubator-superset/issues/8976
# (SIP-34). This is a work in progress so not all features available in FAB have
# been implemented.
"ENABLE_REACT_CRUD_VIEWS": True,
# When True, this flag allows display of HTML tags in Markdown components
"DISPLAY_MARKDOWN_HTML": True,
Expand Down Expand Up @@ -849,11 +853,6 @@ class CeleryConfig: # pylint: disable=too-few-public-methods
DOCUMENTATION_TEXT = "Documentation"
DOCUMENTATION_ICON = None # Recommended size: 16x16

# Enables the replacement react views for all the FAB views (list, edit, show) with
# designs introduced in SIP-34: https://github.com/apache/incubator-superset/issues/8976
# This is a work in progress so not all features available in FAB have been implemented
Comment on lines -852 to -854
Copy link
Member

Choose a reason for hiding this comment

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

Should we move these comments to the feature flag lines?

ENABLE_REACT_CRUD_VIEWS = DEFAULT_FEATURE_FLAGS["ENABLE_REACT_CRUD_VIEWS"]

# What is the Last N days relative in the time selector to:
# 'today' means it is midnight (00:00:00) in the local timezone
# 'now' means it is relative to the query issue time
Expand Down
4 changes: 2 additions & 2 deletions superset/connectors/sqla/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from wtforms.ext.sqlalchemy.fields import QuerySelectField
from wtforms.validators import Regexp

from superset import app, db
from superset import app, db, is_feature_enabled
from superset.connectors.base.views import DatasourceModelView
from superset.connectors.sqla import models
from superset.constants import RouteMethod
Expand Down Expand Up @@ -559,7 +559,7 @@ class RefreshResults:
@expose("/list/")
@has_access
def list(self) -> FlaskResponse:
if not app.config["ENABLE_REACT_CRUD_VIEWS"]:
if not is_feature_enabled("ENABLE_REACT_CRUD_VIEWS"):
return super().list()

return super().render_app_template()
11 changes: 5 additions & 6 deletions superset/views/annotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@
from flask_babel import lazy_gettext as _
from wtforms.validators import StopValidation

from superset import app
from superset import is_feature_enabled
from superset.constants import RouteMethod
from superset.extensions import feature_flag_manager
from superset.models.annotations import Annotation, AnnotationLayer
from superset.typing import FlaskResponse
from superset.views.base import SupersetModelView
Expand Down Expand Up @@ -101,8 +100,8 @@ def pre_update(self, item: "AnnotationModelView") -> None:
@has_access
def annotation(self, pk: int) -> FlaskResponse: # pylint: disable=unused-argument
if not (
app.config["ENABLE_REACT_CRUD_VIEWS"]
and feature_flag_manager.is_feature_enabled("SIP_34_ANNOTATIONS_UI")
is_feature_enabled("ENABLE_REACT_CRUD_VIEWS")
and is_feature_enabled("SIP_34_ANNOTATIONS_UI")
):
return super().list()

Expand All @@ -128,8 +127,8 @@ class AnnotationLayerModelView(SupersetModelView): # pylint: disable=too-many-a
@has_access
def list(self) -> FlaskResponse:
if not (
app.config["ENABLE_REACT_CRUD_VIEWS"]
and feature_flag_manager.is_feature_enabled("SIP_34_ANNOTATIONS_UI")
is_feature_enabled("ENABLE_REACT_CRUD_VIEWS")
and is_feature_enabled("SIP_34_ANNOTATIONS_UI")
):
return super().list()

Expand Down
4 changes: 2 additions & 2 deletions superset/views/chart/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from flask_appbuilder.models.sqla.interface import SQLAInterface
from flask_babel import lazy_gettext as _

from superset import app, db
from superset import db, is_feature_enabled
from superset.connectors.connector_registry import ConnectorRegistry
from superset.constants import RouteMethod
from superset.models.slice import Slice
Expand Down Expand Up @@ -74,7 +74,7 @@ def add(self) -> FlaskResponse:
@expose("/list/")
@has_access
def list(self) -> FlaskResponse:
if not app.config["ENABLE_REACT_CRUD_VIEWS"]:
if not is_feature_enabled("ENABLE_REACT_CRUD_VIEWS"):
return super().list()

return super().render_app_template()
Expand Down
4 changes: 2 additions & 2 deletions superset/views/css_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from flask_appbuilder.security.decorators import has_access
from flask_babel import lazy_gettext as _

from superset import app
from superset import is_feature_enabled
from superset.constants import RouteMethod
from superset.models import core as models
from superset.typing import FlaskResponse
Expand All @@ -45,7 +45,7 @@ class CssTemplateModelView( # pylint: disable=too-many-ancestors
@expose("/list/")
@has_access
def list(self) -> FlaskResponse:
if not app.config["ENABLE_REACT_CRUD_VIEWS"]:
if not is_feature_enabled("ENABLE_REACT_CRUD_VIEWS"):
return super().list()

return super().render_app_template()
Expand Down
4 changes: 2 additions & 2 deletions superset/views/dashboard/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from flask_appbuilder.security.decorators import has_access
from flask_babel import gettext as __, lazy_gettext as _

from superset import app, db, event_logger
from superset import db, event_logger, is_feature_enabled
from superset.constants import RouteMethod
from superset.models.dashboard import Dashboard as DashboardModel
from superset.typing import FlaskResponse
Expand Down Expand Up @@ -55,7 +55,7 @@ class DashboardModelView(
@has_access
@expose("/list/")
def list(self) -> FlaskResponse:
if not app.config["ENABLE_REACT_CRUD_VIEWS"]:
if not is_feature_enabled("ENABLE_REACT_CRUD_VIEWS"):
return super().list()

return super().render_app_template()
Expand Down
4 changes: 2 additions & 2 deletions superset/views/database/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from wtforms.validators import ValidationError

import superset.models.core as models
from superset import app, db
from superset import app, db, is_feature_enabled
from superset.connectors.sqla.models import SqlaTable
from superset.constants import RouteMethod
from superset.exceptions import CertificateException
Expand Down Expand Up @@ -98,7 +98,7 @@ def _delete(self, pk: int) -> None:
@expose("/list/")
@has_access
def list(self) -> FlaskResponse:
if not app.config["ENABLE_REACT_CRUD_VIEWS"]:
if not is_feature_enabled("ENABLE_REACT_CRUD_VIEWS"):
return super().list()

return super().render_app_template()
Expand Down
4 changes: 2 additions & 2 deletions superset/views/sql_lab.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from flask_appbuilder.security.decorators import has_access, has_access_api
from flask_babel import lazy_gettext as _

from superset import app, db
from superset import db, is_feature_enabled
from superset.constants import RouteMethod
from superset.models.sql_lab import Query, SavedQuery, TableSchema, TabState
from superset.typing import FlaskResponse
Expand Down Expand Up @@ -78,7 +78,7 @@ class SavedQueryView(
@expose("/list/")
@has_access
def list(self) -> FlaskResponse:
if not app.config["ENABLE_REACT_CRUD_VIEWS"]:
if not is_feature_enabled("ENABLE_REACT_CRUD_VIEWS"):
return super().list()

return super().render_app_template()
Expand Down
5 changes: 1 addition & 4 deletions tests/superset_test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"KV_STORE": True,
"SHARE_QUERIES_VIA_KV_STORE": True,
"ENABLE_TEMPLATE_PROCESSING": True,
"ENABLE_REACT_CRUD_VIEWS": os.environ.get("ENABLE_REACT_CRUD_VIEWS", False),
Copy link
Member Author

Choose a reason for hiding this comment

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

@ktmud this should hopefully resolve the issue.

}


Expand All @@ -73,11 +74,7 @@ def GET_FEATURE_FLAGS_FUNC(ff):
AUTH_ROLE_PUBLIC = "Public"
EMAIL_NOTIFICATIONS = False
ENABLE_ROW_LEVEL_SECURITY = True
ENABLE_REACT_CRUD_VIEWS = os.environ.get("ENABLE_REACT_CRUD_VIEWS", False)

CACHE_CONFIG = {"CACHE_TYPE": "simple"}


REDIS_HOST = os.environ.get("REDIS_HOST", "localhost")
REDIS_PORT = os.environ.get("REDIS_PORT", "6379")
REDIS_CELERY_DB = os.environ.get("REDIS_CELERY_DB", 2)
Expand Down