diff --git a/airflow/www/templates/airflow/providers.html b/airflow/www/templates/airflow/providers.html index a1fcb30ba7e15..30af8325594c0 100644 --- a/airflow/www/templates/airflow/providers.html +++ b/airflow/www/templates/airflow/providers.html @@ -40,7 +40,7 @@

{{ title }}

{% for provider in providers %} - {{ provider["package_name"] }} + {{ provider["package_name"] }} {{ provider["version"] }} {{ provider["description"]}} diff --git a/airflow/www/templates/appbuilder/navbar_menu.html b/airflow/www/templates/appbuilder/navbar_menu.html index d7abc8472f723..db2de352d3141 100644 --- a/airflow/www/templates/appbuilder/navbar_menu.html +++ b/airflow/www/templates/appbuilder/navbar_menu.html @@ -17,8 +17,20 @@ under the License. #} +{% set external_menu_url_prefixes = [ + 'https://github.com', + 'https://airflow.apache.org', + 'http://apache-airflow-docs.s3-website.eu-central-1.amazonaws.com'] +%} + {% macro menu_item(item) %} - {{_(item.label)}} + {% set url = item.get_url() %} + {% set prefix = "/".join(url.split("/")[:3]) %} + {% if prefix in external_menu_url_prefixes %} + {{ item.label }} + {% else %} + {{ item.label }} + {% endif %} {% endmacro %} {% for item1 in auth_manager.filter_permitted_menu_items(menu.get_list()) %} diff --git a/airflow/www/views.py b/airflow/www/views.py index c0fb881c85292..7ffd5ec17c4cc 100644 --- a/airflow/www/views.py +++ b/airflow/www/views.py @@ -4514,13 +4514,13 @@ def _build_link(match_obj): text = match_obj.group(1) url = match_obj.group(2) - # parsing the url to check if ita a valid url + # parsing the url to check if it's a valid url parsed_url = urlparse(url) if not (parsed_url.scheme == "http" or parsed_url.scheme == "https"): # returning the original raw text return escape(match_obj.group(0)) - return Markup(f'{text}') + return Markup(f'{text}') cd = escape(description) cd = re2.sub(r"`(.*)[\s+]+<(.*)>`__", _build_link, cd) diff --git a/chart/values.yaml b/chart/values.yaml index ed4aabb090a11..5fdfc63a9a335 100644 --- a/chart/values.yaml +++ b/chart/values.yaml @@ -245,7 +245,8 @@ airflowLocalSettings: |- UIAlert( 'Usage of a dynamic webserver secret key detected. We recommend a static webserver secret key instead.' ' See the ' + '"https://airflow.apache.org/docs/helm-chart/stable/production-guide.html#webserver-secret-key" ' + 'target="_blank" rel="noopener noreferrer">' 'Helm Chart Production Guide for more details.', category="warning", roles=["Admin"], diff --git a/tests/www/views/test_views.py b/tests/www/views/test_views.py index 4c8ccdc0a8b42..5cf425e99f4aa 100644 --- a/tests/www/views/test_views.py +++ b/tests/www/views/test_views.py @@ -137,7 +137,9 @@ def test_should_list_providers_on_page_with_details(admin_client): resp = admin_client.get("/provider") beam_href = '" - beam_description = 'Apache Beam' + beam_description = ( + 'Apache Beam' + ) check_content_in_response(beam_href, resp) check_content_in_response(beam_text, resp) check_content_in_response(beam_description, resp) @@ -147,20 +149,23 @@ def test_should_list_providers_on_page_with_details(admin_client): @pytest.mark.parametrize( "provider_description, expected", [ - ("`Airbyte `__", Markup('Airbyte')), + ( + "`Airbyte `__", + Markup('Airbyte'), + ), ( "Amazon integration (including `Amazon Web Services (AWS) `__).", Markup( - 'Amazon integration (including Amazon Web Services (' - "AWS))." + 'Amazon integration (including Amazon Web Services (AWS)).' ), ), ( "`Java Database Connectivity (JDBC) `__", Markup( - 'Java ' - "Database Connectivity (JDBC)" + 'Java Database Connectivity (JDBC)' ), ), (