diff options
author | Mike Greiling <mike@pixelcog.com> | 2018-09-07 01:36:49 +0300 |
---|---|---|
committer | Mike Greiling <mike@pixelcog.com> | 2018-09-07 01:36:49 +0300 |
commit | 07c031338a5e9cdeb69bb562179ac675cfe9c960 (patch) | |
tree | ca99996ee1aa86fc1ff234d9142241d630d918df /app | |
parent | 7aa6766cd15036dcfb5391b3fd7bffb9069ffbcf (diff) | |
parent | d6fa67824d13fc342721e996810f2838d4706fd2 (diff) |
Merge branch '50535-display-banner-to-notify-user-if-project-is-implicitly-opted-ado' into 'master'
Displays banner to notify users ADO is implicitly enabled
Closes #50535
See merge request gitlab-org/gitlab-ce!21503
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/pages/projects/project.js | 7 | ||||
-rw-r--r-- | app/helpers/projects_helper.rb | 8 | ||||
-rw-r--r-- | app/views/projects/_flash_messages.html.haml | 1 | ||||
-rw-r--r-- | app/views/shared/_auto_devops_implicitly_enabled_banner.html.haml | 9 |
4 files changed, 25 insertions, 0 deletions
diff --git a/app/assets/javascripts/pages/projects/project.js b/app/assets/javascripts/pages/projects/project.js index fdcbcc236c1..34a13eb3251 100644 --- a/app/assets/javascripts/pages/projects/project.js +++ b/app/assets/javascripts/pages/projects/project.js @@ -61,6 +61,13 @@ export default class Project { .remove(); return e.preventDefault(); }); + $('.hide-auto-devops-implicitly-enabled-banner').on('click', function(e) { + const projectId = $(this).data('project-id'); + const cookieKey = `hide_auto_devops_implicitly_enabled_banner_${projectId}`; + Cookies.set(cookieKey, 'false'); + $(this).parents('.auto-devops-implicitly-enabled-banner').remove(); + return e.preventDefault(); + }); Project.projectSelectDropdown(); } diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index 80b45176a62..7a9b63d8852 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -203,6 +203,14 @@ module ProjectsHelper current_user.require_extra_setup_for_git_auth? end + def show_auto_devops_implicitly_enabled_banner?(project) + cookie_key = "hide_auto_devops_implicitly_enabled_banner_#{project.id}" + + project.has_auto_devops_implicitly_enabled? && + cookies[cookie_key.to_sym].blank? && + (project.owner == current_user || project.team.maintainer?(current_user)) + end + def link_to_set_password if current_user.require_password_creation_for_git? link_to s_('SetPasswordToCloneLink|set a password'), edit_profile_password_path diff --git a/app/views/projects/_flash_messages.html.haml b/app/views/projects/_flash_messages.html.haml index 0175b519867..7a5fff96676 100644 --- a/app/views/projects/_flash_messages.html.haml +++ b/app/views/projects/_flash_messages.html.haml @@ -5,3 +5,4 @@ - if current_user && can?(current_user, :download_code, project) = render 'shared/no_ssh' = render 'shared/no_password' + = render 'shared/auto_devops_implicitly_enabled_banner', project: project diff --git a/app/views/shared/_auto_devops_implicitly_enabled_banner.html.haml b/app/views/shared/_auto_devops_implicitly_enabled_banner.html.haml new file mode 100644 index 00000000000..6c4607b2f16 --- /dev/null +++ b/app/views/shared/_auto_devops_implicitly_enabled_banner.html.haml @@ -0,0 +1,9 @@ +- if show_auto_devops_implicitly_enabled_banner?(project) + .auto-devops-implicitly-enabled-banner.alert.alert-warning + - more_information_link = link_to _('More information'), 'https://docs.gitlab.com/ee/topics/autodevops/', class: 'alert-link' + - auto_devops_message = s_("AutoDevOps|The Auto DevOps pipeline has been enabled and will be used if no alternative CI configuration file is found. %{more_information_link}") % { more_information_link: more_information_link } + = auto_devops_message.html_safe + .alert-link-group + = link_to _('Settings'), project_settings_ci_cd_path(project), class: 'alert-link' + | + = link_to _('Dismiss'), '#', class: 'hide-auto-devops-implicitly-enabled-banner alert-link', data: { project_id: project.id } |