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

feat(tags): move tags from navbar to settings #24518

Merged
merged 5 commits into from
Jun 28, 2023
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
13 changes: 5 additions & 8 deletions requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ alembic==1.6.5
# via flask-migrate
amqp==5.1.0
# via kombu
apispec[yaml]==3.3.2
apispec[yaml]==6.3.0
# via flask-appbuilder
async-timeout==4.0.2
# via redis
Expand Down Expand Up @@ -88,7 +88,7 @@ flask==2.2.5
# flask-migrate
# flask-sqlalchemy
# flask-wtf
flask-appbuilder==4.3.2
flask-appbuilder==4.3.3
# via apache-superset
flask-babel==1.0.0
# via flask-appbuilder
Expand Down Expand Up @@ -122,8 +122,6 @@ geographiclib==1.52
# via geopy
geopy==2.2.0
# via apache-superset
greenlet==2.0.2
# via sqlalchemy
gunicorn==20.1.0
# via apache-superset
hashids==1.3.1
Expand Down Expand Up @@ -172,13 +170,10 @@ markupsafe==2.1.1
# mako
# werkzeug
# wtforms
marshmallow==3.13.0
marshmallow==3.19.0
# via
# flask-appbuilder
# marshmallow-enum
# marshmallow-sqlalchemy
marshmallow-enum==1.5.1
# via flask-appbuilder
marshmallow-sqlalchemy==0.23.1
# via flask-appbuilder
mdurl==0.1.2
Expand All @@ -197,8 +192,10 @@ ordered-set==4.1.0
packaging==23.1
# via
# apache-superset
# apispec
# deprecation
# limits
# marshmallow
pandas==1.5.3
# via apache-superset
paramiko==2.11.0
Expand Down
4 changes: 4 additions & 0 deletions requirements/docker.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
# -r requirements/docker.in
gevent==22.10.2
# via -r requirements/docker.in
greenlet==2.0.2
# via
# -r requirements/docker.in
# gevent
psycopg2-binary==2.9.6
# via apache-superset
zope-event==4.5.0
Expand Down
11 changes: 8 additions & 3 deletions requirements/integration.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ packaging==23.1
# pyproject-api
# tox
pip-compile-multi==2.6.3
# via -r integration.in
# via -r requirements/integration.in
pip-tools==6.13.0
# via pip-compile-multi
platformdirs==3.5.3
Expand All @@ -45,17 +45,22 @@ platformdirs==3.5.3
pluggy==1.0.0
# via tox
pre-commit==3.3.3
# via -r integration.in
# via -r requirements/integration.in
pyproject-api==1.5.1
# via tox
pyproject-hooks==1.0.0
# via build
pyyaml==5.4.1
# via pre-commit
tomli==2.0.1
# via
# build
# pyproject-api
# tox
toposort==1.10
# via pip-compile-multi
tox==4.6.1
# via -r integration.in
# via -r requirements/integration.in
virtualenv==20.23.0
# via
# pre-commit
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ combine_as_imports = true
include_trailing_comma = true
line_length = 88
known_first_party = superset
known_third_party =alembic,apispec,backoff,cachelib,celery,click,colorama,cron_descriptor,croniter,cryptography,dateutil,deprecation,flask,flask_appbuilder,flask_babel,flask_caching,flask_compress,flask_jwt_extended,flask_login,flask_migrate,flask_sqlalchemy,flask_talisman,flask_testing,flask_wtf,freezegun,geohash,geopy,holidays,humanize,isodate,jinja2,jwt,markdown,markupsafe,marshmallow,marshmallow_enum,msgpack,nh3,numpy,pandas,parameterized,parsedatetime,pgsanity,pkg_resources,polyline,prison,progress,pyarrow,sqlalchemy_bigquery,pyhive,pyparsing,pytest,pytest_mock,pytz,redis,requests,selenium,setuptools,simplejson,slack,sqlalchemy,sqlalchemy_utils,sqlparse,typing_extensions,urllib3,werkzeug,wtforms,wtforms_json,yaml
known_third_party =alembic,apispec,backoff,cachelib,celery,click,colorama,cron_descriptor,croniter,cryptography,dateutil,deprecation,flask,flask_appbuilder,flask_babel,flask_caching,flask_compress,flask_jwt_extended,flask_login,flask_migrate,flask_sqlalchemy,flask_talisman,flask_testing,flask_wtf,freezegun,geohash,geopy,holidays,humanize,isodate,jinja2,jwt,markdown,markupsafe,marshmallow,msgpack,nh3,numpy,pandas,parameterized,parsedatetime,pgsanity,pkg_resources,polyline,prison,progress,pyarrow,sqlalchemy_bigquery,pyhive,pyparsing,pytest,pytest_mock,pytz,redis,requests,selenium,setuptools,simplejson,slack,sqlalchemy,sqlalchemy_utils,sqlparse,typing_extensions,urllib3,werkzeug,wtforms,wtforms_json,yaml
multi_line_output = 3
order_by_type = false

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def get_git_sha() -> str:
"cryptography>=39.0.1, <40",
"deprecation>=2.1.0, <2.2.0",
"flask>=2.2.5, <3.0.0",
"flask-appbuilder>=4.3.2, <5.0.0",
"flask-appbuilder>=4.3.3, <5.0.0",
"flask-caching>=1.10.1, <1.11",
"flask-compress>=1.13, <2.0",
"flask-talisman>=1.0.0, <2.0",
Expand Down
1 change: 0 additions & 1 deletion superset/charts/commands/warm_up_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@


