Keep virtual registry settings toggle visible when disabled

What does this MR do and why?

The group Settings > Packages and registries > Virtual registry section, which holds the Enable virtual registry toggle, was only rendered when the feature was already enabled. Once a group Owner toggled the feature off, the section (and its toggle) stopped rendering on the next page load, so the feature could not be re-enabled through the UI.

show_virtual_registries_setting? delegated to VirtualRegistries.any_registry_available?, which resolves through each registry's feature_enabled? and therefore VirtualRegistries::Setting.enabled_for_group?. This coupled the visibility of the settings section to the current on/off state.

This MR adds feature_prerequisites_met? (dependency proxy + feature flag + license, without the enabled-state term) and a VirtualRegistries.any_registry_available_for_settings? helper. The settings section now renders based on feature availability plus the :admin_virtual_registry permission, covering both Maven and Container, and is decoupled from the current on/off state. The runtime gate feature_enabled? (used by the registry APIs and the list/cleanup pages) is unchanged.

Steps to reproduce

  1. As a group Owner with virtual registry available, go to Group > Settings > Packages and registries.
  2. Toggle Enable virtual registry off (saves successfully).
  3. Reload the page.
Before After
the Virtual registry section is gone, with no way to re-enable. the section and toggle still render and the feature can be toggled back on.

References

Testing

  • ee/spec/models/virtual_registries_spec.rb, ee/spec/models/virtual_registries/packages/maven_spec.rb, ee/spec/helpers/ee/groups/settings_helper_spec.rb updated.
  • ee/spec/features/groups/settings/packages_and_registries_spec.rb gains a regression test: with the setting pre-disabled, the section renders and the feature can be re-enabled.
Edited by Rahul Chanila

Merge request reports

Loading