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

Allow passing labels to FAB Views registered via Plugins #39444

Merged
merged 3 commits into from
May 6, 2024

Conversation

kaxil
Copy link
Member

@kaxil kaxil commented May 6, 2024

Currently, we only allow passing "name" and "category" for any FAB View when registering via Airflow plugin.

However, we do allow the same for the Menu Link as shown below:

for menu_link in sorted(
plugins_manager.flask_appbuilder_menu_links, key=lambda x: (x.get("category", ""), x["name"])
):
log.debug("Adding menu link %s to %s", menu_link["name"], menu_link["href"])
appbuilder.add_link(**menu_link)

This PR makes it consistent so we can pass more info that is available in FAB's add_view method like href, label, category_icons, icon etc


^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in newsfragments.

Currently, we only allow passing "name" and "category" for any FAB View when registering via Airflow plugin.

However, we do allow the same for the Menu Link as shown below:

https://github.com/apache/airflow/blob/a74b5f069481e1a2339cfd95e137619b16390906/airflow/www/extensions/init_views.py#L154-L158

This PR makes it consistent so we can pass more info that is available in FAB's [`add_view`](https://github.com/dpgaspar/Flask-AppBuilder/blob/c65e067f09e741c00322221263c8599b8e8811d5/flask_appbuilder/base.py#L361-L372) method like `href`, `label`, `category_icons`, `icon` etc
@boring-cyborg boring-cyborg bot added area:plugins area:webserver Webserver related Issues labels May 6, 2024
@kaxil kaxil added this to the Airflow 2.9.2 milestone May 6, 2024
@pankajkoti
Copy link
Member

Some related tests failing, maybe they need some refinement :)

@kaxil kaxil merged commit 770c9d9 into apache:main May 6, 2024
41 checks passed
@kaxil kaxil deleted the pass-view-options branch May 6, 2024 21:11
pateash pushed a commit to pateash/airflow that referenced this pull request May 13, 2024
Currently, we only allow passing "name" and "category" for any FAB View when registering via Airflow plugin.

However, we do allow the same for the Menu Link as shown below:

https://github.com/apache/airflow/blob/a74b5f069481e1a2339cfd95e137619b16390906/airflow/www/extensions/init_views.py#L154-L158

This PR makes it consistent so we can pass more info that is available in FAB's [`add_view`](https://github.com/dpgaspar/Flask-AppBuilder/blob/c65e067f09e741c00322221263c8599b8e8811d5/flask_appbuilder/base.py#L361-L372) method like `href`, `label`, `category_icons`, `icon` etc
@utkarsharma2 utkarsharma2 added type:improvement Changelog: Improvements type:misc/internal Changelog: Misc changes that should appear in change log and removed type:improvement Changelog: Improvements labels Jun 3, 2024
@ephraimbuddy ephraimbuddy added type:improvement Changelog: Improvements and removed type:misc/internal Changelog: Misc changes that should appear in change log labels Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:plugins area:webserver Webserver related Issues type:improvement Changelog: Improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants