Commit bbec73e5 authored by David Pisek's avatar David Pisek Committed by Fatih Acet

Add partials and logic for security sidebar item

This commit adds the partials and logic needed for rendering the new
top-level navigation item within the project's sidebar.
parent 8a7d0222
...@@ -34,10 +34,6 @@ ...@@ -34,10 +34,6 @@
= link_to project_releases_path(@project), title: _('Releases'), class: 'shortcuts-project-releases' do = link_to project_releases_path(@project), title: _('Releases'), class: 'shortcuts-project-releases' do
%span= _('Releases') %span= _('Releases')
= render_if_exists 'projects/sidebar/security_dashboard'
= render_if_exists 'projects/sidebar/dependencies'
- if can?(current_user, :read_cycle_analytics, @project) - if can?(current_user, :read_cycle_analytics, @project)
= nav_link(path: 'cycle_analytics#show') do = nav_link(path: 'cycle_analytics#show') do
= link_to project_cycle_analytics_path(@project), title: _('Cycle Analytics'), class: 'shortcuts-project-cycle-analytics' do = link_to project_cycle_analytics_path(@project), title: _('Cycle Analytics'), class: 'shortcuts-project-cycle-analytics' do
...@@ -203,6 +199,8 @@ ...@@ -203,6 +199,8 @@
%span %span
= _('Charts') = _('Charts')
= render_if_exists 'layouts/nav/sidebar/project_security_link' # EE-specific
- if project_nav_tab? :operations - if project_nav_tab? :operations
= nav_link(controller: sidebar_operations_paths) do = nav_link(controller: sidebar_operations_paths) do
= link_to sidebar_operations_link_path, class: 'shortcuts-operations qa-link-operations' do = link_to sidebar_operations_link_path, class: 'shortcuts-operations qa-link-operations' do
......
...@@ -7,8 +7,6 @@ module EE ...@@ -7,8 +7,6 @@ module EE
override :sidebar_projects_paths override :sidebar_projects_paths
def sidebar_projects_paths def sidebar_projects_paths
super + %w[ super + %w[
projects/dependencies#show
projects/security/dashboard#show
projects/insights#show projects/insights#show
] ]
end end
...@@ -38,6 +36,10 @@ module EE ...@@ -38,6 +36,10 @@ module EE
def get_project_nav_tabs(project, current_user) def get_project_nav_tabs(project, current_user)
nav_tabs = super nav_tabs = super
if can?(current_user, :read_project_security_dashboard, @project)
nav_tabs << :security
end
if ::Gitlab.config.packages.enabled && if ::Gitlab.config.packages.enabled &&
project.feature_available?(:packages) && project.feature_available?(:packages) &&
can?(current_user, :read_package, project) can?(current_user, :read_package, project)
...@@ -128,6 +130,13 @@ module EE ...@@ -128,6 +130,13 @@ module EE
@project.feature_available?(:merge_trains) @project.feature_available?(:merge_trains)
end end
def sidebar_security_paths
%w[
projects/security/dashboard#show
projects/dependencies#show
]
end
def size_limit_message(project) def size_limit_message(project)
show_lfs = project.lfs_enabled? ? 'including files in LFS' : '' show_lfs = project.lfs_enabled? ? 'including files in LFS' : ''
......
- if project_nav_tab?(:security)
= nav_link(path: sidebar_security_paths) do
= link_to project_security_dashboard_path(@project), title: _('Security Dashboard') do
.nav-icon-container
= sprite_icon('shield')
%span.nav-item-name
= _('Security & Compliance')
%ul.sidebar-sub-level-items
= nav_link(path: sidebar_security_paths, html_options: { class: "fly-out-top-item" } ) do
= link_to project_security_dashboard_path(@project) do
%strong.fly-out-top-item-name
= _('Security & Compliance')
%li.divider.fly-out-top-item
= nav_link(path: 'projects/security/dashboard#show') do
= link_to project_security_dashboard_path(@project), title: _('Security Dashboard') do
%span= _('Security Dashboard')
- if @project.feature_available?(:dependency_list)
= nav_link(path: 'projects/dependencies#show') do
= link_to project_dependencies_path(@project), title: _('Dependency List') do
%span= _('Dependency List')
- if @project.feature_available?(:dependency_list)
= nav_link(path: 'projects/dependencies#show') do
= link_to project_dependencies_path(@project), title: _('Dependency List'), class: 'shortcuts-project-dependencies' do
%span= _('Dependency List')
- if can?(current_user, :read_project_security_dashboard, @project)
= nav_link(path: 'projects/security/dashboard#show') do
= link_to project_security_dashboard_path(@project), title: _('Security Dashboard'), class: 'shortcuts-project-security-dashboard' do
%span= _('Security Dashboard')
---
title: Add 'Security & Compliance' as top-level navigation item to the project-sidebar
merge_request: 14628
author:
type: changed
...@@ -12232,6 +12232,9 @@ msgstr "" ...@@ -12232,6 +12232,9 @@ msgstr ""
msgid "Security" msgid "Security"
msgstr "" msgstr ""
msgid "Security & Compliance"
msgstr ""
msgid "Security Dashboard" msgid "Security Dashboard"
msgstr "" msgstr ""
......
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