Skip to content
代码片段 群组 项目
提交 1a35e03e 编辑于 作者: Sheldon Led's avatar Sheldon Led 提交者: Vijay Hawoldar
浏览文件

Use dashboard limit on storage alerts

上级 c4cd74ed
No related branches found
No related tags found
无相关合并请求
...@@ -125,6 +125,10 @@ def user_has_access? ...@@ -125,6 +125,10 @@ def user_has_access?
end end
end end
def limit
root_storage_size.dashboard_limit
end
def namespace_has_additional_storage_purchased? def namespace_has_additional_storage_purchased?
root_namespace.additional_purchased_storage_size > 0 root_namespace.additional_purchased_storage_size > 0
end end
...@@ -149,7 +153,7 @@ def show_purchase_link? ...@@ -149,7 +153,7 @@ def show_purchase_link?
def free_tier_alert_title def free_tier_alert_title
text_args = { text_args = {
namespace_name: root_namespace.name, namespace_name: root_namespace.name,
free_size_limit: formatted(root_namespace.actual_size_limit) free_size_limit: formatted(limit)
} }
s_( s_(
...@@ -162,7 +166,7 @@ def usage_percentage_alert_title ...@@ -162,7 +166,7 @@ def usage_percentage_alert_title
usage_in_percent: used_storage_percentage(root_storage_size.usage_ratio), usage_in_percent: used_storage_percentage(root_storage_size.usage_ratio),
namespace_name: root_namespace.name, namespace_name: root_namespace.name,
used_storage: formatted(root_storage_size.current_size), used_storage: formatted(root_storage_size.current_size),
storage_limit: formatted(root_storage_size.limit) storage_limit: formatted(limit)
} }
s_( s_(
......
...@@ -45,7 +45,7 @@ def usage_percentage_alert_title ...@@ -45,7 +45,7 @@ def usage_percentage_alert_title
def free_tier_alert_title def free_tier_alert_title
text_args = { text_args = {
readonly_project_count: root_namespace.repository_size_excess_project_count, readonly_project_count: root_namespace.repository_size_excess_project_count,
free_size_limit: formatted(root_namespace.actual_size_limit) free_size_limit: formatted(limit)
} }
ns_( ns_(
...@@ -59,7 +59,7 @@ def free_tier_alert_title ...@@ -59,7 +59,7 @@ def free_tier_alert_title
def alert_message_explanation def alert_message_explanation
text_args = { text_args = {
free_size_limit: formatted(root_namespace.actual_size_limit) free_size_limit: formatted(limit)
} }
if root_storage_size.above_size_limit? if root_storage_size.above_size_limit?
...@@ -114,6 +114,10 @@ def alert_message_cta ...@@ -114,6 +114,10 @@ def alert_message_cta
s_("NamespaceStorageSize|To reduce storage usage, reduce git repository and git LFS storage.") s_("NamespaceStorageSize|To reduce storage usage, reduce git repository and git LFS storage.")
end end
end end
def limit
root_namespace.actual_size_limit
end
end end
end end
end end
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
let(:usage_ratio) { 0.8 } let(:usage_ratio) { 0.8 }
let(:above_size_limit) { false } let(:above_size_limit) { false }
let(:alert_title) { /You have used \d+% of the storage quota for #{group.name}/ } let(:alert_title) { /You have used \d+% of the storage quota for #{group.name}/ }
let(:alert_title_free_tier) { "You have reached the free storage limit of 1,000 MiB for #{group.name}" } let(:alert_title_free_tier) { "You have reached the free storage limit of 5 GiB for #{group.name}" }
let(:alert_message_below_limit) do let(:alert_message_below_limit) do
"If #{group.name} exceeds the storage quota, your ability to write new data to this namespace will be " \ "If #{group.name} exceeds the storage quota, your ability to write new data to this namespace will be " \
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
allow(size_checker).to receive(:above_size_limit?).and_return(above_size_limit) allow(size_checker).to receive(:above_size_limit?).and_return(above_size_limit)
end end
allow(group).to receive(:actual_size_limit).and_return(1000.megabytes) set_dashboard_limit(group, megabytes: 5120)
stub_member_access_level(group, owner: user) stub_member_access_level(group, owner: user)
end end
...@@ -137,6 +137,17 @@ ...@@ -137,6 +137,17 @@
end end
end end
end end
context 'and enforcement_limit is higher than dashboard_limit' do
before do
set_enforcement_limit(group, megabytes: 10240)
end
it 'renders the title with the dashboard_limit' do
render_inline(component)
expect(page).to have_content('5 GiB')
end
end
end end
describe '#render?' do describe '#render?' do
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册