You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/09/16 04:13:17 UTC

[GitHub] [airflow] uranusjr commented on a change in pull request #18284: Display flash messages on dashboard from local settings

uranusjr commented on a change in pull request #18284:
URL: https://github.com/apache/airflow/pull/18284#discussion_r709738679



##########
File path: airflow/settings.py
##########
@@ -519,3 +520,13 @@ def initialize():
 # By default this is off, but is automatically configured on when running task
 # instances
 MASK_SECRETS_IN_LOGS = False
+
+# Display flash messages on the dashboard
+# Useful for warning about setup issues or announcing changes to end users
+# You can choose what role(s) the message will be shown to as well, or pass None to show to all users
+# (message, category, [role(s)]), for example:
+# ("Airflow update happening next week", "warning", ["User"])
+# You can also pass the message as flask.Markup to include HTML in the message:
+# (Markup('Visit <a href="http://airflow.apache.org">airflow.apache.org</a>'), "info", None)
+FlashMessage = Tuple[Union[str, Markup], str, Optional[str]]

Review comment:
       A custom class feels like a good idea to me. We can also prevent explicitly depending on `Markup` for simple cases e.g. `FlashMessage("<a href="example.com">Example</a>", html=True)`. Although `Markup` would still be needed if the user needs more elaborated stuff like `.format()`.
   
   Speaking of `format()`, we should add to the documentation (which I assume will come later) the implied danger using raw HTML and how to do thing property (I think MarkupSafe has some writeup on this). Maybe we should also ask Andrew how these things are handled in Django-land.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org