class ChartWarmUpCacheCommand(BaseCommand):
# pylint: disable=too-many-arguments
def __init__(
self,
chart_or_id: Union[int, Slice],
Expand Down
9 changes: 4 additions & 5 deletions superset/charts/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
from flask_babel import gettext as _
from marshmallow import EXCLUDE, fields, post_load, Schema, validate
from marshmallow.validate import Length, Range
from marshmallow_enum import EnumField

from superset import app
from superset.common.chart_data import ChartDataResultFormat, ChartDataResultType
Expand Down Expand Up @@ -153,7 +152,7 @@
class TagSchema(Schema):
id = fields.Int()
name = fields.String()
type = EnumField(TagTypes, by_value=True)
type = fields.Enum(TagTypes, by_value=True)


class ChartEntityResponseSchema(Schema):
Expand Down Expand Up @@ -1127,7 +1126,7 @@ class Meta: # pylint: disable=too-few-public-methods
unknown = EXCLUDE

datasource = fields.Nested(ChartDataDatasourceSchema, allow_none=True)
result_type = EnumField(ChartDataResultType, by_value=True, allow_none=True)
result_type = fields.Enum(ChartDataResultType, by_value=True, allow_none=True)

annotation_layers = fields.List(
fields.Nested(AnnotationLayerSchema),
Expand Down Expand Up @@ -1369,8 +1368,8 @@ class ChartDataQueryContextSchema(Schema):
allow_none=True,
)

result_type = EnumField(ChartDataResultType, by_value=True)
result_format = EnumField(ChartDataResultFormat, by_value=True)
result_type = fields.Enum(ChartDataResultType, by_value=True)
result_format = fields.Enum(ChartDataResultFormat, by_value=True)

form_data = fields.Raw(allow_none=True, required=False)

Expand Down
3 changes: 1 addition & 2 deletions superset/dashboards/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

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
Expand Down Expand Up @@ -174,7 +173,7 @@ class RolesSchema(Schema):
class TagSchema(Schema):
id = fields.Int()
name = fields.String()
type = EnumField(TagTypes, by_value=True)
type = fields.Enum(TagTypes, by_value=True)


class DashboardGetResponseSchema(Schema):
Expand Down
4 changes: 1 addition & 3 deletions superset/databases/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,9 +383,7 @@ def post(self) -> FlaskResponse:

# Return SSH Tunnel and hide passwords if any
if item.get("ssh_tunnel"):
item["ssh_tunnel"] = mask_password_info(
new_model.ssh_tunnel # pylint: disable=no-member
)
item["ssh_tunnel"] = mask_password_info(new_model.ssh_tunnel)

return self.response(201, id=new_model.id, result=item)
except DatabaseInvalidError as ex:
Expand Down
5 changes: 2 additions & 3 deletions superset/databases/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
from flask_babel import lazy_gettext as _
from marshmallow import EXCLUDE, fields, pre_load, Schema, validates_schema
from marshmallow.validate import Length, ValidationError
from marshmallow_enum import EnumField
from sqlalchemy import MetaData

from superset import db, is_feature_enabled
Expand Down Expand Up @@ -254,7 +253,7 @@ class DatabaseParametersSchemaMixin: # pylint: disable=too-few-public-methods
values=fields.Raw(),
metadata={"description": "DB-specific parameters for configuration"},
)
configuration_method = EnumField(
configuration_method = fields.Enum(
ConfigurationMethod,
by_value=True,
metadata={"description": configuration_method_description},
Expand Down Expand Up @@ -387,7 +386,7 @@ class Meta: # pylint: disable=too-few-public-methods
allow_none=True,
validate=server_cert_validator,
)
configuration_method = EnumField(
configuration_method = fields.Enum(
ConfigurationMethod,
by_value=True,
required=True,
Expand Down
1 change: 0 additions & 1 deletion superset/datasets/commands/warm_up_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@


class DatasetWarmUpCacheCommand(BaseCommand):
# pylint: disable=too-many-arguments
def __init__(
self,
db_name: str,
Expand Down
11 changes: 2 additions & 9 deletions superset/initialization/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def init_views(self) -> None:
from superset.sqllab.api import SqlLabRestApi
from superset.tags.api import TagRestApi
from superset.views.alerts import AlertView, ReportView
from superset.views.all_entities import TaggedObjectsModelView, TaggedObjectView
from superset.views.all_entities import TaggedObjectView
from superset.views.annotations import AnnotationLayerView
from superset.views.api import Api
from superset.views.chart.views import SliceAsync, SliceModelView
Expand Down Expand Up @@ -366,20 +366,13 @@ def init_views(self) -> None:
category="SQL Lab",
category_label=__("SQL Lab"),
)
appbuilder.add_view(
TaggedObjectsModelView,
"All Entities",
label=__("All Entities"),
icon="",
category_icon="",
menu_cond=lambda: feature_flag_manager.is_feature_enabled("TAGGING_SYSTEM"),
)
appbuilder.add_view(
TagModelView,
"Tags",
label=__("Tags"),
icon="",
category_icon="",
category="Manage",
menu_cond=lambda: feature_flag_manager.is_feature_enabled("TAGGING_SYSTEM"),
)
appbuilder.add_api(LogRestApi)
Expand Down
5 changes: 2 additions & 3 deletions superset/reports/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
from flask_babel import gettext as _
from marshmallow import fields, Schema, validate, validates_schema
from marshmallow.validate import Length, Range, ValidationError
from marshmallow_enum import EnumField
from pytz import all_timezones

from superset.reports.models import (
Expand Down Expand Up @@ -168,7 +167,7 @@ class ReportSchedulePostSchema(Schema):
}
)
chart = fields.Integer(required=False, allow_none=True)
creation_method = EnumField(
creation_method = fields.Enum(
ReportCreationMethod,
by_value=True,
required=False,
Expand Down Expand Up @@ -265,7 +264,7 @@ class ReportSchedulePutSchema(Schema):
allow_none=True,
)
chart = fields.Integer(required=False, allow_none=True)
creation_method = EnumField(
creation_method = fields.Enum(
ReportCreationMethod,
by_value=True,
allow_none=True,
Expand Down
3 changes: 1 addition & 2 deletions superset/security/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
from flask_appbuilder.security.decorators import permission_name, protect
from flask_wtf.csrf import generate_csrf
from marshmallow import EXCLUDE, fields, post_load, Schema, ValidationError
from marshmallow_enum import EnumField

from superset.embedded_dashboard.commands.exceptions import (
EmbeddedDashboardNotFoundError,
Expand Down Expand Up @@ -51,7 +50,7 @@ class UserSchema(PermissiveSchema):


class ResourceSchema(PermissiveSchema):
type = EnumField(GuestTokenResourceType, by_value=True, required=True)
type = fields.Enum(GuestTokenResourceType, by_value=True, required=True)
id = fields.String(required=True)

@post_load
Expand Down
2 changes: 1 addition & 1 deletion tests/integration_tests/base_api_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def test_default_missing_declaration_put_spec(self):
self.assertEqual(rv.status_code, 200)
response = json.loads(rv.data.decode("utf-8"))
expected_mutation_spec = {
"properties": {"id": {"format": "int32", "type": "integer"}},
"properties": {"id": {"type": "integer"}},
"type": "object",
}
self.assertEqual(
Expand Down
15 changes: 10 additions & 5 deletions tests/integration_tests/databases/api_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,11 @@ def test_create_database_invalid_configuration_method(self):
rv = self.client.post(uri, json=database_data)
response = json.loads(rv.data.decode("utf-8"))
assert response == {
"message": {"configuration_method": ["Invalid enum value BAD_FORM"]}
"message": {
"configuration_method": [
"Must be one of: sqlalchemy_form, dynamic_form."
]
}
}
assert rv.status_code == 400

Expand Down Expand Up @@ -1113,7 +1117,11 @@ def test_update_database_with_invalid_configuration_method(self):
rv = self.client.put(uri, json=database_data)
response = json.loads(rv.data.decode("utf-8"))
assert response == {
"message": {"configuration_method": ["Invalid enum value BAD_FORM"]}
"message": {
"configuration_method": [
"Must be one of: sqlalchemy_form, dynamic_form."
]
}
}
assert rv.status_code == 400

Expand Down Expand Up @@ -2873,7 +2881,6 @@ def test_available(self, app, get_available_engine_specs):
},
"port": {
"description": "Database port",
"format": "int32",
"maximum": 65536,
"minimum": 0,
"type": "integer",
Expand Down Expand Up @@ -2948,7 +2955,6 @@ def test_available(self, app, get_available_engine_specs):
},
"port": {
"description": "Database port",
"format": "int32",
"maximum": 65536,
"minimum": 0,
"type": "integer",
Expand Down Expand Up @@ -3023,7 +3029,6 @@ def test_available(self, app, get_available_engine_specs):
},
"port": {
"description": "Database port",
"format": "int32",
"maximum": 65536,
"minimum": 0,
"type": "integer",
Expand Down
1 change: 0 additions & 1 deletion tests/integration_tests/db_engine_specs/postgres_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,6 @@ def test_base_parameters_mixin():
"database": {"type": "string", "description": "Database name"},
"port": {
"type": "integer",
"format": "int32",
"minimum": 0,
"maximum": 65536,
"description": "Database port",
Expand Down
6 changes: 5 additions & 1 deletion tests/integration_tests/reports/api_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1249,7 +1249,11 @@ def test_create_report_schedule_invalid_creation_method(self):
rv = self.post_assert_metric(uri, report_schedule_data, "post")
response = json.loads(rv.data.decode("utf-8"))
assert response == {
"message": {"creation_method": ["Invalid enum value BAD_CREATION_METHOD"]}
"message": {
"creation_method": [
"Must be one of: charts, dashboards, alerts_reports."
]
}
}
assert rv.status_code == 400

Expand Down
1 change: 0 additions & 1 deletion tests/unit_tests/db_engine_specs/test_databricks.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ def test_parameters_json_schema() -> None:
"http_path": {"type": "string"},
"port": {
"description": "Database port",
"format": "int32",
"maximum": 65536,
"minimum": 0,
"type": "integer",
Expand Down