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

Don't use flash for "same-page" UI messages. #18462

Merged
merged 1 commit into from
Sep 24, 2021

Conversation

ashb
Copy link
Member

@ashb ashb commented Sep 23, 2021

The flash is designed for setting a message on one page and then showing
it after a redirect, so in the case of these UI warnings they were being
shown twice due to an early redirect.

I could have chosen to fix this by moving the checks to after the
reset_tags redirect, but it also felt wrong to me to have HTML in
the view, so I have chosen to move it in to the template where it
belongs.

To (marginally) reduce boilerplate I have created message() "macro"
(Jinja macro, a.k.a. function; not to be confused with what Airflow
templates call a macro, but is in fact just a template global) that
handles the formatting for messages.

Closes #17727

@boring-cyborg boring-cyborg bot added area:UI Related to UI/UX. For Frontend Developers. area:webserver Webserver related Issues labels Sep 23, 2021
Copy link
Contributor

@bbovenzi bbovenzi left a comment

Choose a reason for hiding this comment

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

UX wise this does solve the issue but I don't know jinja well enough to find any critiques.

@github-actions github-actions bot added the okay to merge It's ok to merge this PR as it does not require more tests label Sep 23, 2021
@github-actions
Copy link

The PR is likely OK to be merged with just subset of tests for default Python and Database versions without running the full matrix of tests, because it does not modify the core of Airflow. If the committers decide that the full tests matrix is needed, they will add the label 'full tests needed'. Then you should rebase to the latest main or amend the last commit of the PR, and push it with --force-with-lease.

@ashb ashb force-pushed the no-flash-for-inpage-warnings branch from 220c7a7 to 59da726 Compare September 23, 2021 12:51
@ashb ashb force-pushed the no-flash-for-inpage-warnings branch from 59da726 to 918aeeb Compare September 23, 2021 16:20
The flash is designed for setting a message on one page and then showing
it after a redirect, so in the case of these UI warnings they were being
shown twice due to an early redirect.

I could have chosen to fix this by moving the checks to after the
`reset_tags` redirect, but it _also_ felt wrong to me to have HTML in
the view, so I have chosen to move it in to the template where it
belongs.

To (marginally) reduce boilerplate I have created `message()` "macro"
(Jinja macro, a.k.a. function; not to be confused with what Airflow
templates call a macro, but is in fact just a template global) that
handles the formatting for messages.
@ashb ashb force-pushed the no-flash-for-inpage-warnings branch from 918aeeb to 8eff794 Compare September 24, 2021 11:25
@ashb ashb merged commit 18e91bc into apache:main Sep 24, 2021
@ashb ashb deleted the no-flash-for-inpage-warnings branch September 24, 2021 11:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:UI Related to UI/UX. For Frontend Developers. area:webserver Webserver related Issues okay to merge It's ok to merge this PR as it does not require more tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Duplicated general notifications in Airflow UI above DAGs list
4 participants