Commit c47966ab authored by Max Woolf's avatar Max Woolf

Merge branch '334889-clean-up-project-storage-feature-flag' into 'master'

Cleanup project_storage_ui feature flag

See merge request gitlab-org/gitlab!71270
parents 34b451be 0438d9d7
......@@ -2,7 +2,6 @@
class Projects::UsageQuotasController < Projects::ApplicationController
before_action :authorize_admin_project!
before_action :verify_usage_quotas_enabled!
layout "project_settings"
......@@ -20,10 +19,4 @@ class Projects::UsageQuotasController < Projects::ApplicationController
wiki_help_page_path: help_page_path('administration/wikis/index.md', anchor: 'reduce-wiki-repository-size')
}
end
private
def verify_usage_quotas_enabled!
render_404 unless Feature.enabled?(:project_storage_ui, project&.group, default_enabled: :yaml)
end
end
---
name: project_storage_ui
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/68289
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/334889
milestone: '14.2'
type: development
group: group::utilization
default_enabled: false
......@@ -36,9 +36,8 @@ namespace to recalculate the storage.
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/68898) project-level graph in GitLab 14.4 [with a flag](../administration/feature_flags.md) named `project_storage_ui`. Disabled by default.
> - Enabled on GitLab.com in GitLab 14.4.
FLAG:
On self-managed GitLab, by default this feature is not available. To make it available, ask an administrator to [enable the feature flag](../administration/feature_flags.md) named `project_storage_ui`. On GitLab.com, this feature is available.
> - Enabled on self-managed in GitLab 14.5.
> - [Feature flag removed](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/71270) in GitLab 14.5.
The following storage usage statistics are available to an owner:
......
......@@ -144,10 +144,6 @@ module Sidebars
end
def usage_quotas_menu_item
unless Feature.enabled?(:project_storage_ui, context.project&.group, default_enabled: :yaml)
return ::Sidebars::NilMenuItem.new(item_id: :usage_quotas)
end
::Sidebars::MenuItem.new(
title: s_('UsageQuota|Usage Quotas'),
link: project_usage_quotas_path(context.project),
......
......@@ -162,24 +162,10 @@ RSpec.describe Sidebars::Projects::Menus::SettingsMenu do
describe 'Usage Quotas' do
let(:item_id) { :usage_quotas }
describe 'with project_storage_ui feature flag enabled' do
before do
stub_feature_flags(project_storage_ui: true)
end
specify { is_expected.not_to be_nil }
describe 'when the user does not have access' do
let(:user) { nil }
specify { is_expected.to be_nil }
end
end
specify { is_expected.not_to be_nil }
describe 'with project_storage_ui feature flag disabled' do
before do
stub_feature_flags(project_storage_ui: false)
end
describe 'when the user does not have access' do
let(:user) { nil }
specify { is_expected.to be_nil }
end
......
......@@ -22,40 +22,26 @@ RSpec.describe 'Project Usage Quotas' do
end
describe 'GET /:namespace/:project/usage_quotas' do
context 'with project_storage_ui feature flag enabled' do
before do
stub_feature_flags(project_storage_ui: true)
end
it 'renders usage quotas path' do
mock_storage_app_data = {
project_path: project.full_path,
usage_quotas_help_page_path: help_page_path('user/usage_quotas'),
build_artifacts_help_page_path: help_page_path('ci/pipelines/job_artifacts', anchor: 'when-job-artifacts-are-deleted'),
packages_help_page_path: help_page_path('user/packages/package_registry/index.md', anchor: 'delete-a-package'),
repository_help_page_path: help_page_path('user/project/repository/reducing_the_repo_size_using_git'),
snippets_help_page_path: help_page_path('user/snippets', anchor: 'reduce-snippets-repository-size'),
wiki_help_page_path: help_page_path('administration/wikis/index.md', anchor: 'reduce-wiki-repository-size')
}
get project_usage_quotas_path(project)
expect(response).to have_gitlab_http_status(:ok)
expect(response.body).to include(project_usage_quotas_path(project))
expect(assigns[:storage_app_data]).to eq(mock_storage_app_data)
expect(response.body).to include("Usage of project resources across the <strong>#{project.name}</strong> project")
end
context 'renders :not_found for user without permission' do
let(:role) { :developer }
it_behaves_like 'response with 404 status'
end
it 'renders usage quotas path' do
mock_storage_app_data = {
project_path: project.full_path,
usage_quotas_help_page_path: help_page_path('user/usage_quotas'),
build_artifacts_help_page_path: help_page_path('ci/pipelines/job_artifacts', anchor: 'when-job-artifacts-are-deleted'),
packages_help_page_path: help_page_path('user/packages/package_registry/index.md', anchor: 'delete-a-package'),
repository_help_page_path: help_page_path('user/project/repository/reducing_the_repo_size_using_git'),
snippets_help_page_path: help_page_path('user/snippets', anchor: 'reduce-snippets-repository-size'),
wiki_help_page_path: help_page_path('administration/wikis/index.md', anchor: 'reduce-wiki-repository-size')
}
get project_usage_quotas_path(project)
expect(response).to have_gitlab_http_status(:ok)
expect(response.body).to include(project_usage_quotas_path(project))
expect(assigns[:storage_app_data]).to eq(mock_storage_app_data)
expect(response.body).to include("Usage of project resources across the <strong>#{project.name}</strong> project")
end
context 'with project_storage_ui feature flag disabled' do
before do
stub_feature_flags(project_storage_ui: false)
end
context 'renders :not_found for user without permission' do
let(:role) { :developer }
it_behaves_like 'response with 404 status'
end
......
......@@ -119,7 +119,7 @@ RSpec.shared_context 'project navbar structure' do
_('Repository'),
_('CI/CD'),
_('Monitor'),
(s_('UsageQuota|Usage Quotas') if Feature.enabled?(:project_storage_ui, default_enabled: :yaml))
s_('UsageQuota|Usage Quotas')
]
}
].compact
......
......@@ -987,28 +987,10 @@ RSpec.describe 'layouts/nav/sidebar/_project' do
end
describe 'Usage Quotas' do
context 'with project_storage_ui feature flag enabled' do
before do
stub_feature_flags(project_storage_ui: true)
end
it 'has a link to Usage Quotas' do
render
expect(rendered).to have_link('Usage Quotas', href: project_usage_quotas_path(project))
end
end
context 'with project_storage_ui feature flag disabled' do
before do
stub_feature_flags(project_storage_ui: false)
end
it 'does not have a link to Usage Quotas' do
render
it 'has a link to Usage Quotas' do
render
expect(rendered).not_to have_link('Usage Quotas', href: project_usage_quotas_path(project))
end
expect(rendered).to have_link('Usage Quotas', href: project_usage_quotas_path(project))
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