Skip to content

Separates banners from alerts

Sascha Eggenberger requested to merge banners-alerts-cleanup into master

What does this MR do and why?

Aims to separate banners from alerts. From a hierarchy perspective banners should always appear on top of the page. For alerts we currently have full width and container restricted alerts. These can appear together (like for example in onboarding new users). To simplify and make the overall experience more congruent this MR cleans up order of banners & alerts and shows all alerts in the page container (depending on the user setting).

  • Introduces a new wrapper to host banners independently of alerts
  • Unifies appearance of banners
  • Moves flash messages into alerts wrapper
  • Moves top bar out of alerts wrapper (bugfix)

Changelog: changed

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Before After
before after
before2 after2

How to set up and validate locally

  1. Enable test patch to enable various banners & alerts (see below)
  2. Visit a page like project or a settings page
Test patch
diff --git a/app/views/shared/_outdated_browser.html.haml b/app/views/shared/_outdated_browser.html.haml
index e62e3bb4a6c6..229589e543b0 100644
--- a/app/views/shared/_outdated_browser.html.haml
+++ b/app/views/shared/_outdated_browser.html.haml
@@ -1,4 +1,4 @@
-- if outdated_browser?
+- if not outdated_browser?
   = render Pajamas::AlertComponent.new(variant: :danger, dismissible: false) do |c|
     - c.with_body do
       = s_('OutdatedBrowser|GitLab may not work properly, because you are using an outdated web browser.')
diff --git a/app/views/shared/_token_expiration_banner.html.haml b/app/views/shared/_token_expiration_banner.html.haml
index e68fe613c22b..0af2478b1bf6 100644
--- a/app/views/shared/_token_expiration_banner.html.haml
+++ b/app/views/shared/_token_expiration_banner.html.haml
@@ -1,8 +1,8 @@
 - id = 'token_expiration'
 - cookie_key = 'hide_token_expiration_banner'
 
-- return unless show_token_expiration_banner?
-- return unless cookies[cookie_key].blank?
+-# - return unless show_token_expiration_banner?
+-# - return unless cookies[cookie_key].blank?
 
 - link = link_to('', help_page_path('security/tokens/token_troubleshooting'), target: '_blank', rel: 'noopener noreferrer')
 - message = safe_format(s_('AccessTokens|GitLab now enforces expiry dates on tokens that originally had no set expiration date. Those tokens were given an expiration date of one year later. Please review your personal access tokens, project access tokens, and group access tokens to ensure you are aware of upcoming expirations. Administrators of GitLab can find more information on how to identify and mitigate interruption in our %{link_start}documentation%{link_end}.'), tag_pair(link, :link_start, :link_end))
diff --git a/app/views/shared/projects/_inactive_project_deletion_alert.html.haml b/app/views/shared/projects/_inactive_project_deletion_alert.html.haml
index 8ac5c8b8defd..3cfb2e6ee9b9 100644
--- a/app/views/shared/projects/_inactive_project_deletion_alert.html.haml
+++ b/app/views/shared/projects/_inactive_project_deletion_alert.html.haml
@@ -1,7 +1,7 @@
-- if show_inactive_project_deletion_banner?(@project)
+- if not show_inactive_project_deletion_banner?(@project)
   - link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: help_page_path('administration/inactive_project_deletion') }
   - link_end = '</a>'.html_safe
-  - deletion_date = inactive_project_deletion_date(@project)
+  - deletion_date = ''
   - title = _('Due to inactivity, this project is scheduled to be deleted on %{deletion_date}. %{link_start}Why is this scheduled?%{link_end}').html_safe % { deletion_date: deletion_date, link_start: link_start, link_end: link_end }
 
   = render Pajamas::AlertComponent.new(title: title, variant: :warning, dismissible: false)
diff --git a/ee/app/views/shared/_namespace_user_cap_reached_alert.html.haml b/ee/app/views/shared/_namespace_user_cap_reached_alert.html.haml
index 70bc6d639638..490ad900c7b8 100644
--- a/ee/app/views/shared/_namespace_user_cap_reached_alert.html.haml
+++ b/ee/app/views/shared/_namespace_user_cap_reached_alert.html.haml
@@ -1,7 +1,7 @@
 - return unless current_user
 - namespace = @project&.namespace || @group
 - return unless namespace.present?
-- return unless display_namespace_user_cap_reached_alert?(namespace)
+-# - return unless display_namespace_user_cap_reached_alert?(namespace)
 
 - root_namespace = namespace.root_ancestor
 - pending_users_link = pending_members_group_usage_quotas_path(root_namespace)
diff --git a/ee/app/views/shared/_new_user_signups_cap_reached_alert.html.haml b/ee/app/views/shared/_new_user_signups_cap_reached_alert.html.haml
index b58bcf1b8fa4..8d9d75fbd1f5 100644
--- a/ee/app/views/shared/_new_user_signups_cap_reached_alert.html.haml
+++ b/ee/app/views/shared/_new_user_signups_cap_reached_alert.html.haml
@@ -1,4 +1,4 @@
-- return unless show_new_user_signups_cap_reached?
+-# - return unless show_new_user_signups_cap_reached?
 
 - user_cap_help_url = help_page_path('administration/settings/sign_up_restrictions')
 - help_link_start = '<a class="gl-link" href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: user_cap_help_url }

Related to #469616 (closed)

Edited by Sascha Eggenberger

Merge request reports

Loading