Gate artifact registry navigation on activation state

What does this MR do and why?

On an organization page, the three Artifact Registry entry points did not check whether the organization had a registry. The sidebar area always rendered and expanded to "Repositories" on a fixed stub slug. The overview page link always pointed at a slug-less route. A member of an organization with no registry got links that led to a not-found page.

This MR makes all three surfaces follow one state table, from the spec's "Navigation" section:

State Sidebar area Settings entry Overview link
No mapping row, viewer holds the update ability A single link to the setup page, not expanding to "Repositories" Hidden Link to the setup page
No mapping row, any other viewer Hidden Hidden Hidden
Mapping row whose handle resolves Expands to "Repositories" on the resolved handle's path Shown Link to the resolved handle's repositories path
Mapping row whose handle does not resolve Hidden Shown Hidden

STUB_SLUG stays: Organization#artifact_registry_slug still returns it, and every monolith/S04 repository resolver and mutation reads it from there. Rewiring that changes every repository read and write, so it is a separate follow-up.

Deferred: a resolved status that serves no reads still points at the repositories area, matching today's landing-route redirect. Follow-up: #623320 (closed)

The change sits behind the dark, default-off artifact_registry_ui flag. No changelog, no user-visible behavior.

References

Screenshots or screen recordings

N/A: this is a dark, off-by-default change with no user-visible behavior yet.

How to set up and validate locally

The state table above can be exercised in a browser by enabling the flag with Feature.enable(:artifact_registry_ui) and creating or removing an ArtifactRegistry::NamespaceMapping row for the organization.

bundle exec rspec \
  ee/spec/lib/sidebars/organizations/menus/artifact_registry_menu_spec.rb \
  ee/spec/lib/ee/sidebars/organizations/menus/settings_menu_spec.rb \
  ee/spec/helpers/ee/organizations/organization_helper_spec.rb \
  ee/spec/requests/ee/organizations/organizations_controller_spec.rb \
  ee/spec/models/artifact_registry/namespace_mapping_spec.rb \
  ee/spec/models/ee/organizations/organization_spec.rb

Confirmed output: 116 examples, 0 failures

yarn jest ee/spec/frontend/organizations/show ee/spec/frontend/packages_and_registries/artifact_registry

Confirmed output: Test Suites: 52 passed, 52 total and Tests: 1499 passed, 1499 total

bundle exec rubocop ee/app/models/artifact_registry/namespace_mapping.rb ee/app/models/ee/organizations/organization.rb ee/app/helpers/ee/organizations/organization_helper.rb ee/lib/sidebars/organizations/menus/artifact_registry_menu.rb ee/lib/organizations/artifact_registry.rb

Confirmed output: no offenses detected

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Rahul Chanila

Merge request reports

Loading
Loading