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
- As a group Owner with virtual registry available, go to Group > Settings > Packages and registries.
- Toggle Enable virtual registry off (saves successfully).
- 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
- Fixes Virtual registry settings toggle disappears onc... (#603115 - closed) • Rahul Chanila • 19.2
- Introduced in Consolidate virtual registry availability check... (!226797 - merged) • Rahul Chanila • 18.11
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.rbupdated.ee/spec/features/groups/settings/packages_and_registries_spec.rbgains a regression test: with the setting pre-disabled, the section renders and the feature can be re-enabled.