Commit 1cc9b5f7 authored by Dmytro Zaporozhets (DZ)'s avatar Dmytro Zaporozhets (DZ)

Merge branch '296895-group-setting-to-allow-or-prevent-duplicate-maven-uploads' into 'master'

Add Package & Registry settings menu

See merge request gitlab-org/gitlab!51460
parents 9adf60f9 e91d3e5c
import Vue from 'vue';
import Translate from '~/vue_shared/translate';
import SettingsApp from './components/group_settings_app.vue';
import { apolloProvider } from './graphql';
Vue.use(Translate);
export default () => {
const el = document.getElementById('js-packages-and-registries-settings');
if (!el) {
return null;
}
return new Vue({
el,
apolloProvider,
render(createElement) {
return createElement(SettingsApp);
},
});
};
<script>
export default {
name: 'GroupSettingsApp',
};
</script>
<template>
<section></section>
</template>
import Vue from 'vue';
import VueApollo from 'vue-apollo';
import createDefaultClient from '~/lib/graphql';
Vue.use(VueApollo);
export const apolloProvider = new VueApollo({
defaultClient: createDefaultClient(
{},
{
assumeImmutableResults: true,
},
),
});
import bundle from '~/packages_and_registries/settings/group/bundle';
bundle();
# frozen_string_literal: true
module Groups
module Settings
class PackagesAndRegistriesController < Groups::ApplicationController
before_action :authorize_admin_group!
feature_category :package_registry
def index
end
end
end
end
...@@ -22,6 +22,7 @@ module GroupsHelper ...@@ -22,6 +22,7 @@ module GroupsHelper
ldap_group_links#index ldap_group_links#index
hooks#index hooks#index
pipeline_quota#index pipeline_quota#index
packages_and_registries#index
] ]
end end
......
- breadcrumb_title _('Packages & Registries')
- page_title _('Packages & Registries')
- @content_class = 'limit-container-width' unless fluid_layout
%section#js-packages-and-registries-settings
...@@ -150,7 +150,7 @@ ...@@ -150,7 +150,7 @@
= sprite_icon('settings') = sprite_icon('settings')
%span.nav-item-name.qa-group-settings-item %span.nav-item-name.qa-group-settings-item
= _('Settings') = _('Settings')
%ul.sidebar-sub-level-items.qa-group-sidebar-submenu %ul.sidebar-sub-level-items.qa-group-sidebar-submenu{ data: { testid: 'group-settings-menu' } }
= nav_link(path: %w[groups#projects groups#edit badges#index ci_cd#show], html_options: { class: "fly-out-top-item" } ) do = nav_link(path: %w[groups#projects groups#edit badges#index ci_cd#show], html_options: { class: "fly-out-top-item" } ) do
= link_to edit_group_path(@group) do = link_to edit_group_path(@group) do
%strong.fly-out-top-item-name %strong.fly-out-top-item-name
...@@ -181,6 +181,12 @@ ...@@ -181,6 +181,12 @@
%span %span
= _('CI / CD') = _('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_if_exists "groups/ee/settings_nav" = render_if_exists "groups/ee/settings_nav"
= render_if_exists "groups/ee/administration_nav" = render_if_exists "groups/ee/administration_nav"
......
---
name: packages_and_registries_group_settings
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/51460
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/297371
milestone: '13.8'
type: development
group: group::package
default_enabled: false
...@@ -49,6 +49,8 @@ constraints(::Constraints::GroupUrlConstrainer.new) do ...@@ -49,6 +49,8 @@ constraints(::Constraints::GroupUrlConstrainer.new) do
post :reset post :reset
end end
end end
resources :packages_and_registries, only: [:index]
end end
resource :variables, only: [:show, :update] resource :variables, only: [:show, :update]
......
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Group Packages & Registries settings' do
include WaitForRequests
let(:user) { create(:user) }
let(:group) { create(:group) }
before do
group.add_owner(user)
sign_in(user)
end
context 'when the feature flag is off' do
before do
stub_feature_flags(packages_and_registries_group_settings: false)
end
it 'the menu item is not visible' do
visit group_path(group)
settings_menu = find_settings_menu
expect(settings_menu).not_to have_content 'Packages & Registries'
end
end
context 'when the feature flag is on' do
it 'the menu item is visible' do
visit group_path(group)
settings_menu = find_settings_menu
expect(settings_menu).to have_content 'Packages & Registries'
end
it 'has a page title set' do
visit_settings_page
expect(page).to have_title _('Packages & Registries')
end
it 'sidebar menu is open' do
visit_settings_page
sidebar = find('.nav-sidebar')
expect(sidebar).to have_link _('Packages & Registries')
end
end
def find_settings_menu
find('ul[data-testid="group-settings-menu"]')
end
def visit_settings_page
visit group_settings_packages_and_registries_path(group)
end
end
...@@ -137,6 +137,7 @@ RSpec.shared_context 'group navbar structure' do ...@@ -137,6 +137,7 @@ RSpec.shared_context 'group navbar structure' do
_('Projects'), _('Projects'),
_('Repository'), _('Repository'),
_('CI / CD'), _('CI / CD'),
_('Packages & Registries'),
_('Webhooks') _('Webhooks')
] ]
} }
......
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