Skip to content
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

Display alert messages on dashboard from local settings #18284

Merged
merged 7 commits into from
Sep 20, 2021

Conversation

jedcunningham
Copy link
Member

@jedcunningham jedcunningham commented Sep 15, 2021

Allow alert messages to be displayed on the UI dashboard from
airflow_local_settings. This feature can be used to announce things to
all users, warn about setup limitations/issues, and probably other
things I haven't considered.

The message, category, and role(s) the flash message should be shown to
can be configured.

Here is an example:

In airflow_local_settings:

from airflow.www.utils import UIAlert
DASHBOARD_UIALERTS = [
    UIAlert("hello", category="error"),
    UIAlert("world", roles=["Viewer", "Admin"]),
    UIAlert('Visit <a href="https://airflow.apache.org">airflow.apache.org</a>', html=True),
    UIAlert("Only for users", roles=["Users"]),
]

View as an Admin user:
Screen Shot 2021-09-15 at 5 28 49 PM

View as a User user:
Screen Shot 2021-09-15 at 5 35 42 PM

related: #18098

@boring-cyborg boring-cyborg bot added the area:webserver Webserver related Issues label Sep 15, 2021
airflow/settings.py Outdated Show resolved Hide resolved
Copy link
Member

@kaxil kaxil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good -- we should add docs on it too

@github-actions github-actions bot added the full tests needed We need to run full set of tests for this PR to merge label Sep 17, 2021
@github-actions
Copy link

The PR most likely needs to run full matrix of tests because it modifies parts of the core of Airflow. However, committers might decide to merge it quickly and take the risk. If they don't merge it quickly - please rebase it to the latest main at your convenience, or amend the last commit of the PR, and push it with --force-with-lease.

@kaxil
Copy link
Member

kaxil commented Sep 17, 2021

Unrelated test failures:

=========================== short test summary info ============================
  FAILED tests/kubernetes/test_pod_generator.py::TestPodGenerator::test_construct_pod
  FAILED tests/kubernetes/test_pod_generator.py::TestPodGenerator::test_construct_pod_empty_executor_config
  FAILED tests/kubernetes/test_pod_generator.py::TestPodGenerator::test_deserialize_model_file
  FAILED tests/kubernetes/test_pod_generator.py::TestPodGenerator::test_gen_pod_extract_xcom
  FAILED tests/kubernetes/test_pod_generator.py::TestPodGenerator::test_reconcile_pods
  FAILED tests/kubernetes/test_pod_generator.py::TestPodGenerator::test_reconcile_pods_empty_mutator_pod
  ======= 6 failed, 506 passed, 15 skipped, 1 warning in 495.43s (0:08:15) =======
  

@uranusjr
Copy link
Member

parameters-ref.rst:2472: (pathType)  The pathType for the web Ingress (required for Kubernetes 1.19 and above).

File path: helm-chart/parameters-ref.rst
Incorrect Spelling: 'pathType'
Line with Error: 'The pathType for the web Ingress (required for Kubernetes 1.19 and above).'
Line Number: 2472

@kaxil
Copy link
Member

kaxil commented Sep 17, 2021

parameters-ref.rst:2472: (pathType)  The pathType for the web Ingress (required for Kubernetes 1.19 and above).

File path: helm-chart/parameters-ref.rst
Incorrect Spelling: 'pathType'
Line with Error: 'The pathType for the web Ingress (required for Kubernetes 1.19 and above).'
Line Number: 2472

That should be fixed by #18308

@kaxil kaxil force-pushed the flash_from_local_settings branch from 4c5e590 to 3adf6fb Compare September 17, 2021 11:49
@jedcunningham jedcunningham force-pushed the flash_from_local_settings branch from 3adf6fb to df0e9aa Compare September 17, 2021 20:32
@jedcunningham jedcunningham changed the title Display flash messages on dashboard from local settings Display alert messages on dashboard from local settings Sep 17, 2021
@jedcunningham jedcunningham added this to the Airflow 2.2.0 milestone Sep 20, 2021
@jedcunningham jedcunningham force-pushed the flash_from_local_settings branch from df0e9aa to 1b39c55 Compare September 20, 2021 14:39
@jedcunningham
Copy link
Member Author

The unrelated test_pod_generator failures should be fixed with #18384.

Allow flash messages to be displayed on the UI dashboard from
`airflow_local_settings`. This feature can be used to announce things to
all users, warn about setup limitations/issues, and probably other
things I haven't considered.

The message, category, and role(s) the flash message should be shown to
can be set, allowing for varied use of this feature.
@jedcunningham jedcunningham force-pushed the flash_from_local_settings branch from 45c469f to 3bf356a Compare September 20, 2021 18:21
@kaxil kaxil merged commit c686241 into apache:main Sep 20, 2021
@kaxil kaxil deleted the flash_from_local_settings branch September 20, 2021 23:07
@kaxil kaxil added the type:new-feature Changelog: New Features label Sep 20, 2021
@PApostol PApostol mentioned this pull request Jan 14, 2022
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:webserver Webserver related Issues full tests needed We need to run full set of tests for this PR to merge type:new-feature Changelog: New Features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants