Commit babf37d6 authored by Nicolò Maria Mezzopera's avatar Nicolò Maria Mezzopera Committed by Vitali Tatarintev

Add infrastructure registry to sidebar

- source
- tests
- test helper
parent 52ab1ffd
import initPackageList from '~/packages/list/packages_list_app_bundle';
initPackageList();
# frozen_string_literal: true
module Projects
module Packages
class InfrastructureRegistryController < Projects::ApplicationController
feature_category :infrastructure_as_code
end
end
end
...@@ -410,6 +410,10 @@ module ProjectsHelper ...@@ -410,6 +410,10 @@ module ProjectsHelper
nav_tabs << :container_registry nav_tabs << :container_registry
end end
if Feature.enabled?(:infrastructure_registry_page)
nav_tabs << :infrastructure_registry
end
# Pipelines feature is tied to presence of builds # Pipelines feature is tied to presence of builds
if can?(current_user, :read_build, project) if can?(current_user, :read_build, project)
nav_tabs << :pipelines nav_tabs << :pipelines
......
- packages_link = project_nav_tab?(:packages) ? project_packages_path(@project) : project_container_registry_index_path(@project) - packages_link = project_nav_tab?(:packages) ? project_packages_path(@project) : project_container_registry_index_path(@project)
- if (project_nav_tab?(:packages) || project_nav_tab?(:container_registry)) - if (project_nav_tab?(:packages) || project_nav_tab?(:container_registry))
= nav_link controller: [:packages, :repositories] do = nav_link controller: [:packages, :repositories, :infrastructure_registry] do
= link_to packages_link, data: { qa_selector: 'packages_link' } do = link_to packages_link, data: { qa_selector: 'packages_link' } do
.nav-icon-container .nav-icon-container
= sprite_icon('package') = sprite_icon('package')
%span.nav-item-name %span.nav-item-name
= _('Packages & Registries') = _('Packages & Registries')
%ul.sidebar-sub-level-items %ul.sidebar-sub-level-items
= nav_link(controller: [:packages, :repositories], html_options: { class: "fly-out-top-item" } ) do = nav_link(controller: [:packages, :repositories, :infrastructure_registry], html_options: { class: "fly-out-top-item" } ) do
= link_to packages_link do = link_to packages_link do
%strong.fly-out-top-item-name %strong.fly-out-top-item-name
= _('Packages & Registries') = _('Packages & Registries')
...@@ -21,3 +21,7 @@ ...@@ -21,3 +21,7 @@
= nav_link controller: :repositories do = nav_link controller: :repositories do
= link_to project_container_registry_index_path(@project), class: 'shortcuts-container-registry', title: _('Container Registry') do = link_to project_container_registry_index_path(@project), class: 'shortcuts-container-registry', title: _('Container Registry') do
%span= _('Container Registry') %span= _('Container Registry')
- if project_nav_tab? :infrastructure_registry
= nav_link controller: :infrastructure_registry do
= link_to project_infrastructure_registry_index_path(@project), title: _('Infrastructure Registry') do
%span= _('Infrastructure Registry')
- page_title _("Infrastructure Registry")
- @content_class = "limit-container-width" unless fluid_layout
.row
.col-12
#js-vue-packages-list{ data: { resource_id: @project.id,
page_type: 'project',
empty_list_help_url: help_page_path('user/packages/package_registry/index'),
empty_list_illustration: image_path('illustrations/no-packages.svg'),
package_help_url: help_page_path('user/packages/index') } }
---
name: infrastructure_registry_page
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/57338
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/326460
milestone: '13.11'
type: development
group: group::package
default_enabled: false
...@@ -50,6 +50,8 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do ...@@ -50,6 +50,8 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
end end
end end
resources :infrastructure_registry, only: [:index], module: :packages
resources :jobs, only: [:index, :show], constraints: { id: /\d+/ } do resources :jobs, only: [:index, :show], constraints: { id: /\d+/ } do
collection do collection do
resources :artifacts, only: [] do resources :artifacts, only: [] do
......
...@@ -12,6 +12,8 @@ RSpec.describe 'Project navbar' do ...@@ -12,6 +12,8 @@ RSpec.describe 'Project navbar' do
before do before do
insert_package_nav(_('Operations')) insert_package_nav(_('Operations'))
insert_infrastructure_registry_nav
stub_config(registry: { enabled: false })
project.add_maintainer(user) project.add_maintainer(user)
sign_in(user) sign_in(user)
...@@ -67,11 +69,7 @@ RSpec.describe 'Project navbar' do ...@@ -67,11 +69,7 @@ RSpec.describe 'Project navbar' do
before do before do
stub_config(registry: { enabled: true }) stub_config(registry: { enabled: true })
insert_after_sub_nav_item( insert_container_nav
_('Package Registry'),
within: _('Packages & Registries'),
new_sub_nav_item_name: _('Container Registry')
)
visit project_path(project) visit project_path(project)
end end
......
...@@ -16488,6 +16488,9 @@ msgstr "" ...@@ -16488,6 +16488,9 @@ msgstr ""
msgid "Information about additional Pages templates and how to install them can be found in our %{pages_getting_started_guide}." msgid "Information about additional Pages templates and how to install them can be found in our %{pages_getting_started_guide}."
msgstr "" msgstr ""
msgid "Infrastructure Registry"
msgstr ""
msgid "Inherited" msgid "Inherited"
msgstr "" msgstr ""
......
...@@ -68,7 +68,7 @@ RSpec.describe 'Group navbar' do ...@@ -68,7 +68,7 @@ RSpec.describe 'Group navbar' do
before do before do
stub_config(registry: { enabled: true }) stub_config(registry: { enabled: true })
insert_container_nav(_('Kubernetes')) insert_container_nav
visit group_path(group) visit group_path(group)
end end
...@@ -80,7 +80,7 @@ RSpec.describe 'Group navbar' do ...@@ -80,7 +80,7 @@ RSpec.describe 'Group navbar' do
before do before do
stub_config(dependency_proxy: { enabled: true }) stub_config(dependency_proxy: { enabled: true })
insert_dependency_proxy_nav(_('Dependency Proxy')) insert_dependency_proxy_nav
visit group_path(group) visit group_path(group)
end end
......
...@@ -13,6 +13,8 @@ RSpec.describe 'Project navbar' do ...@@ -13,6 +13,8 @@ RSpec.describe 'Project navbar' do
before do before do
insert_package_nav(_('Operations')) insert_package_nav(_('Operations'))
insert_infrastructure_registry_nav
stub_config(registry: { enabled: false })
project.add_maintainer(user) project.add_maintainer(user)
sign_in(user) sign_in(user)
...@@ -60,7 +62,7 @@ RSpec.describe 'Project navbar' do ...@@ -60,7 +62,7 @@ RSpec.describe 'Project navbar' do
before do before do
stub_config(registry: { enabled: true }) stub_config(registry: { enabled: true })
insert_container_nav(_('Operations')) insert_container_nav
visit project_path(project) visit project_path(project)
end end
......
...@@ -29,7 +29,7 @@ module NavbarStructureHelper ...@@ -29,7 +29,7 @@ module NavbarStructureHelper
) )
end end
def insert_container_nav(within) def insert_container_nav
insert_after_sub_nav_item( insert_after_sub_nav_item(
_('Package Registry'), _('Package Registry'),
within: _('Packages & Registries'), within: _('Packages & Registries'),
...@@ -37,11 +37,19 @@ module NavbarStructureHelper ...@@ -37,11 +37,19 @@ module NavbarStructureHelper
) )
end end
def insert_dependency_proxy_nav(within) def insert_dependency_proxy_nav
insert_after_sub_nav_item( insert_after_sub_nav_item(
_('Package Registry'), _('Package Registry'),
within: _('Packages & Registries'), within: _('Packages & Registries'),
new_sub_nav_item_name: _('Dependency Proxy') new_sub_nav_item_name: _('Dependency Proxy')
) )
end end
def insert_infrastructure_registry_nav
insert_after_sub_nav_item(
_('Package Registry'),
within: _('Packages & Registries'),
new_sub_nav_item_name: _('Infrastructure Registry')
)
end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment