mirror of
https://github.com/apache/superset.git
synced 2024-09-18 19:49:37 -04:00
feat: config to customize bootstrap data overrides (#16386)
* feat: config to customize bootstrap data overrides * comments
This commit is contained in:
parent
a6aad52e38
commit
486ef6b81f
@ -428,6 +428,20 @@ FEATURE_FLAGS: Dict[str, bool] = {}
|
|||||||
# return feature_flags_dict
|
# return feature_flags_dict
|
||||||
GET_FEATURE_FLAGS_FUNC: Optional[Callable[[Dict[str, bool]], Dict[str, bool]]] = None
|
GET_FEATURE_FLAGS_FUNC: Optional[Callable[[Dict[str, bool]], Dict[str, bool]]] = None
|
||||||
|
|
||||||
|
# A function that expands/overrides the frontend `bootstrap_data.common` object.
|
||||||
|
# Can be used to implement custom frontend functionality,
|
||||||
|
# or dynamically change certain configs.
|
||||||
|
#
|
||||||
|
# Values in `bootstrap_data.common` should have these characteristics:
|
||||||
|
# - They are not specific to a page the user is visiting
|
||||||
|
# - They do not contain secrets
|
||||||
|
#
|
||||||
|
# Takes as a parameter the common bootstrap payload before transformations.
|
||||||
|
# Returns a dict containing data that should be added or overridden to the payload.
|
||||||
|
COMMON_BOOTSTRAP_OVERRIDES_FUNC: Callable[
|
||||||
|
[Dict[str, Any]], Dict[str, Any]
|
||||||
|
] = lambda data: {} # default: empty dict
|
||||||
|
|
||||||
# EXTRA_CATEGORICAL_COLOR_SCHEMES is used for adding custom categorical color schemes
|
# EXTRA_CATEGORICAL_COLOR_SCHEMES is used for adding custom categorical color schemes
|
||||||
# example code for "My custom warm to hot" color scheme
|
# example code for "My custom warm to hot" color scheme
|
||||||
# EXTRA_CATEGORICAL_COLOR_SCHEMES = [
|
# EXTRA_CATEGORICAL_COLOR_SCHEMES = [
|
||||||
|
@ -346,7 +346,7 @@ def common_bootstrap_payload() -> Dict[str, Any]:
|
|||||||
messages = get_flashed_messages(with_categories=True)
|
messages = get_flashed_messages(with_categories=True)
|
||||||
locale = str(get_locale())
|
locale = str(get_locale())
|
||||||
|
|
||||||
return {
|
bootstrap_data = {
|
||||||
"flash_messages": messages,
|
"flash_messages": messages,
|
||||||
"conf": {k: conf.get(k) for k in FRONTEND_CONF_KEYS},
|
"conf": {k: conf.get(k) for k in FRONTEND_CONF_KEYS},
|
||||||
"locale": locale,
|
"locale": locale,
|
||||||
@ -357,6 +357,8 @@ def common_bootstrap_payload() -> Dict[str, Any]:
|
|||||||
"theme_overrides": conf["THEME_OVERRIDES"],
|
"theme_overrides": conf["THEME_OVERRIDES"],
|
||||||
"menu_data": menu_data(),
|
"menu_data": menu_data(),
|
||||||
}
|
}
|
||||||
|
bootstrap_data.update(conf["COMMON_BOOTSTRAP_OVERRIDES_FUNC"](bootstrap_data))
|
||||||
|
return bootstrap_data
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=invalid-name
|
# pylint: disable=invalid-name
|
||||||
|
Loading…
Reference in New Issue
Block a user