Commit 11498b4c authored by Michał Zając's avatar Michał Zając

Add security_dashboard_path to GraphQL ProjectType

This allows us to avoid unnecessary computations on the frontend as
outlined in https://gitlab.com/gitlab-org/gitlab/-/issues/225584
parent d6905be0
......@@ -10052,6 +10052,11 @@ type Project {
"""
sastCiConfiguration: SastCiConfiguration
"""
Path to project's security dashboard
"""
securityDashboardPath: String
"""
Information about security analyzers used in the project
"""
......
......@@ -29651,6 +29651,20 @@
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "securityDashboardPath",
"description": "Path to project's security dashboard",
"args": [
],
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "securityScanners",
"description": "Information about security analyzers used in the project",
......@@ -1470,6 +1470,7 @@ Information about pagination in a connection.
| `requirement` | Requirement | Find a single requirement. Available only when feature flag `requirements_management` is enabled. |
| `requirementStatesCount` | RequirementStatesCount | Number of requirements for the project by their state |
| `sastCiConfiguration` | SastCiConfiguration | SAST CI configuration for the project |
| `securityDashboardPath` | String | Path to project's security dashboard |
| `securityScanners` | SecurityScanners | Information about security analyzers used in the project |
| `sentryDetailedError` | SentryDetailedError | Detailed version of a Sentry error on the project |
| `sentryErrors` | SentryErrorCollection | Paginated collection of Sentry errors on the project |
......
......@@ -53,6 +53,13 @@ module EE
resolver: ::Resolvers::ComplianceFrameworksResolver,
null: true
field :security_dashboard_path, GraphQL::STRING_TYPE,
description: "Path to project's security dashboard",
null: true,
resolve: -> (project, args, ctx) do
Rails.application.routes.url_helpers.project_security_dashboard_index_path(project)
end
def self.requirements_available?(project, user)
::Feature.enabled?(:requirements_management, project, default_enabled: true) && Ability.allowed?(user, :read_requirement, project)
end
......
......@@ -17,6 +17,7 @@ RSpec.describe GitlabSchema.types['Project'] do
expected_fields = %w[
vulnerabilities vulnerability_scanners requirement_states_count
vulnerability_severities_count packages compliance_frameworks
security_dashboard_path
]
expect(described_class).to include_graphql_fields(*expected_fields)
......
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