-
Notifications
You must be signed in to change notification settings - Fork 447
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
Refactor menu resolvers 9.0 #3994
Open
YanaDePauw
wants to merge
34
commits into
DSpace:main
Choose a base branch
from
atmire:refactor-menu-resolvers-9.0
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Replace god-class resolvers with a service that populates the menus from lists of injectable providers - Static menu sections are resolved at the root route ~ `resolveStatic` - Route-dependent menu sections can be declared in the same structure, but are resolved on-demand ~ `resolveRoute` - More and more easily customizable - Parts can be moved between menus, removed, replaced or extended individually - The dependencies of each provider are independent of each other - Order of providers determines the order of each menu → single source of truth for the order
Adds support to define routes for which the menu providers needs to be present in appmenu Moves menu adding away from the resolver and to the init service Refactored statsmenu to show stats on all pages based on dso somewhere in the route
Adds support to define child providers for a parent menu using a .withSubs option. This parent menu will always be displayed as an expandable menu. When no children are visible, the expandable menus will be hidden.
…ic-providers-tests' into refactor-menu-resolvers-7.6_sketch-branch
… refactor-menu-resolvers-7.6_sketch-branch
…efactor-menu-resolvers-7.6_sketch-branch
If an expandable section in the navbar is acive by default, it will expand whn the page loads
- Menu providers weren't included because main configuration is no longer a module - Route definitions didn't get merged because they're no longer modules - Removed old resolver & service (they're providers now)
- Migrate create-report sections to a new provider - Fix menu component test - Add dso option sections to com/col sub paths - Fix issue with breadcrumbs on the collection page
12a75f9
to
329edde
Compare
Note: e2e test issuesThere are still some e2e tests failing due to these requiring certain ids for certain menus while most of the menus do not have human readable ids anymore. These are being fixed. |
329edde
to
43e4f9d
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
References
Fixes #3262
Description
This PR refactors the menu sections that were previously provided in the various menu resolvers. Instead of the previous system where all the sections are added in the same resolver and need to be managed manually through indexes, the new system will split up all the sections over multiple "Providers" which will then be added to the list of providers per menu defined in the
app.menus.ts
file.This approach makes it way more intuitive to see what kind of sections there are and to add new sections in between already existing ones.
This new version fully removes the old way of adding route based data (e.g. statistics) and replaces it with a new way where you can easily add routes to specified providers and/or retrieve route data in the provider to be used for its sections. It also adds support to separately define a parent sections with various child sections. The latter will be mostly useful for creating sections on the DSO pages where you can now separately define the parent section through a provider and then add child providers for the various different sections.
For example, in the current implementation all the buttons on the DSO pages have been added to a single parent parent section resulting in a single button on the DSO pages with the relevant sections in the dropdown. In case sections need to be moved, the provider can simply be moved to a different location such as before the provider responsible for providing the button (
DsoOptionMenuProvider
).Finally, since the menus have been moved from the resolvers to the
InitService
, the menus will not delay the page from loading when the menu sections need some time. The menus will simply appear when they are fully loaded. To prevent "blinking" when changing pages, the sections that need to be added/removed are all done at the same time.Instructions for Reviewers
The current menus and its sections should be the same except for two exceptions. Therefore, verifying that the behaviour has remained the same for those sections should be sufficient to verify that the refactor was successful.
The two exceptions are the following:
Exception 1: Statistics section
The behaviour of the statistics menu has been changed to show a menu on all pages instead of only the home page and the DSO pages.
When a DSO is present somewhere in the route, it will redirect to that DSO's statistics page, otherwise it will redirect to the general statistics page.
For example, when you are on the edit page of an item, the statistics link will still navigate to that item's statistics. When on the "Scripts and processes" page, the statistics link will navigate to the general repository statistics.
Exception 2: DSO options wrapper section
The various buttons on the community, collection and item pages have all been added to a single dropdown menu instead of having separate buttons per section. This results into a cleaner look compared to having a growing list of different buttons being added on those pages.
Note: In case people would want to restore the old view, this can be easily done by removing the
DsoOptionMenuProvider.withSubs()
provider and adding all the menus that were in the .withSubs list directly to the[MenuID.DSO_EDIT]
list.Documentation
Due to the majority of the changes, some documentation will be provided separately.
Checklist
This checklist provides a reminder of what we are going to look for when reviewing your PR. You do not need to complete this checklist prior creating your PR (draft PRs are always welcome).
However, reviewers may request that you complete any actions in this list if you have not done so. If you are unsure about an item in the checklist, don't hesitate to ask. We're here to help!
main
branch of code (unless it is a backport or is fixing an issue specific to an older branch).npm run lint
npm run check-circ-deps
)package.json
), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation.