You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by ka...@apache.org on 2025/08/26 21:57:50 UTC
(airflow) 02/03: [v3-0-test] docs: add docs for custom alert messages (#50273) (#54955)
This is an automated email from the ASF dual-hosted git repository.
kaxilnaik pushed a commit to branch v3-0-test
in repository https://gitbox.apache.org/repos/asf/airflow.git
commit 1ea36e8ac635c55aff6576c54a05bf5a1b80134c
Author: github-actions[bot] <41...@users.noreply.github.com>
AuthorDate: Tue Aug 26 22:31:00 2025 +0200
[v3-0-test] docs: add docs for custom alert messages (#50273) (#54955)
(cherry picked from commit 8583fbaa3d02ee27dd1f6870eb3e3b879bc87ac4)
Co-authored-by: Zhen-Lun (Kevin) Hong <ke...@yahoo.com.tw>
---
airflow-core/docs/howto/customize-ui.rst | 37 +++++++++++++++++++++
.../docs/img/ui-alert-message-markdown.png | Bin 0 -> 45266 bytes
airflow-core/docs/img/ui-alert-message.png | Bin 48753 -> 42025 bytes
3 files changed, 37 insertions(+)
diff --git a/airflow-core/docs/howto/customize-ui.rst b/airflow-core/docs/howto/customize-ui.rst
index 2378fe39747..85947c87e0d 100644
--- a/airflow-core/docs/howto/customize-ui.rst
+++ b/airflow-core/docs/howto/customize-ui.rst
@@ -64,3 +64,40 @@ After
.. note::
From version 2.3.0 you can include markup in ``instance_name`` variable for further customization. To enable, set ``instance_name_has_markup`` under the ``[webserver]`` section inside ``airflow.cfg`` to ``True``.
+
+
+Add custom alert messages on the dashboard
+------------------------------------------
+
+Extra alert messages can be shown on the UI dashboard. This can be useful for warning about setup issues
+or announcing changes to end users. The following example shows how to add alert messages:
+
+1. Add the following contents to ``airflow_local_settings.py`` file under ``$AIRFLOW_HOME/config``.
+ Each alert message should specify a severity level (``info``, ``warning``, ``error``) using ``category``.
+
+ .. code-block:: python
+
+ from airflow.api_fastapi.common.types import UIAlert
+
+ DASHBOARD_UIALERTS = [
+ UIAlert(text="Welcome to Airflow.", category="info"),
+ UIAlert(text="Airflow server downtime scheduled for tomorrow at 10:00 AM.", category="warning"),
+ UIAlert(text="Critical error detected!", category="error"),
+ ]
+
+ See :ref:`Configuring local settings <set-config:configuring-local-settings>` for details on how to
+ configure local settings.
+
+2. Restart Airflow Webserver, and you should now see:
+
+.. image:: ../img/ui-alert-message.png
+
+Alert messages also support Markdown. In the following example, we show an alert message of heading 2 with a link included.
+
+ .. code-block:: python
+
+ DASHBOARD_UIALERTS = [
+ UIAlert(text="## Visit [airflow.apache.org](https://airflow.apache.org)", category="info"),
+ ]
+
+.. image:: ../img/ui-alert-message-markdown.png
diff --git a/airflow-core/docs/img/ui-alert-message-markdown.png b/airflow-core/docs/img/ui-alert-message-markdown.png
new file mode 100755
index 00000000000..39b7843cad7
Binary files /dev/null and b/airflow-core/docs/img/ui-alert-message-markdown.png differ
diff --git a/airflow-core/docs/img/ui-alert-message.png b/airflow-core/docs/img/ui-alert-message.png
index 5f436f9a0ae..2e419b8de8c 100644
Binary files a/airflow-core/docs/img/ui-alert-message.png and b/airflow-core/docs/img/ui-alert-message.png differ