|
64 | 64 | .. note::
|
65 | 65 |
|
66 | 66 | 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``.
|
| 67 | + |
| 68 | + |
| 69 | +Add custom alert messages on the dashboard |
| 70 | +------------------------------------------ |
| 71 | + |
| 72 | +Extra alert messages can be shown on the UI dashboard. This can be useful for warning about setup issues |
| 73 | +or announcing changes to end users. The following example shows how to add alert messages: |
| 74 | + |
| 75 | +1. Add the following contents to ``airflow_local_settings.py`` file under ``$AIRFLOW_HOME/config``. |
| 76 | + Each alert message should specify a severity level (``info``, ``warning``, ``error``) using ``category``. |
| 77 | + |
| 78 | + .. code-block:: python |
| 79 | +
|
| 80 | + from airflow.api_fastapi.common.types import UIAlert |
| 81 | +
|
| 82 | + DASHBOARD_UIALERTS = [ |
| 83 | + UIAlert(text="Welcome to Airflow.", category="info"), |
| 84 | + UIAlert(text="Airflow server downtime scheduled for tomorrow at 10:00 AM.", category="warning"), |
| 85 | + UIAlert(text="Critical error detected!", category="error"), |
| 86 | + ] |
| 87 | +
|
| 88 | + See :ref:`Configuring local settings <set-config:configuring-local-settings>` for details on how to |
| 89 | + configure local settings. |
| 90 | + |
| 91 | +2. Restart Airflow Webserver, and you should now see: |
| 92 | + |
| 93 | +.. image:: ../img/ui-alert-message.png |
| 94 | + |
| 95 | +Alert messages also support Markdown. In the following example, we show an alert message of heading 2 with a link included. |
| 96 | + |
| 97 | + .. code-block:: python |
| 98 | +
|
| 99 | + DASHBOARD_UIALERTS = [ |
| 100 | + UIAlert(text="## Visit [airflow.apache.org](https://airflow.apache.org)", category="info"), |
| 101 | + ] |
| 102 | +
|
| 103 | +.. image:: ../img/ui-alert-message-markdown.png |
0 commit comments