Commit a4c5c8e8 authored by Nicolò Maria Mezzopera's avatar Nicolò Maria Mezzopera Committed by Miguel Rincon

Move package menu entry to own partial

- new partial
- referencing
parent a580e8de
......@@ -4,11 +4,18 @@ module Groups
module Settings
class PackagesAndRegistriesController < Groups::ApplicationController
before_action :authorize_admin_group!
before_action :verify_packages_enabled!
feature_category :package_registry
def index
end
private
def verify_packages_enabled!
render_404 unless group.packages_feature_enabled?
end
end
end
end
- if group_packages_list_nav?
= nav_link(controller: :packages_and_registries) do
= link_to group_settings_packages_and_registries_path(@group), title: _('Packages & Registries') do
%span
= _('Packages & Registries')
......@@ -117,7 +117,7 @@
%strong.fly-out-top-item-name
= _('Kubernetes')
= render_if_exists 'groups/sidebar/packages'
= render 'groups/sidebar/packages'
= render 'layouts/nav/sidebar/analytics_links', links: group_analytics_navbar_links(@group, current_user)
......@@ -177,11 +177,7 @@
%span
= _('CI / CD')
- if Feature.enabled?(:packages_and_registries_group_settings, @group)
= nav_link(controller: :packages_and_registries) do
= link_to group_settings_packages_and_registries_path(@group), title: _('Packages & Registries') do
%span
= _('Packages & Registries')
= render 'groups/sidebar/packages_settings'
= render_if_exists "groups/ee/settings_nav"
......
---
title: Enable group setting to allow or prevent duplicate Maven uploads
merge_request: 53591
author:
type: added
......@@ -611,6 +611,21 @@ Now navigate to your project's **Packages & Registries** page and view the publi
When you publish a package with the same name or version as an existing package,
the existing package is overwritten.
#### Do not allow duplicate Maven packages
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/296895) in GitLab Free 13.9.
To prevent users from publishing duplicate Maven packages, you can use the [GraphQl API](../../../api/graphql/reference/index.md#packagesettings) or the UI.
In the UI:
1. For your group, go to **Settings > Packages & Registries**.
1. Expand the **Package Registry** section.
1. Turn on the **Reject duplicates** toggle.
1. Optional. To allow some duplicate packages, in the **Exceptions** box, enter a regex pattern that matches the names of packages you want to allow.
Your changes are automatically saved.
## Install a package
To install a package from the GitLab Package Registry, you must configure
......
......@@ -15,9 +15,9 @@ RSpec.describe 'Group Packages & Registries settings' do
sign_in(user)
end
context 'when the feature flag is off' do
context 'when packges feature is disabled on the group' do
before do
stub_feature_flags(packages_and_registries_group_settings: false)
stub_packages_setting(enabled: false)
end
it 'the menu item is not visible' do
......@@ -27,9 +27,15 @@ RSpec.describe 'Group Packages & Registries settings' do
expect(settings_menu).not_to have_content 'Packages & Registries'
end
it 'renders 404 when navigating to page' do
visit_settings_page
expect(page).to have_content('Not Found')
end
end
context 'when the feature flag is on' do
context 'when packages feature is enabled on the group' do
it 'the menu item is visible' do
visit group_path(group)
......
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