Skip to content
Open
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
18 changes: 15 additions & 3 deletions superset/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,20 +355,31 @@ def _try_json_readsha(filepath: str, length: int) -> str | None:
APP_NAME = "Superset"

# Specify the App icon
# NOTE: This variable is used to populate THEME_DEFAULT. If you override this in
# superset_config.py, you must also override THEME_DEFAULT to see the change,
# or set THEME_DEFAULT["token"]["brandLogoUrl"] directly.
APP_ICON = "/static/assets/images/superset-logo-horiz.png"

# Specify where clicking the logo would take the user'
# Specify where clicking the logo would take the user
# Default value of None will take you to '/superset/welcome'
# You can also specify a relative URL e.g. '/superset/welcome' or '/dashboards/list'
# or you can specify a full URL e.g. 'https://foo.bar'
# NOTE: This variable is used to populate THEME_DEFAULT. If you override this in
# superset_config.py, you must also override THEME_DEFAULT to see the change,
# or set THEME_DEFAULT["token"]["brandLogoHref"] directly.
LOGO_TARGET_PATH = None

# Specify tooltip that should appear when hovering over the App Icon/Logo
# NOTE: This variable is deprecated and not used in the new theme system.
LOGO_TOOLTIP = ""

# Specify any text that should appear to the right of the logo
# NOTE: This variable is deprecated and not used in the new theme system.
LOGO_RIGHT_TEXT: Callable[[], str] | str = ""

# APP_ICON_WIDTH is deprecated.
# Use THEME_DEFAULT["token"]["brandLogoHeight"] instead (default: "24px").

# Enables SWAGGER UI for superset openapi spec
# ex: http://localhost:8080/swagger/v1
FAB_API_SWAGGER_UI = True
Expand Down Expand Up @@ -780,9 +791,10 @@ class D3TimeFormat(TypedDict, total=False):
"brandLogoAlt": "Apache Superset",
"brandLogoUrl": APP_ICON,
"brandLogoMargin": "18px 0",
"brandLogoHref": "/",
"brandLogoHref": LOGO_TARGET_PATH or "/",
"brandLogoHeight": "24px",
# Spinner
# Spinner - Set this to use a custom GIF/image loader
# "brandSpinnerUrl": "/static/assets/images/loading.gif",
"brandSpinnerUrl": None,
"brandSpinnerSvg": None,
# Default colors
Expand Down
21 changes: 21 additions & 0 deletions tests/unit_tests/config_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,3 +312,24 @@ def test_full_setting(
assert dttm_col.is_dttm
assert dttm_col.python_date_format == "epoch_s"
assert dttm_col.expression == "CAST(dttm as INTEGER)"


def test_theme_default_logo_target_path() -> None:
"""
Test that THEME_DEFAULT properly uses LOGO_TARGET_PATH for brandLogoHref.

When LOGO_TARGET_PATH is None (default), brandLogoHref should be "/".
When LOGO_TARGET_PATH is set, it should be used instead.
"""
from superset import config

# Verify default behavior: LOGO_TARGET_PATH is None, so brandLogoHref is "/"
assert config.LOGO_TARGET_PATH is None
assert config.THEME_DEFAULT["token"]["brandLogoHref"] == "/"

# Verify the expression logic works correctly for custom values
custom_path = "https://example.com"
assert (custom_path or "/") == custom_path

# Verify APP_ICON is wired to brandLogoUrl
assert config.THEME_DEFAULT["token"]["brandLogoUrl"] == config.APP_ICON
Loading