Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Cleaning up ENABLE_REACT_CRUD_VIEWS config
Browse files Browse the repository at this point in the history
John Bodley committed Oct 29, 2020

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent f918ca1 commit 8c476b3
Showing 9 changed files with 22 additions and 27 deletions.
9 changes: 4 additions & 5 deletions superset/config.py
Original file line number Diff line number Diff line change
@@ -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,
@@ -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
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
4 changes: 2 additions & 2 deletions superset/connectors/sqla/views.py
Original file line number Diff line number Diff line change
@@ -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
@@ -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
@@ -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
@@ -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()

@@ -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()

4 changes: 2 additions & 2 deletions superset/views/chart/views.py
Original file line number Diff line number Diff line change
@@ -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
@@ -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()
4 changes: 2 additions & 2 deletions superset/views/css_templates.py
Original file line number Diff line number Diff line change
@@ -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
@@ -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()
4 changes: 2 additions & 2 deletions superset/views/dashboard/views.py
Original file line number Diff line number Diff line change
@@ -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
@@ -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()
4 changes: 2 additions & 2 deletions superset/views/database/views.py
Original file line number Diff line number Diff line change
@@ -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
@@ -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()
4 changes: 2 additions & 2 deletions superset/views/sql_lab.py
Original file line number Diff line number Diff line change
@@ -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
@@ -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()
5 changes: 1 addition & 4 deletions tests/superset_test_config.py
Original file line number Diff line number Diff line change
@@ -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),
}


@@ -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)

0 comments on commit 8c476b3

Please sign in to comment.