Skip to content
Snippets Groups Projects
Unverified Commit c4ee321f authored by Lorenz van Herwaarden's avatar Lorenz van Herwaarden Committed by GitLab
Browse files

Remove unused dataset injections for pipeline security tab

* Remove unused loading error illustations constant
* Remove vulnerabilities_endpoint
* Remove project_id
* Remove commit_path_template
parent 627032e1
No related branches found
No related tags found
No related merge requests found
import { HTTP_STATUS_FORBIDDEN, HTTP_STATUS_UNAUTHORIZED } from '~/lib/utils/http_status';
export const LOADING_VULNERABILITIES_ERROR_CODES = {
UNAUTHORIZED: HTTP_STATUS_UNAUTHORIZED,
FORBIDDEN: HTTP_STATUS_FORBIDDEN,
};
Loading
Loading
@@ -4,11 +4,8 @@ import findingsQuery from 'ee/security_dashboard/graphql/queries/pipeline_findin
 
export const getPipelineReportOptions = (data) => {
const {
commitPathTemplate,
projectFullPath,
emptyStateSvgPath,
vulnerabilitiesEndpoint,
projectId,
canAdminVulnerability,
pipelineId,
pipelineIid,
Loading
Loading
@@ -19,12 +16,9 @@ export const getPipelineReportOptions = (data) => {
} = data;
 
return {
commitPathTemplate,
projectFullPath,
emptyStateSvgPath,
vulnerabilitiesEndpoint,
dashboardType: DASHBOARD_TYPES.PIPELINE,
projectId: Number(projectId),
// fullPath is needed even though projectFullPath is already provided because
// vulnerability_list_graphql.vue expects the property name to be 'fullPath'
fullPath: projectFullPath,
Loading
Loading
Loading
Loading
@@ -13,18 +13,6 @@ class VulnerabilityReportDataEntity < Grape::Entity
ActionController::Base.helpers.image_path('illustrations/user-not-logged-in.svg')
end
 
expose :project_id do |_, options|
options[:project].id
end
expose :vulnerabilities_endpoint do |pipeline, options|
expose_path(
api_v4_projects_vulnerability_findings_path(
id: options[:project].id, params: { pipeline_id: pipeline.id }
)
)
end
expose :pipeline_jobs_path do |pipeline, options|
expose_path(
api_v4_projects_pipelines_jobs_path(id: options[:project].id, pipeline_id: pipeline.id)
Loading
Loading
@@ -43,10 +31,6 @@ class VulnerabilityReportDataEntity < Grape::Entity
options[:project].path_with_namespace
end
 
expose :commit_path_template do |_, options|
commit_path_template(options[:project])
end
expose :can_admin_vulnerability do |_, options|
(options[:user].present? && options[:user].can?(:admin_vulnerability, options[:project])).to_s
end
Loading
Loading
Loading
Loading
@@ -39,12 +39,9 @@ describe('createAppOptions', () => {
expect(options).toMatchObject({
...mockCeOptions,
provide: {
commitPathTemplate: dataset.commitPathTemplate,
projectFullPath: dataset.projectFullPath,
emptyStateSvgPath: dataset.emptyStateSvgPath,
vulnerabilitiesEndpoint: dataset.vulnerabilitiesEndpoint,
dashboardType: DASHBOARD_TYPES.PIPELINE,
projectId: 123,
fullPath: dataset.projectFullPath,
canAdminVulnerability: true,
pipeline: {
Loading
Loading
export const dataset = {
commitPathTemplate: 'commitPathTemplate',
projectFullPath: '/projectFullPath',
emptyStateSvgPath: '/emptyStateSvgPath',
vulnerabilitiesEndpoint: 'vulnerabilitiesEndpoint',
projectId: '123',
canAdminVulnerability: 'true',
pipelineId: '500',
pipelineIid: '43',
Loading
Loading
Loading
Loading
@@ -6,12 +6,9 @@ import { dataset } from '../mock_data/pipeline_report_dataset';
describe('getPipelineReportOptions', () => {
it('returns pipeline report options', () => {
expect(getPipelineReportOptions(dataset)).toEqual({
commitPathTemplate: dataset.commitPathTemplate,
projectFullPath: dataset.projectFullPath,
emptyStateSvgPath: dataset.emptyStateSvgPath,
vulnerabilitiesEndpoint: dataset.vulnerabilitiesEndpoint,
dashboardType: DASHBOARD_TYPES.PIPELINE,
projectId: 123,
fullPath: dataset.projectFullPath,
canAdminVulnerability: true,
pipeline: {
Loading
Loading
Loading
Loading
@@ -45,13 +45,10 @@
"empty_state_svg_path" => match_asset_path("illustrations/user-not-logged-in.svg"),
"pipeline_id" => pipeline.id,
"pipeline_iid" => pipeline.iid,
"project_id" => project.id,
"source_branch" => pipeline.source_ref,
"pipeline_jobs_path" => "/api/v4/projects/#{project.id}/pipelines/#{pipeline.id}/jobs",
"vulnerabilities_endpoint" => "/api/v4/projects/#{project.id}/vulnerability_findings?pipeline_id=#{pipeline.id}",
"vulnerability_exports_endpoint" => "/api/v4/security/projects/#{project.id}/vulnerability_exports",
"project_full_path" => project.path_with_namespace,
"commit_path_template" => "/#{project.path_with_namespace}/-/commit/$COMMIT_SHA",
"can_admin_vulnerability" => 'false',
"can_view_false_positive" => 'false'
})
Loading
Loading
@@ -240,13 +237,10 @@
empty_state_svg_path: match_asset_path("illustrations/user-not-logged-in.svg"),
pipeline_id: pipeline.id,
pipeline_iid: pipeline.iid,
project_id: project.id,
source_branch: pipeline.source_ref,
pipeline_jobs_path: "/api/v4/projects/#{project.id}/pipelines/#{pipeline.id}/jobs",
vulnerabilities_endpoint: "/api/v4/projects/#{project.id}/vulnerability_findings?pipeline_id=#{pipeline.id}",
vulnerability_exports_endpoint: "/api/v4/security/projects/#{project.id}/vulnerability_exports",
project_full_path: project.path_with_namespace,
commit_path_template: "/#{project.path_with_namespace}/-/commit/$COMMIT_SHA",
can_admin_vulnerability: 'false',
can_view_false_positive: 'false'
})
Loading
Loading
Loading
Loading
@@ -25,12 +25,9 @@
pipeline_iid: pipeline.iid,
source_branch: "master",
empty_state_svg_path: match_asset_path("illustrations/user-not-logged-in.svg"),
project_id: project.id,
vulnerabilities_endpoint: "/api/v4/projects/#{project.id}/vulnerability_findings?pipeline_id=#{pipeline.id}",
pipeline_jobs_path: "/api/v4/projects/#{project.id}/pipelines/#{pipeline.id}/jobs",
vulnerability_exports_endpoint: "/api/v4/security/projects/#{project.id}/vulnerability_exports",
project_full_path: project.full_path,
commit_path_template: "/#{project.full_path}/-/commit/$COMMIT_SHA",
can_admin_vulnerability: "false",
can_view_false_positive: "true",
has_jira_vulnerabilities_integration_enabled: "false"
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment