Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
0568c5e3
Commit
0568c5e3
authored
Aug 11, 2020
by
Philip Cunningham
Committed by
Ash McKenzie
Aug 11, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add editPath to DastSiteProfileType for GraphQL
Allows frontend to get relative path to edit page.
parent
ad6947bb
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
47 additions
and
1 deletion
+47
-1
doc/api/graphql/reference/gitlab_schema.graphql
doc/api/graphql/reference/gitlab_schema.graphql
+5
-0
doc/api/graphql/reference/gitlab_schema.json
doc/api/graphql/reference/gitlab_schema.json
+14
-0
doc/api/graphql/reference/index.md
doc/api/graphql/reference/index.md
+1
-0
ee/app/graphql/types/dast_site_profile_type.rb
ee/app/graphql/types/dast_site_profile_type.rb
+6
-0
ee/spec/graphql/types/dast_site_profile_type_spec.rb
ee/spec/graphql/types/dast_site_profile_type_spec.rb
+20
-1
ee/spec/requests/api/graphql/project/dast_site_profiles_spec.rb
...c/requests/api/graphql/project/dast_site_profiles_spec.rb
+1
-0
No files found.
doc/api/graphql/reference/gitlab_schema.graphql
View file @
0568c5e3
...
...
@@ -2746,6 +2746,11 @@ type DastScannerProfileEdge {
Represents
a
DAST
Site
Profile
.
"""
type
DastSiteProfile
{
"""
Relative
web
path
to
the
edit
page
of
a
site
profile
"""
editPath
:
String
"""
ID
of
the
site
profile
"""
...
...
doc/api/graphql/reference/gitlab_schema.json
View file @
0568c5e3
...
...
@@ -7395,6 +7395,20 @@
"name": "DastSiteProfile",
"description": "Represents a DAST Site Profile.",
"fields": [
{
"name": "editPath",
"description": "Relative web path to the edit page of a site profile",
"args": [
],
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "id",
"description": "ID of the site profile",
doc/api/graphql/reference/index.md
View file @
0568c5e3
...
...
@@ -453,6 +453,7 @@ Represents a DAST Site Profile.
| Name | Type | Description |
| --- | ---- | ---------- |
|
`editPath`
| String | Relative web path to the edit page of a site profile |
|
`id`
| DastSiteProfileID! | ID of the site profile |
|
`profileName`
| String | The name of the site profile |
|
`targetUrl`
| String | The URL of the target to be scanned |
...
...
ee/app/graphql/types/dast_site_profile_type.rb
View file @
0568c5e3
...
...
@@ -20,6 +20,12 @@ module Types
description:
'The URL of the target to be scanned'
,
resolve:
->
(
obj
,
_args
,
_ctx
)
{
obj
.
dast_site
.
url
}
field
:edit_path
,
GraphQL
::
STRING_TYPE
,
null:
true
,
description:
'Relative web path to the edit page of a site profile'
,
resolve:
->
(
obj
,
_args
,
_ctx
)
do
Rails
.
application
.
routes
.
url_helpers
.
edit_project_dast_site_profile_path
(
obj
.
project
,
obj
)
end
field
:validation_status
,
Types
::
DastSiteProfileValidationStatusEnum
,
null:
true
,
description:
'The current validation status of the site profile'
,
resolve:
->
(
_obj
,
_args
,
_ctx
)
{
Types
::
DastSiteProfileValidationStatusEnum
.
enum
[
'pending_validation'
]
}
...
...
ee/spec/graphql/types/dast_site_profile_type_spec.rb
View file @
0568c5e3
...
...
@@ -6,7 +6,7 @@ RSpec.describe GitlabSchema.types['DastSiteProfile'] do
let_it_be
(
:dast_site_profile
)
{
create
(
:dast_site_profile
)
}
let_it_be
(
:project
)
{
dast_site_profile
.
project
}
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:fields
)
{
%i[id profileName targetUrl validationStatus userPermissions]
}
let_it_be
(
:fields
)
{
%i[id profileName targetUrl
editPath
validationStatus userPermissions]
}
subject
do
GitlabSchema
.
execute
(
...
...
@@ -44,6 +44,7 @@ RSpec.describe GitlabSchema.types['DastSiteProfile'] do
id
profileName
targetUrl
editPath
validationStatus
}
}
...
...
@@ -74,10 +75,28 @@ RSpec.describe GitlabSchema.types['DastSiteProfile'] do
end
end
describe
'edit_path field'
do
it
'is the relative path to edit the dast_site_profile'
do
path
=
"/
#{
project
.
full_path
}
/-/on_demand_scans/profiles/dast_site_profiles/
#{
dast_site_profile
.
id
}
/edit"
expect
(
first_dast_site_profile
[
'editPath'
]).
to
eq
(
path
)
end
end
describe
'validation_status field'
do
it
'is a placeholder validation status'
do
expect
(
first_dast_site_profile
[
'validationStatus'
]).
to
eq
(
'PENDING_VALIDATION'
)
end
end
context
'when there are no dast_site_profiles'
do
let
(
:project
)
{
create
(
:project
)
}
it
'has no nodes'
do
nodes
=
subject
.
dig
(
'data'
,
'project'
,
'dastSiteProfiles'
,
'nodes'
)
expect
(
nodes
).
to
be_empty
end
end
end
end
ee/spec/requests/api/graphql/project/dast_site_profiles_spec.rb
View file @
0568c5e3
...
...
@@ -21,6 +21,7 @@ RSpec.describe 'Query.project(fullPath).dastSiteProfiles' do
id
profileName
targetUrl
editPath
validationStatus
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment