Skip to content

docs: add docs for custom alert messages #50273

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions airflow-core/docs/howto/customize-ui.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified airflow-core/docs/img/ui-alert-message.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.