Commit a89a85d2 authored by Stan Hu's avatar Stan Hu

Merge branch 'expose_group_level_export_url_to_frontend' into 'master'

Expose Group-level vulnerability export url

See merge request gitlab-org/gitlab!32591
parents 28b81f10 3800b865
...@@ -25,4 +25,18 @@ module Groups::SecurityFeaturesHelper ...@@ -25,4 +25,18 @@ module Groups::SecurityFeaturesHelper
group_security_credentials_path(group) group_security_credentials_path(group)
end end
end end
def group_level_security_dashboard_data(group)
{
vulnerabilities_endpoint: group_security_vulnerability_findings_path(group),
vulnerabilities_history_endpoint: history_group_security_vulnerability_findings_path(group),
projects_endpoint: expose_url(api_v4_groups_projects_path(id: group.id)),
group_full_path: group.full_path,
vulnerability_feedback_help_path: help_page_path("user/application_security/index", anchor: "interacting-with-the-vulnerabilities"),
empty_state_svg_path: image_path('illustrations/security-dashboard-empty-state.svg'),
dashboard_documentation: help_page_path('user/application_security/security_dashboard/index'),
vulnerable_projects_endpoint: group_security_vulnerable_projects_path(group),
vulnerabilities_export_endpoint: expose_path(api_v4_security_groups_vulnerability_exports_path(id: group.id))
}
end
end end
- breadcrumb_title _("Security Dashboard") - breadcrumb_title _("Security Dashboard")
- page_title _("Security Dashboard") - page_title _("Security Dashboard")
#js-group-security-dashboard{ data: { vulnerabilities_endpoint: group_security_vulnerability_findings_path(@group), #js-group-security-dashboard{ data: group_level_security_dashboard_data(@group) }
vulnerabilities_history_endpoint: history_group_security_vulnerability_findings_path(@group),
projects_endpoint: expose_url(api_v4_groups_projects_path(id: @group.id)),
group_full_path: @group.full_path,
vulnerability_feedback_help_path: help_page_path("user/application_security/index", anchor: "interacting-with-the-vulnerabilities"),
empty_state_svg_path: image_path('illustrations/security-dashboard-empty-state.svg'),
dashboard_documentation: help_page_path('user/application_security/security_dashboard/index'),
vulnerable_projects_endpoint: group_security_vulnerable_projects_path(@group) } }
...@@ -119,4 +119,24 @@ describe Groups::SecurityFeaturesHelper do ...@@ -119,4 +119,24 @@ describe Groups::SecurityFeaturesHelper do
end end
end end
end end
describe '#group_level_security_dashboard_data' do
let(:expected_data) do
{
vulnerabilities_endpoint: "/groups/#{group.full_path}/-/security/vulnerability_findings",
vulnerabilities_history_endpoint: "/groups/#{group.full_path}/-/security/vulnerability_findings/history",
projects_endpoint: "http://localhost/api/v4/groups/#{group.id}/projects",
group_full_path: group.full_path,
vulnerability_feedback_help_path: '/help/user/application_security/index#interacting-with-the-vulnerabilities',
empty_state_svg_path: '/images/illustrations/security-dashboard-empty-state.svg',
dashboard_documentation: '/help/user/application_security/security_dashboard/index',
vulnerable_projects_endpoint: "/groups/#{group.full_path}/-/security/vulnerable_projects",
vulnerabilities_export_endpoint: "/api/v4/security/groups/#{group.id}/vulnerability_exports"
}
end
subject { group_level_security_dashboard_data(group) }
it { is_expected.to eq(expected_data) }
end
end end
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