From 270915384dbb5f78ff397bc3e94f8704ac2e5c4e Mon Sep 17 00:00:00 2001 From: Ash Berlin-Taylor Date: Wed, 3 Nov 2021 10:40:20 +0000 Subject: [PATCH] Fix message on "Mark as" confirmation page (#19363) In an earlier refactor I created a macro called `message` which "stomped" on the variable of the same name set in the view, meaning the page shows `` instead of the string we meant to set. This "fixes" it by using a less-likely-to-clash name for the macro (and fixing the typo in `dismissible` parameter.) --- airflow/www/templates/airflow/_messages.html | 4 ++-- airflow/www/templates/airflow/dags.html | 10 +++++----- airflow/www/templates/airflow/main.html | 6 +++--- airflow/www/templates/appbuilder/flash.html | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/airflow/www/templates/airflow/_messages.html b/airflow/www/templates/airflow/_messages.html index 56fa5050308fc..29a3a56fdfa01 100644 --- a/airflow/www/templates/airflow/_messages.html +++ b/airflow/www/templates/airflow/_messages.html @@ -16,9 +16,9 @@ specific language governing permissions and limitations under the License. #} -{%- macro message(content, category='info', dismissable=true) -%} +{%- macro show_message(content, category='info', dismissible=true) -%}
- {%- if dismissable -%} + {%- if dismissible -%} {%- endif -%} {%- if caller is defined -%} diff --git a/airflow/www/templates/airflow/dags.html b/airflow/www/templates/airflow/dags.html index 6ed8d63e6b182..791f4fc4e0110 100644 --- a/airflow/www/templates/airflow/dags.html +++ b/airflow/www/templates/airflow/dags.html @@ -19,7 +19,7 @@ {% extends base_template %} {% from 'appbuilder/loading_dots.html' import loading_dots %} -{% from 'airflow/_messages.html' import message %} +{% from 'airflow/_messages.html' import show_message %} {% block page_title %} {% if search_query %}"{{ search_query }}" - {% endif %}DAGs - {{ appbuilder.app_name }} @@ -50,10 +50,10 @@ {% block messages %} {% for m in dashboard_alerts %} - {{ message(m.message, m.category) }} + {{ show_message(m.message, m.category) }} {% endfor %} {% for original_table_name, moved_table_name in migration_moved_data_alerts %} - {% call message(category='error', dismissable=false) %} + {% call show_message(category='error', dismissible=false) %} Airflow found incompatible data in the {{ original_table_name }} table in the metadatabase, and has moved them to {{ moved_table_name }} during the database migration to upgrade. Please inspect the moved data to decide whether you need to keep them, and manually drop @@ -62,14 +62,14 @@ {% endfor %} {{ super() }} {% if sqlite_warning | default(true) %} - {% call message(category='warning', dismissable=false) %} + {% call show_message(category='warning', dismissible=false) %} Do not use SQLite as metadata DB in production – it should only be used for dev/testing We recommend using Postgres or MySQL. Click here for more information. {% endcall %} {% endif %} {% if sequential_executor_warning | default(false) %} - {% call message(category='warning', dismissable=false) %} + {% call show_message(category='warning', dismissible=false) %} Do not use SequentialExecutor in production. Click here for more information. {% endcall %} diff --git a/airflow/www/templates/airflow/main.html b/airflow/www/templates/airflow/main.html index f9190b43d0728..d57f5f0312000 100644 --- a/airflow/www/templates/airflow/main.html +++ b/airflow/www/templates/airflow/main.html @@ -18,7 +18,7 @@ #} {% extends 'appbuilder/baselayout.html' %} -{% from 'airflow/_messages.html' import message %} +{% from 'airflow/_messages.html' import show_message %} {% block page_title -%} {% if title is defined -%} @@ -52,7 +52,7 @@ {% block messages %} {% include 'appbuilder/flash.html' %} {% if scheduler_job is defined and (not scheduler_job or not scheduler_job.is_alive()) %} - {% call message(category='warning', dismissable=false) %} + {% call show_message(category='warning', dismissible=false) %}

The scheduler does not appear to be running. {% if scheduler_job %} Last heartbeat was received @@ -67,7 +67,7 @@ {% endcall %} {% endif %} {% if triggerer_job is defined and (not triggerer_job or not triggerer_job.is_alive()) %} - {% call message(category='warning', dismissable=false) %} + {% call show_message(category='warning', dismissible=false) %}

The triggerer does not appear to be running. {% if triggerer_job %} Last heartbeat was received diff --git a/airflow/www/templates/appbuilder/flash.html b/airflow/www/templates/appbuilder/flash.html index 0f97c9caee48b..fa1da7796b05a 100644 --- a/airflow/www/templates/appbuilder/flash.html +++ b/airflow/www/templates/appbuilder/flash.html @@ -35,7 +35,7 @@ {{ dag_import_errors.append((category, m)) if dag_import_errors.append((category, m)) != None else '' }} {% elif not (request.path == appbuilder.get_url_for_login and 'access is denied' in m.lower()) %} {# Don't show 'Access is Denied' alert if user is logged out and on the login page. #} - {{ message(m, category) }} + {{ show_message(m, category) }} {% endif %} {% endfor %} {% endif %}