This is an automated email from the ASF dual-hosted git repository.
eladkal pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new ba2ba7f493 Allow override of hovered navbar colors (#36631)
ba2ba7f493 is described below
commit ba2ba7f49395b528ea67611c423ddd71b64b8ede
Author: Nicolas Crocfer <[email protected]>
AuthorDate: Sat Jan 13 11:50:48 2024 +0100
Allow override of hovered navbar colors (#36631)
* Allow override of hovered navbar colors
Signed-off-by: Nicolas Crocfer <[email protected]>
* Update versions to the next minor release
Signed-off-by: Nicolas Crocfer <[email protected]>
* Allow override of the logo text color
Signed-off-by: Nicolas Crocfer <[email protected]>
---------
Signed-off-by: Nicolas Crocfer <[email protected]>
---
airflow/config_templates/config.yml | 21 +++++++++++++++++++++
airflow/www/extensions/init_jinja_globals.py | 3 +++
airflow/www/templates/airflow/main.html | 4 ++++
airflow/www/templates/appbuilder/navbar.html | 2 +-
tests/www/views/conftest.py | 3 +++
5 files changed, 32 insertions(+), 1 deletion(-)
diff --git a/airflow/config_templates/config.yml
b/airflow/config_templates/config.yml
index 79932a876a..3a53887b78 100644
--- a/airflow/config_templates/config.yml
+++ b/airflow/config_templates/config.yml
@@ -1641,6 +1641,27 @@ webserver:
type: string
example: ~
default: "#51504f"
+ navbar_hover_color:
+ description: |
+ Define the color of navigation bar links when hovered
+ version_added: 2.9.0
+ type: string
+ example: ~
+ default: "#eee"
+ navbar_text_hover_color:
+ description: |
+ Define the color of text in the navigation bar when hovered
+ version_added: 2.9.0
+ type: string
+ example: ~
+ default: "#51504f"
+ navbar_logo_text_color:
+ description: |
+ Define the color of the logo text
+ version_added: 2.9.0
+ type: string
+ example: ~
+ default: "#51504f"
default_dag_run_display_number:
description: |
Default dagrun to show in UI
diff --git a/airflow/www/extensions/init_jinja_globals.py
b/airflow/www/extensions/init_jinja_globals.py
index 097bbdb423..8e92c1fd09 100644
--- a/airflow/www/extensions/init_jinja_globals.py
+++ b/airflow/www/extensions/init_jinja_globals.py
@@ -62,6 +62,9 @@ def init_jinja_globals(app):
"hostname": hostname,
"navbar_color": conf.get("webserver", "NAVBAR_COLOR"),
"navbar_text_color": conf.get("webserver", "NAVBAR_TEXT_COLOR"),
+ "navbar_hover_color": conf.get("webserver", "NAVBAR_HOVER_COLOR"),
+ "navbar_text_hover_color": conf.get("webserver",
"NAVBAR_TEXT_HOVER_COLOR"),
+ "navbar_logo_text_color": conf.get("webserver",
"NAVBAR_LOGO_TEXT_COLOR"),
"log_fetch_delay_sec": conf.getint("webserver",
"log_fetch_delay_sec", fallback=2),
"log_auto_tailing_offset": conf.getint("webserver",
"log_auto_tailing_offset", fallback=30),
"log_animation_speed": conf.getint("webserver",
"log_animation_speed", fallback=1000),
diff --git a/airflow/www/templates/airflow/main.html
b/airflow/www/templates/airflow/main.html
index a8003b3ea2..69daa701d2 100644
--- a/airflow/www/templates/airflow/main.html
+++ b/airflow/www/templates/airflow/main.html
@@ -55,6 +55,10 @@
.navbar-nav > li > a {
color: {{ navbar_text_color }};
}
+ .navbar-nav > li > a:hover {
+ background-color: {{ navbar_hover_color }};
+ color: {{ navbar_text_hover_color }};
+ }
</style>
<link rel="icon" type="image/png" href="{{ url_for('static',
filename='pin_32.png') }}">
{% endblock %}
diff --git a/airflow/www/templates/appbuilder/navbar.html
b/airflow/www/templates/appbuilder/navbar.html
index 0cab0eb0f1..f3320c3c00 100644
--- a/airflow/www/templates/appbuilder/navbar.html
+++ b/airflow/www/templates/appbuilder/navbar.html
@@ -41,7 +41,7 @@
<path fill-rule="evenodd" clip-rule="evenodd" d="M4.4028
16.9752C6.32267 15.0072 10.1207 14.0942 17.953 17.867C15.2128 11.7354 11.6107
9.58661 10.5795 10.6437L4.4028 16.9752Z" fill="#0cb6ff"/>
<path d="M17.9649 18.6209C18.3825 18.6157 18.7169 18.273 18.7117
17.8553C18.7065 17.4377 18.3638 17.1034 17.9462 17.1085C17.5285 17.1137 17.1942
17.4564 17.1994 17.8741C17.2045 18.2917 17.5473 18.626 17.9649 18.6209Z"
fill="#4a4848"/>
</g>
- <path d="M38.9349 24.0977C38.8442 24.0977 38.765 24.0636 38.6969
23.9957C38.629 23.9276 38.5949 23.8484 38.5949 23.7577C38.5949 23.6669 38.6006
23.6048 38.612 23.5707L42.8273 12.5738C42.9178 12.3245 43.0992 12.1999 43.3712
12.1999H44.5269C44.7988 12.1999 44.98 12.3245 45.0708 12.5738L49.269
23.5707L49.3029 23.7577C49.3029 23.8484 49.269 23.9276 49.2009 23.9957C49.133
24.0636 49.0536 24.0977 48.9631 24.0977H48.0962C47.9715 24.0977 47.8753 24.0693
47.8072 24.0128C47.7393 23.9447 [...]
+ <path d="M38.9349 24.0977C38.8442 24.0977 38.765 24.0636 38.6969
23.9957C38.629 23.9276 38.5949 23.8484 38.5949 23.7577C38.5949 23.6669 38.6006
23.6048 38.612 23.5707L42.8273 12.5738C42.9178 12.3245 43.0992 12.1999 43.3712
12.1999H44.5269C44.7988 12.1999 44.98 12.3245 45.0708 12.5738L49.269
23.5707L49.3029 23.7577C49.3029 23.8484 49.269 23.9276 49.2009 23.9957C49.133
24.0636 49.0536 24.0977 48.9631 24.0977H48.0962C47.9715 24.0977 47.8753 24.0693
47.8072 24.0128C47.7393 23.9447 [...]
</svg>
</a>
</div>
diff --git a/tests/www/views/conftest.py b/tests/www/views/conftest.py
index 14822b5eaf..a44aa8238f 100644
--- a/tests/www/views/conftest.py
+++ b/tests/www/views/conftest.py
@@ -160,6 +160,9 @@ class _TemplateWithContext(NamedTuple):
"hostname",
"navbar_color",
"navbar_text_color",
+ "navbar_hover_color",
+ "navbar_text_hover_color",
+ "navbar_logo_text_color",
"log_fetch_delay_sec",
"log_auto_tailing_offset",
"log_animation_speed",