Commit c27f388e authored by Lukas Eipert's avatar Lukas Eipert Committed by Rémy Coutable

Pipeline security dashboard: Move EE specific code to EE folder

parent b4bf56fc
#js-pipeline-header-vue.pipeline-header-container
- sast_artifact = @pipeline.sast_artifact
- dependency_artifact = @pipeline.dependency_scanning_artifact
- dast_artifact = @pipeline.dast_artifact
- sast_container_artifact = @pipeline.sast_container_artifact
- if @commit.present?
.commit-box
......@@ -17,7 +13,7 @@
.well-segment.pipeline-info
.icon-container
= icon('clock-o')
= pluralize @pipeline.statuses.count(:id), "job"
= pluralize @pipeline.total_size, "job"
- if @pipeline.ref
from
= link_to @pipeline.ref, project_ref_path(@project, @pipeline.ref), class: "ref-name"
......@@ -38,5 +34,4 @@
= link_to @pipeline.sha, project_commit_path(@project, @pipeline.sha), class: "commit-sha commit-hash-full"
= clipboard_button(text: @pipeline.sha, title: "Copy commit SHA to clipboard")
- if sast_artifact || dependency_artifact || dast_artifact || sast_container_artifact
.js-sast-summary
= render_if_exists "projects/pipelines/info_extension", pipeline: @pipeline
- expose_sast_data = @pipeline.expose_sast_data?
- expose_dependency_data = @pipeline.expose_dependency_scanning_data?
- expose_dast_data = @pipeline.expose_dast_data?
- expose_sast_container_data = @pipeline.expose_sast_container_data?
- expose_container_scanning_data = @pipeline.expose_container_scanning_data?
- blob_path = project_blob_path(@project, @pipeline.sha)
.tabs-holder
%ul.pipelines-tabs.nav-links.no-top.no-bottom.mobile-separator.nav.nav-tabs
%li.js-pipeline-tab-link
......@@ -19,11 +12,7 @@
= link_to failures_project_pipeline_path(@project, @pipeline), data: { target: '#js-tab-failures', action: 'failures', toggle: 'tab' }, class: 'failures-tab' do
= _("Failed Jobs")
%span.badge.badge-pill.js-failures-counter= @pipeline.failed_builds.count
- if expose_sast_data || expose_dependency_data
%li.js-security-tab-link
= link_to security_project_pipeline_path(@project, @pipeline), data: { target: '#js-tab-security', action: 'security', toggle: 'tab' }, class: 'security-tab' do
= _("Security report")
%span.badge.badge-pill.js-sast-counter.hidden
= render_if_exists "projects/pipelines/tabs_holder", pipeline: @pipeline, project: @project
.tab-content
#js-tab-pipeline.tab-pane
......@@ -87,19 +76,4 @@
%pre.build-trace.build-trace-rounded
%code.bash.js-build-output
= build_summary(build)
- if expose_sast_data || expose_dependency_data || expose_dast_data || expose_sast_container_data || expose_container_scanning_data
#js-tab-security.build-security.tab-pane
#js-security-report-app{ data: { endpoint: expose_sast_data ? sast_artifact_url(@pipeline) : nil,
blob_path: blob_path,
dependency_scanning_endpoint: expose_dependency_data ? dependency_scanning_artifact_url(@pipeline) : nil,
dast_endpoint: expose_dast_data ? dast_artifact_url(@pipeline) : nil,
sast_container_endpoint: expose_sast_container_data ? sast_container_artifact_url(@pipeline) : (expose_container_scanning_data ? container_scanning_artifact_url(@pipeline) : nil),
pipeline_id: @pipeline.id,
vulnerability_feedback_path: project_vulnerability_feedback_index_path(@project),
vulnerability_feedback_help_path: help_page_path("user/project/merge_requests/index", anchor: "interacting-with-security-reports-ultimate"),
sast_help_path: help_page_path('user/project/merge_requests/sast'),
dependency_scanning_help_path: help_page_path('user/project/merge_requests/dependency_scanning'),
dast_help_path: help_page_path('user/project/merge_requests/dast'),
sast_container_help_path: help_page_path('user/project/merge_requests/sast_container'),
can_create_feedback: can?(current_user, :admin_vulnerability_feedback, @project),
can_create_issue: show_new_issue_link?(@project)} }
= render_if_exists "projects/pipelines/tabs_content", pipeline: @pipeline, project: @project
......@@ -132,6 +132,14 @@ module EE
has_performance_data?
end
def expose_security_dashboard?
expose_sast_data? ||
expose_dependency_scanning_data? ||
expose_dast_data? ||
expose_sast_container_data? ||
expose_container_scanning_data?
end
# expose_codeclimate_data? is deprecated and replaced with expose_code_quality_data? (#5779)
def expose_codeclimate_data?
has_codeclimate_data?
......
- return unless local_assigns.fetch(:pipeline).expose_security_dashboard?
.js-sast-summary
- pipeline = local_assigns.fetch(:pipeline)
- project = local_assigns.fetch(:project)
- return unless pipeline.expose_security_dashboard?
- sast_endpoint = pipeline.expose_sast_data? ? sast_artifact_url(pipeline) : nil
- dependency_scanning_endpoint = pipeline.expose_dependency_scanning_data? ? dependency_scanning_artifact_url(pipeline) : nil
- dast_endpoint = pipeline.expose_dast_data? ? dast_artifact_url(pipeline) : nil
- sast_container_endpoint = pipeline.expose_sast_container_data? ? sast_container_artifact_url(pipeline) : pipeline.expose_container_scanning_data? ? container_scanning_artifact_url(pipeline) : nil
- blob_path = project_blob_path(project, pipeline.sha)
#js-tab-security.build-security.tab-pane
#js-security-report-app{ data: { endpoint: sast_endpoint,
blob_path: blob_path,
dependency_scanning_endpoint: dependency_scanning_endpoint,
dast_endpoint: dast_endpoint,
sast_container_endpoint: sast_container_endpoint,
pipeline_id: pipeline.id,
vulnerability_feedback_path: project_vulnerability_feedback_index_path(project),
vulnerability_feedback_help_path: help_page_path("user/project/merge_requests/index", anchor: "interacting-with-security-reports-ultimate"),
sast_help_path: help_page_path('user/project/merge_requests/sast'),
dependency_scanning_help_path: help_page_path('user/project/merge_requests/dependency_scanning'),
dast_help_path: help_page_path('user/project/merge_requests/dast'),
sast_container_help_path: help_page_path('user/project/merge_requests/sast_container'),
can_create_feedback: can?(current_user, :admin_vulnerability_feedback, project),
can_create_issue: show_new_issue_link?(project)} }
- pipeline = local_assigns.fetch(:pipeline)
- project = local_assigns.fetch(:project)
- return unless pipeline.expose_security_dashboard?
%li.js-security-tab-link
= link_to security_project_pipeline_path(project, pipeline), data: { target: '#js-tab-security', action: 'security', toggle: 'tab' }, class: 'security-tab' do
= _("Security report")
%span.badge.badge-pill.js-sast-counter.hidden
......@@ -32,6 +32,7 @@ describe MergeRequestWidgetEntity do
allow(merge_request).to receive_messages(
expose_codeclimate_data?: true,
expose_security_dashboard?: false,
base_codeclimate_artifact: build,
head_codeclimate_artifact: build
)
......@@ -44,6 +45,7 @@ describe MergeRequestWidgetEntity do
allow(merge_request).to receive_messages(
expose_code_quality_data?: true,
expose_security_dashboard?: false,
base_code_quality_artifact: build,
head_code_quality_artifact: build
)
......@@ -60,6 +62,7 @@ describe MergeRequestWidgetEntity do
allow(merge_request).to receive_messages(
expose_performance_data?: true,
expose_security_dashboard?: false,
base_performance_artifact: build,
head_performance_artifact: build
)
......@@ -72,6 +75,7 @@ describe MergeRequestWidgetEntity do
allow(merge_request).to receive_messages(
expose_sast_data?: true,
expose_security_dashboard?: true,
base_has_sast_data?: true,
base_sast_artifact: build,
head_sast_artifact: build
......@@ -87,6 +91,7 @@ describe MergeRequestWidgetEntity do
allow(merge_request).to receive_messages(
expose_dependency_scanning_data?: true,
expose_security_dashboard?: true,
base_has_dependency_scanning_data?: true,
base_dependency_scanning_artifact: build,
head_dependency_scanning_artifact: build
......@@ -102,6 +107,7 @@ describe MergeRequestWidgetEntity do
allow(merge_request).to receive_messages(
expose_license_management_data?: true,
expose_security_dashboard?: false,
base_has_license_management_data?: true,
base_license_management_artifact: build,
head_license_management_artifact: build
......@@ -118,6 +124,7 @@ describe MergeRequestWidgetEntity do
allow(merge_request).to receive_messages(
expose_sast_container_data?: true,
expose_security_dashboard?: true,
base_has_sast_container_data?: true,
base_sast_container_artifact: build,
head_sast_container_artifact: build
......@@ -133,6 +140,7 @@ describe MergeRequestWidgetEntity do
allow(merge_request).to receive_messages(
expose_container_scanning_data?: true,
expose_security_dashboard?: true,
base_has_container_scanning_data?: true,
base_container_scanning_artifact: build,
head_container_scanning_artifact: build
......@@ -148,6 +156,7 @@ describe MergeRequestWidgetEntity do
allow(merge_request).to receive_messages(
expose_dast_data?: true,
expose_security_dashboard?: true,
base_has_dast_data?: true,
base_dast_artifact: build,
head_dast_artifact: build
......
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