Inform virtual registry users when limits are reached
What does this MR do and why?
This change adds limits and visual indicators to a virtual registry system for Maven packages. The main updates include:
Upstream Limits: Each registry can now have a maximum of 20 upstreams (external package sources). When this limit is reached, users see a message saying "Maximum number of upstreams reached" instead of the button to add more upstreams. A counter badge shows "X of 20" to display current usage.
Registry Limits: Each top-level group can have a maximum of 20 registries. When this limit is reached, the "Create registry" button is replaced with a "Maximum number of registries reached" message.
User Interface Improvements: The interface now displays helpful information like "You can add up to 20 upstreams per registry" and "You can add up to 20 registries per top-level group" to inform users about these limits upfront.
Backend Logic: New helper functions were added to check if limits have been reached, and the display logic was updated to show appropriate messages or buttons based on current usage versus maximum allowed.
These changes help prevent users from hitting unexpected limits and provide clear guidance about constraints.
Also addresses Extract checks for showing create button into a... (#569884 - closed)
EE: true
References
- Suggestion: #569942 (comment 2792673135)
Screenshots or screen recordings
Page | After |
---|---|
Virtual registry landing page | ![]() |
Maven registries & upstreams page | ![]() |
Maven registry details page | ![]() |
How to set up and validate locally
- Ensure you have enabled the following feature flags
$ gdk rails console
Feature.enable(:maven_virtual_registry)
Feature.enable(:ui_for_virtual_registries)
- Go to top-level group
- Go to
Deploy -> Virtual Registry
- Create a new maven registry
- Click on the
Add upstream
button -
Confirm that description related to using locally hosted repositories is added for
Upstream URL
andPassword
fields. - The required fields are
name
,url
. Example URL can be something like:https://repo.maven.apache.org/maven2
- Click on
Create upstream
- Similarly create 19 more registries & a registry with 20 upstreams
g = Group.find(<group-id>) 19.times.each { |i| VirtualRegistries::Packages::Maven::Registry.create(group: g, name: "maven registry - #{i}") }
- Confirm that buttons are replaced with limit messages as per screenshot section.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Related to #569942