This is an automated email from the ASF dual-hosted git repository.
jedcunningham 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 9990f87bc1 Allow override of navbar text color (#35505)
9990f87bc1 is described below
commit 9990f87bc1a30b6b41ca174877eba1ba790d9e7c
Author: Victor Chiapaikeo <[email protected]>
AuthorDate: Tue Nov 7 21:37:10 2023 -0500
Allow override of navbar text color (#35505)
---
airflow/config_templates/config.yml | 7 +++++++
airflow/www/extensions/init_jinja_globals.py | 1 +
airflow/www/templates/airflow/main.html | 5 +++++
tests/www/views/conftest.py | 1 +
4 files changed, 14 insertions(+)
diff --git a/airflow/config_templates/config.yml
b/airflow/config_templates/config.yml
index ffb9dce073..312d08c762 100644
--- a/airflow/config_templates/config.yml
+++ b/airflow/config_templates/config.yml
@@ -1614,6 +1614,13 @@ webserver:
type: string
example: ~
default: "#fff"
+ navbar_text_color:
+ description: |
+ Define the color of text in the navigation bar
+ version_added: 2.8.0
+ type: string
+ example: ~
+ default: ""
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 95cd9b8c26..097bbdb423 100644
--- a/airflow/www/extensions/init_jinja_globals.py
+++ b/airflow/www/extensions/init_jinja_globals.py
@@ -61,6 +61,7 @@ def init_jinja_globals(app):
"default_ui_timezone": default_ui_timezone,
"hostname": hostname,
"navbar_color": conf.get("webserver", "NAVBAR_COLOR"),
+ "navbar_text_color": conf.get("webserver", "NAVBAR_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 6a6b4156d2..a32ca7f15d 100644
--- a/airflow/www/templates/airflow/main.html
+++ b/airflow/www/templates/airflow/main.html
@@ -52,6 +52,11 @@
background-color: {{state_color}};
}
{% endfor %}
+ {% if navbar_text_color %}
+ .navbar-nav > li > a {
+ color: {{ navbar_text_color }};
+ }
+ {% endif %}
</style>
<link rel="icon" type="image/png" href="{{ url_for('static',
filename='pin_32.png') }}">
{% endblock %}
diff --git a/tests/www/views/conftest.py b/tests/www/views/conftest.py
index 1bde030388..aa531a8267 100644
--- a/tests/www/views/conftest.py
+++ b/tests/www/views/conftest.py
@@ -159,6 +159,7 @@ class _TemplateWithContext(NamedTuple):
"default_ui_timezone",
"hostname",
"navbar_color",
+ "navbar_text_color",
"log_fetch_delay_sec",
"log_auto_tailing_offset",
"log_animation_speed",