Repository navigation
feat: add API for automatic main menu - #19202
Conversation
Test Results1 097 files + 2 1 097 suites +2 1h 23m 24s ⏱️ -59s Results for commit 205b6d1. ± Comparison against base commit 6a0f1c6. This pull request skips 1 test.♻️ This comment has been updated with latest results. |
taefi
left a comment
There was a problem hiding this comment.
I added my review again, based on my understanding from the enhancement issue, and the usage of the newly introduced API getRegisteredAccessibleMenuRoutes in the vaadin/hilla#2338. Please feel free to discard, if my understanding of the issue is not correct.
|
I tried to test this change along with the counterpart on Hilla side using this branch and noticed that this check returns Flow view has an annotation, but probably something is misconfigured. I'm debugging it. |
mshabarov
left a comment
There was a problem hiding this comment.
Don't know what was a problem last time I tested, but now, in a second try, it works as expected, so once I have a AtMenu, menu item appears in the list, once I remove it - it disappears.
Approved, so we can merge it to main, if no big objections.
Adds API to get and control only accessible routes for automatically build routes based on `Menu` annotated routes. This change is targeting primarily client side menu build with Hilla. Adds `RouteRegistry#getRegisteredAccessibleMenuRoutes` to get a list of accessible RouteData objects. Method takes in a collection of access control objects which are implementing `BeforeEnterListener`. Supports `NavigationAccessControl` and `ViewAccessChecker`. Adds `MenuAccessControl` interface to control `getRegisteredAccessibleMenuRoutes` return value. This change adds first part of control by adding API to enable, disable or automate populating client side main menu with the server side routes. Interface has space for future for more advanced control. Default `MenuAccessControl` implementation can be customized by implementing it as a Spring bean, or by providing the implementation class via 'menu.access.control' property. Fixes: #19127
No routes should be returned when having PopulateClientMenu.NEVER or PopulateClientMenu.AUTOMATIC + no client menu in use.
7a7d720 to
9de2077
Compare
|
One comment from my side is that this feature misses a way to change the mode via config param, e.g. |
Ignoring a single TestBench test due to inconsistent failures. Test isn't related to other changes.
|
All the comments seem to be addressed, let's discuss later if something isn't clear enough
|
This ticket/PR has been released with Vaadin 24.4.0.alpha24 and is also targeting the upcoming stable 24.4.0 version. |




Adds API to get and control only accessible routes for automatically build routes based on
Menuannotated routes. This change is targeting primarily client side menu build with Hilla.Adds
RouteRegistry#getRegisteredAccessibleMenuRoutesto get a list of accessible RouteData objects. Method takes in a collection of access control objects which are implementingBeforeEnterListener. SupportsNavigationAccessControlandViewAccessChecker.Adds
MenuAccessControlinterface to controlgetRegisteredAccessibleMenuRoutesreturn value. This change adds first part of control by adding API to enable, disable or automate populating client side main menu with the server side routes. Interface has space for future for more advanced control.Default
MenuAccessControlimplementation can be customized by implementing it as a Spring bean, or by providing the implementation class via 'menu.access.control' property.Fixes: #19127