Commit d60f0e9c authored by Mayra Cabrera's avatar Mayra Cabrera

Merge branch 'nolith-master-patch-30947' into 'master'

Fix group usage quota menu item

See merge request gitlab-org/gitlab-ee!14043
parents 83572549 a6cb7267
......@@ -2,7 +2,7 @@
class Groups::UsageQuotasController < Groups::ApplicationController
before_action :authorize_admin_group!
before_action :validate_shared_runner_minutes_support!
before_action :verify_usage_quotas_enabled!
layout 'group_settings'
......@@ -12,7 +12,8 @@ class Groups::UsageQuotasController < Groups::ApplicationController
private
def validate_shared_runner_minutes_support!
render_404 unless @group.shared_runner_minutes_supported?
def verify_usage_quotas_enabled!
render_404 unless @group.feature_available?(:usage_quotas)
render_404 if @group.has_parent?
end
end
......@@ -34,6 +34,7 @@ class License < ApplicationRecord
repository_mirrors
repository_size_limit
scoped_issue_board
usage_quotas
visual_review_app
].freeze
......
......@@ -22,10 +22,11 @@
%span
Audit Events
- if @group.feature_available?(:usage_quotas)
= nav_link(path: 'usage_quota#index') do
= link_to group_usage_quotas_path(@group), title: s_('UsageQuota|Usage Quotas') do
%span
= s_('UsageQuota|Usage quotas')
= s_('UsageQuota|Usage Quotas')
- if Gitlab::CurrentSettings.should_check_namespace_plan?
= nav_link(path: 'billings#index') do
......
- page_title s_("UsageQuota|Usage")
%h3.page-title
= s_('UsageQuota|Usage quotas')
= s_('UsageQuota|Usage Quotas')
.row
.col-sm-6
......
---
title: Fix 'Group > Usage Quota' menu item
merge_request: 14043
author:
type: fixed
......@@ -10,17 +10,41 @@ describe 'Groups > Usage Quotas' do
sign_in(user)
end
context 'with no quota' do
let(:group) { create(:group, :with_build_minutes) }
it 'is not linked within the group settings dropdown' do
visit group_path(group)
shared_examples 'linked in group settings dropdown' do
it 'is linked within the group settings dropdown' do
visit edit_group_path(group)
page.within('.nav-sidebar') do
expect(page).not_to have_selector(:link_or_button, 'Pipeline Quota')
expect(page).to have_link('Usage Quotas')
end
end
context 'when usage_quotas is not available' do
before do
stub_licensed_features(usage_quotas: false)
end
it 'is not linked within the group settings dropdown' do
visit edit_group_path(group)
page.within('.nav-sidebar') do
expect(page).not_to have_link('Usage Quotas')
end
end
it 'renders a 404' do
visit_pipeline_quota_page
expect(page).to have_http_status(:not_found)
end
end
end
context 'with no quota' do
let(:group) { create(:group, :with_build_minutes) }
include_examples 'linked in group settings dropdown'
it 'shows correct group quota info' do
visit_pipeline_quota_page
......@@ -35,11 +59,7 @@ describe 'Groups > Usage Quotas' do
let(:group) { create(:group, :with_not_used_build_minutes_limit) }
let!(:project) { create(:project, namespace: group, shared_runners_enabled: false) }
it 'is linked within the group settings dropdown' do
visit edit_group_path(group)
expect(page).to have_link('Usage Quotas')
end
include_examples 'linked in group settings dropdown'
it 'shows correct group quota info' do
visit_pipeline_quota_page
......@@ -58,11 +78,7 @@ describe 'Groups > Usage Quotas' do
context 'minutes under quota' do
let(:group) { create(:group, :with_not_used_build_minutes_limit) }
it 'is linked within the group settings tab' do
visit edit_group_path(group)
expect(page).to have_link('Usage Quotas')
end
include_examples 'linked in group settings dropdown'
it 'shows correct group quota info' do
visit_pipeline_quota_page
......@@ -79,11 +95,7 @@ describe 'Groups > Usage Quotas' do
let(:group) { create(:group, :with_used_build_minutes_limit) }
let!(:other_project) { create(:project, namespace: group, shared_runners_enabled: false) }
it 'is linked within the group settings tab' do
visit edit_group_path(group)
expect(page).to have_link('Usage Quotas')
end
include_examples 'linked in group settings dropdown'
it 'shows correct group quota and projects info' do
visit_pipeline_quota_page
......
......@@ -14460,9 +14460,6 @@ msgstr ""
msgid "UsageQuota|Usage of group resources across the projects in the %{strong_start}%{group_name}%{strong_end} group"
msgstr ""
msgid "UsageQuota|Usage quotas"
msgstr ""
msgid "UsageQuota|Usage since"
msgstr ""
......
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