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

Generate MenuItems api for application menu generation #20063

Closed
Tracked by #6634
caalador opened this issue Sep 26, 2024 · 4 comments · Fixed by #20138
Closed
Tracked by #6634

Generate MenuItems api for application menu generation #20063

caalador opened this issue Sep 26, 2024 · 4 comments · Fixed by #20138
Assignees

Comments

@caalador
Copy link
Contributor

caalador commented Sep 26, 2024

Describe your motivation

There exists the MenuRegistry that can be used for collecting menu item and route data, but the implementation is aimed for internal consumption and is not as user friendly as it could be.

Describe the solution you'd like

There should be a MenuConfiguration class that returns MenuOptions objects as an ordered collection for use within applications.

Describe alternatives you've considered

Update and remake the current MenuRegistry api.

@mshabarov
Copy link
Contributor

mshabarov commented Oct 1, 2024

Acceptance Criteria (draft)

  • MenuRegistry is moved under com.vaadin.flow.internal.menu and/or documented as "for internal use only".
  • If moved to internal package, Hilla and Start are modified accordingly.
  • MenuConfiguration new class is now public class that has needed methods for dynamic menus, similar to RouteConfiguration class that is public API.
  • MenuConfiguration has methods getAvailableMenuOptions (or similar name) + getAvailableClientMenuOptions that returns new MenuOptions class (or as an alternative, the existing MenuData class? )
  • MenuOptions can give a collection or stream of MenuOption
  • MenuOption class has path, title, order, exclude and icon fields (what else is needed?)
  • Online documentation is updated to use MenuConfiguration class.

@mshabarov
Copy link
Contributor

mshabarov commented Oct 2, 2024

@knoobie
Copy link
Contributor

knoobie commented Oct 2, 2024

MenuOption class has path, title, order, exclude and icon fields (what else is needed?)

Should this include a reference to the class from which the menu comes from? Custom Menu Annotations are probably a bit hard to support.. but this would at least allow to gather all other annotation / informations from the Menu's class.

@mshabarov
Copy link
Contributor

Sounds like a useful data to have there, agreed.

@tltv tltv self-assigned this Oct 3, 2024
@tltv tltv moved this from 🪵Product backlog to ⚒️ In progress in Vaadin Flow ongoing work (Vaadin 10+) Oct 3, 2024
tltv added a commit that referenced this issue Oct 3, 2024
New public API for building application menu: adds `MenuConfiguration`, `MenuOptions` and `MenuOption` where `MenuConfiguration` is the main entry point to access menu data to build main menu.

Fixes: #20063
tltv added a commit that referenced this issue Oct 3, 2024
New public API for building application menu: adds `MenuConfiguration`, `MenuOptions` and `MenuOption` where `MenuConfiguration` is the main entry point to access menu data to build main menu.

Fixes: #20063
tltv added a commit that referenced this issue Oct 4, 2024
New public API for building application menu: adds `MenuConfiguration`, `MenuOptions` and `MenuOption` where `MenuConfiguration` is the main entry point to access menu data to build main menu.

Fixes: #20063
tltv added a commit that referenced this issue Oct 4, 2024
New public API for building application menu: adds `MenuConfiguration`, `MenuOptions` and `MenuOption` where `MenuConfiguration` is the main entry point to access menu data to build main menu.

Fixes: #20063
tltv added a commit to vaadin/hilla that referenced this issue Oct 4, 2024
@github-project-automation github-project-automation bot moved this from ⚒️ In progress to Done in Vaadin Flow ongoing work (Vaadin 10+) Oct 4, 2024
@github-project-automation github-project-automation bot moved this from Next for Dev. Team to Done / Pending Release in Vaadin Flow enhancements backlog (Vaadin 10+) Oct 4, 2024
vaadin-bot pushed a commit that referenced this issue Oct 4, 2024
* feat: add MenuConfiguration

New public API for building application menu: adds `MenuConfiguration`, `MenuOptions` and `MenuOption` where `MenuConfiguration` is the main entry point to access menu data to build main menu.

Fixes: #20063

* chore: renamed classes and removed MenuOptions

Renamed MenuOption to MenuEntry.

* chore: updated javadocs

* chore: moved MenuRegistry to internal package

Removed Serializable from MenuConfiguration.

* chore: added javadoc and deprecated MenuData constructor

* chore: use new constructor

* chore: make MenuConfiguration final
mshabarov pushed a commit that referenced this issue Oct 4, 2024
* feat: add MenuConfiguration

New public API for building application menu: adds `MenuConfiguration`, `MenuOptions` and `MenuOption` where `MenuConfiguration` is the main entry point to access menu data to build main menu.

Fixes: #20063

* chore: renamed classes and removed MenuOptions

Renamed MenuOption to MenuEntry.

* chore: updated javadocs

* chore: moved MenuRegistry to internal package

Removed Serializable from MenuConfiguration.

* chore: added javadoc and deprecated MenuData constructor

* chore: use new constructor

* chore: make MenuConfiguration final

Co-authored-by: Tomi Virtanen <[email protected]>
taefi pushed a commit to vaadin/hilla that referenced this issue Oct 7, 2024
* chore: update imports to MenuRegistry

RelatedTo: vaadin/flow/issues/20063

* chore: fixed tests

---------

Co-authored-by: Artur <[email protected]>
tltv added a commit to vaadin/docs that referenced this issue Oct 7, 2024
Renamed menu-registry to menu-configuration. Updated content to match with new simpler public API of MenuConfiguration. MenuRegistry was changed to internal API and only new public API is documented.

RelatedTo: vaadin/flow#20063
russelljtdyer added a commit to vaadin/docs that referenced this issue Oct 14, 2024
* docs: document MenuConfiguration

Renamed menu-registry to menu-configuration. Updated content to match with new simpler public API of MenuConfiguration. MenuRegistry was changed to internal API and only new public API is documented.

RelatedTo: vaadin/flow#20063

* Updated by review comments

* First pass at editing new document.

* Second pass at editing.

* A few more minor edits.

---------

Co-authored-by: Russell J.T. Dyer <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging a pull request may close this issue.

4 participants