Show clear upstream cache button for Maven virtual registry
What does this MR do and why?
Show clear upstream cache button
Show modal when clicked
When confirmed, calls backend API to clear upstream cache
If API is successful, shows toast, otherwise a danger alert is shown
EE: true
References
Screenshots or screen recordings
When user does not have permission | When user has permission | On button click | On success | On failure |
---|---|---|---|---|
![]() |
![]() |
![]() |
![]() |
![]() |
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 a group
- Go to
Deploy -> Virtual Registry
- If you have a Maven Registry created, go there; otherwise, create one.
- Click on the
Add upstream
button - The required fields are
name
,url
, andcache period
. For the URL, you can usehttps://repo.maven.apache.org/maven2
. - Click on
Create upstream
- To create cache entries for the maven upstream, run this the rails console.
g = Group.find(<top-level-group-id>)
u = ::VirtualRegistries::Packages::Maven::Upstream.find(<id-of-recently-created-upstream>)
::VirtualRegistries::Packages::Maven::Cache::Entry.create!(group: g, upstream: u, relative_path: '/test/foo', size: 150000, file: Tempfile.new('bar'), file_sha1: '4e1243bd22c66e76c2ba9eddc1f91394e57f9f83', object_storage_key: 'testing1-key')
- Click on the
Clear cache
button & confirm the actions aligns with the screenshots. - Click on the upstream & confirm that cache entries on the page are cleared.
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 #556804 (closed)
Edited by Rahul Chanila