You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "vincbeck (via GitHub)" <gi...@apache.org> on 2025/04/03 18:26:27 UTC

[PR] Add single endpoint to retrieve menu information [airflow]

vincbeck opened a new pull request, #48762:
URL: https://github.com/apache/airflow/pull/48762

   Part of #47412.
   
   Create one endpoint to retrieve menu information. Two pieces of information are retrieved:
   - `authorized_menu_items`: the list of menu items the user has access to
   - `extra_menu_items`: the list of menu items provided by the auth manager. We used to have a endpoint to retrieve that information. I removed that endpoint since it is unnecessary to have 2 endpoints
   
   I updated the front-end code to no longer use the `/ui/auth/links` endpoint but the new one. Once that merged, we need to update the front-end code to display/hide menu items depending on whether it belongs to `authorized_menu_items`. @bbovenzi 
   
   <!--
    Licensed to the Apache Software Foundation (ASF) under one
    or more contributor license agreements.  See the NOTICE file
    distributed with this work for additional information
    regarding copyright ownership.  The ASF licenses this file
    to you under the Apache License, Version 2.0 (the
    "License"); you may not use this file except in compliance
    with the License.  You may obtain a copy of the License at
   
      http://www.apache.org/licenses/LICENSE-2.0
   
    Unless required by applicable law or agreed to in writing,
    software distributed under the License is distributed on an
    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    KIND, either express or implied.  See the License for the
    specific language governing permissions and limitations
    under the License.
    -->
   
   <!--
   Thank you for contributing! Please make sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   
   Feel free to ping committers for the review!
   
   In case of an existing issue, reference it using one of the following:
   
   closes: #ISSUE
   related: #ISSUE
   
   How to write a good git commit message:
   http://chris.beams.io/posts/git-commit/
   -->
   
   
   
   <!-- Please keep an empty line above the dashes. -->
   ---
   **^ Add meaningful description above**
   Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)** for more information.
   In case of fundamental code changes, an Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals)) is needed.
   In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
   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 [airflow-core/newsfragments](https://github.com/apache/airflow/tree/main/airflow-core/newsfragments).
   


-- 
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


Re: [PR] Add single endpoint to retrieve menu information [airflow]

Posted by "vincbeck (via GitHub)" <gi...@apache.org>.
vincbeck commented on code in PR #48762:
URL: https://github.com/apache/airflow/pull/48762#discussion_r2027605579


##########
airflow-core/src/airflow/ui/openapi-gen/requests/types.gen.ts:
##########
@@ -1102,19 +1107,26 @@ export type JobResponse = {
 };
 
 /**
- * Menu Item for responses.
+ * Define all menu items defined in the menu.
  */
-export type MenuItem = {
-  text: string;
-  href: string;
-};
+export type MenuItem =
+  | "Assets"
+  | "Asset Events"

Review Comment:
   Yes I meant `Events`, I dont know why I named it `Asset Events` (has it been renamed recently?). Let me update it. I do not focus on pages, I focus on links we have on the menu, `Dag Runs` or `Task Instance` are not part of the menu, that is why they are not part of this list.



-- 
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


Re: [PR] Add single endpoint to retrieve menu information [airflow]

Posted by "vincbeck (via GitHub)" <gi...@apache.org>.
vincbeck commented on PR #48762:
URL: https://github.com/apache/airflow/pull/48762#issuecomment-2783404756

   > MenuItem
   
   What do you propose
   
   > Nice.
   > 
   > Yes I agree that this mapping `MenuItem.EVENTS: RESOURCE_AUDIT_LOG` is confusing. (Even in the UI event vs asset event, I find `AUDIT_LOG` less confusing)
   > 
   > A couple of small nits, but looking good to me.
   
   I renamed "Events" to "Audit log" then


-- 
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


Re: [PR] Add single endpoint to retrieve menu information [airflow]

Posted by "vincbeck (via GitHub)" <gi...@apache.org>.
vincbeck commented on code in PR #48762:
URL: https://github.com/apache/airflow/pull/48762#discussion_r2027654943


##########
providers/fab/src/airflow/providers/fab/auth_manager/fab_auth_manager.py:
##########
@@ -155,7 +155,7 @@
 
 _MAP_MENU_ITEM_TO_FAB_RESOURCE_TYPE = {
     MenuItem.ASSETS: RESOURCE_ASSET,
-    MenuItem.ASSET_EVENTS: RESOURCE_ASSET,
+    MenuItem.EVENTS: RESOURCE_ASSET,

Review Comment:
   Good catch! I like better "Events" but that's more a personal opinion I guess. We can keep "Events" for now and rename it later if that makes more sense to people



-- 
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


Re: [PR] Add single endpoint to retrieve menu information [airflow]

Posted by "dstandish (via GitHub)" <gi...@apache.org>.
dstandish commented on PR #48762:
URL: https://github.com/apache/airflow/pull/48762#issuecomment-2784531326

   Was this the right change?   Asset events are different from events (a.k.a. event log a.k.a. audit log) and _also_ different from `assets`.


-- 
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


Re: [PR] Add single endpoint to retrieve menu information [airflow]

Posted by "bbovenzi (via GitHub)" <gi...@apache.org>.
bbovenzi commented on code in PR #48762:
URL: https://github.com/apache/airflow/pull/48762#discussion_r2027598218


##########
airflow-core/src/airflow/ui/openapi-gen/requests/types.gen.ts:
##########
@@ -1102,19 +1107,26 @@ export type JobResponse = {
 };
 
 /**
- * Menu Item for responses.
+ * Define all menu items defined in the menu.
  */
-export type MenuItem = {
-  text: string;
-  href: string;
-};
+export type MenuItem =
+  | "Assets"
+  | "Asset Events"

Review Comment:
   Or did you mean just `Events` for what used to be called Audit Log?



-- 
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


Re: [PR] Add single endpoint to retrieve menu information [airflow]

Posted by "dstandish (via GitHub)" <gi...@apache.org>.
dstandish commented on PR #48762:
URL: https://github.com/apache/airflow/pull/48762#issuecomment-2786583384

   > > Was this the right change? Asset events are different from events (a.k.a. event log a.k.a. audit log) and also different from assets.
   > 
   > There's no asset event page yet, but there is an 'AUDIT_LOG' one. We will most likely add the `ASSET_EVENTS` one later when the asset event page is implemented.
   
   i see, so it only _looked_ like a rename in the diff but was not a rename; just, we did not need it yet.


-- 
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


Re: [PR] Add single endpoint to retrieve menu information [airflow]

Posted by "vincbeck (via GitHub)" <gi...@apache.org>.
vincbeck merged PR #48762:
URL: https://github.com/apache/airflow/pull/48762


-- 
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


Re: [PR] Add single endpoint to retrieve menu information [airflow]

Posted by "vincbeck (via GitHub)" <gi...@apache.org>.
vincbeck commented on PR #48762:
URL: https://github.com/apache/airflow/pull/48762#issuecomment-2783654540

   Tests are unrelated to this PR. Merging


-- 
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


Re: [PR] Add single endpoint to retrieve menu information [airflow]

Posted by "bbovenzi (via GitHub)" <gi...@apache.org>.
bbovenzi commented on code in PR #48762:
URL: https://github.com/apache/airflow/pull/48762#discussion_r2027648904


##########
providers/fab/src/airflow/providers/fab/auth_manager/fab_auth_manager.py:
##########
@@ -155,7 +155,7 @@
 
 _MAP_MENU_ITEM_TO_FAB_RESOURCE_TYPE = {
     MenuItem.ASSETS: RESOURCE_ASSET,
-    MenuItem.ASSET_EVENTS: RESOURCE_ASSET,
+    MenuItem.EVENTS: RESOURCE_ASSET,

Review Comment:
   This is incorrect too. Let's make sure all the events menu items are linked to the audit log. We can name the menu item Audit Log if that removes the confusion



-- 
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


Re: [PR] Add single endpoint to retrieve menu information [airflow]

Posted by "bbovenzi (via GitHub)" <gi...@apache.org>.
bbovenzi commented on code in PR #48762:
URL: https://github.com/apache/airflow/pull/48762#discussion_r2027597346


##########
airflow-core/src/airflow/ui/openapi-gen/requests/types.gen.ts:
##########
@@ -1102,19 +1107,26 @@ export type JobResponse = {
 };
 
 /**
- * Menu Item for responses.
+ * Define all menu items defined in the menu.
  */
-export type MenuItem = {
-  text: string;
-  href: string;
-};
+export type MenuItem =
+  | "Assets"
+  | "Asset Events"

Review Comment:
   Why Asset Events and not Dag Runs or Task Instances?
   
   We don't have a single asset events page yet.



-- 
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


Re: [PR] Add single endpoint to retrieve menu information [airflow]

Posted by "pierrejeambrun (via GitHub)" <gi...@apache.org>.
pierrejeambrun commented on PR #48762:
URL: https://github.com/apache/airflow/pull/48762#issuecomment-2785862374

   > Was this the right change? Asset events are different from events (a.k.a. event log a.k.a. audit log) and also different from assets.
   
   There's no asset event page yet, but there is an 'AUDIT_LOG' one. We will most likely add the `ASSET_EVENTS` one later when the asset event page is implemented. 


-- 
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


Re: [PR] Add single endpoint to retrieve menu information [airflow]

Posted by "pierrejeambrun (via GitHub)" <gi...@apache.org>.
pierrejeambrun commented on PR #48762:
URL: https://github.com/apache/airflow/pull/48762#issuecomment-2788746661

   I think so yes


-- 
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


Re: [PR] Add single endpoint to retrieve menu information [airflow]

Posted by "pierrejeambrun (via GitHub)" <gi...@apache.org>.
pierrejeambrun commented on code in PR #48762:
URL: https://github.com/apache/airflow/pull/48762#discussion_r2031093775


##########
airflow-core/src/airflow/api_fastapi/core_api/openapi/v1-generated.yaml:
##########
@@ -7,12 +7,12 @@ info:
     Users should not rely on those but use the public ones instead.
   version: 0.1.0
 paths:
-  /ui/auth/links:
+  /ui/auth/menu:
     get:
       tags:
       - Auth Links
-      summary: Get Auth Links
-      operationId: get_auth_links
+      summary: Get Auth Menu
+      operationId: get_auth_menu

Review Comment:
   nit `get_auth_menus`



##########
airflow-core/src/airflow/api_fastapi/core_api/openapi/v1-generated.yaml:
##########
@@ -7,12 +7,12 @@ info:
     Users should not rely on those but use the public ones instead.
   version: 0.1.0
 paths:
-  /ui/auth/links:
+  /ui/auth/menu:

Review Comment:
   nit
   ```suggestion
     /ui/auth/menus:
   ```



-- 
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