Skip to content
代码片段 群组 项目
提交 129925a4 编辑于 作者: Dylan Griffith's avatar Dylan Griffith
浏览文件

Merge branch 'led/387958-remove-dismissal-error-storage-alert' into 'master'

Remove dismiss button for storage alerts that require user attention

See merge request https://gitlab.com/gitlab-org/gitlab/-/merge_requests/122494



Merged-by: default avatarDylan Griffith <dyl.griffith@gmail.com>
Approved-by: default avatarDylan Griffith <dyl.griffith@gmail.com>
Approved-by: default avatarMohamed Hamda <mhamda@gitlab.com>
Reviewed-by: default avatarMohamed Hamda <mhamda@gitlab.com>
Co-authored-by: default avatarSheldon Led <sheldonled@gitlab.com>
No related branches found
No related tags found
无相关合并请求
.gl-mt-3.container-fluid{ class: content_class } .gl-mt-3.container-fluid{ class: content_class }
= render Pajamas::AlertComponent.new(variant: alert_variant, = render Pajamas::AlertComponent.new(variant: alert_variant,
dismissible: true, dismissible: dismissible?,
title: alert_title, title: alert_title,
alert_options: { class: 'js-namespace-storage-alert', alert_options: { class: 'js-namespace-storage-alert',
data: { feature_id: callout_feature_name, data: { feature_id: callout_feature_name,
......
...@@ -45,13 +45,13 @@ def alert_message ...@@ -45,13 +45,13 @@ def alert_message
end end
def alert_variant def alert_variant
return :danger if [:alert, :error].include?(alert_level) return :danger if attention_required_alert_level?
alert_level alert_level
end end
def alert_icon def alert_icon
[:alert, :error].include?(alert_level) ? 'error' : alert_level.to_s attention_required_alert_level? ? 'error' : alert_level.to_s
end end
def alert_callout_path def alert_callout_path
...@@ -82,6 +82,14 @@ def content_class ...@@ -82,6 +82,14 @@ def content_class
"container-limited limit-container-width" unless user.layout == "fluid" "container-limited limit-container-width" unless user.layout == "fluid"
end end
def dismissible?
!attention_required_alert_level?
end
def attention_required_alert_level?
[:alert, :error].include?(alert_level)
end
def alert_level def alert_level
usage_thresholds = { usage_thresholds = {
none: 0.0, none: 0.0,
......
...@@ -75,6 +75,11 @@ ...@@ -75,6 +75,11 @@
render_inline(component) render_inline(component)
expect(page).to have_content(alert_message_below_limit) expect(page).to have_content(alert_message_below_limit)
end end
it 'allows to dismiss alert' do
render_inline(component)
expect(page).to have_css("[data-testid='close-icon']")
end
end end
context 'and above storage size limit' do context 'and above storage size limit' do
...@@ -90,6 +95,11 @@ ...@@ -90,6 +95,11 @@
render_inline(component) render_inline(component)
expect(page).to have_content(alert_message_above_limit_no_purchased_storage) expect(page).to have_content(alert_message_above_limit_no_purchased_storage)
end end
it 'does not allow to dismiss alert' do
render_inline(component)
expect(page).not_to have_css("[data-testid='close-icon']")
end
end end
end end
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册