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
dcc5dabc
Commit
dcc5dabc
authored
Feb 14, 2021
by
charlie ablett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expose details of issues blocking issue
- GraphQL field causes N+1 so complexity set at 5
parent
d82ba779
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
47 additions
and
7 deletions
+47
-7
doc/api/graphql/reference/index.md
doc/api/graphql/reference/index.md
+2
-0
ee/app/graphql/ee/types/issue_type.rb
ee/app/graphql/ee/types/issue_type.rb
+8
-0
ee/changelogs/unreleased/210452-cablett-blocking-issues-details.yml
...ogs/unreleased/210452-cablett-blocking-issues-details.yml
+5
-0
ee/spec/graphql/types/issue_type_spec.rb
ee/spec/graphql/types/issue_type_spec.rb
+1
-0
ee/spec/requests/api/graphql/project/issues_spec.rb
ee/spec/requests/api/graphql/project/issues_spec.rb
+31
-7
No files found.
doc/api/graphql/reference/index.md
View file @
dcc5dabc
...
...
@@ -1767,6 +1767,7 @@ Relationship between an epic and an issue.
|
`author`
| User! | User that created the issue. |
|
`blocked`
| Boolean! | Indicates the issue is blocked. |
|
`blockedByCount`
| Int | Count of issues blocking this issue. |
|
`blockedByIssues`
| IssueConnection | Issues blocking this issue. |
|
`closedAt`
| Time | Timestamp of when the issue was closed. |
|
`confidential`
| Boolean! | Indicates the issue is confidential. |
|
`createNoteEmail`
| String | User specific email address for the issue. |
...
...
@@ -2144,6 +2145,7 @@ A block of time for which a participant is on-call.
|
`author`
| User! | User that created the issue. |
|
`blocked`
| Boolean! | Indicates the issue is blocked. |
|
`blockedByCount`
| Int | Count of issues blocking this issue. |
|
`blockedByIssues`
| IssueConnection | Issues blocking this issue. |
|
`closedAt`
| Time | Timestamp of when the issue was closed. |
|
`confidential`
| Boolean! | Indicates the issue is confidential. |
|
`createNoteEmail`
| String | User specific email address for the issue. |
...
...
ee/app/graphql/ee/types/issue_type.rb
View file @
dcc5dabc
...
...
@@ -21,6 +21,10 @@ module EE
field
:blocked_by_count
,
GraphQL
::
INT_TYPE
,
null:
true
,
description:
'Count of issues blocking this issue.'
field
:blocked_by_issues
,
::
Types
::
IssueType
.
connection_type
,
null:
true
,
description:
'Issues blocking this issue.'
,
complexity:
5
field
:health_status
,
::
Types
::
HealthStatusEnum
,
null:
true
,
description:
'Current health status.'
...
...
@@ -53,6 +57,10 @@ module EE
end
end
def
blocked_by_issues
object
.
blocked_by_issues_for
(
current_user
)
end
def
health_status
object
.
supports_health_status?
?
object
.
health_status
:
nil
end
...
...
ee/changelogs/unreleased/210452-cablett-blocking-issues-details.yml
0 → 100644
View file @
dcc5dabc
---
title
:
Expose details of blocking issues via GraphQL
merge_request
:
54152
author
:
type
:
added
ee/spec/graphql/types/issue_type_spec.rb
View file @
dcc5dabc
...
...
@@ -9,6 +9,7 @@ RSpec.describe GitlabSchema.types['Issue'] do
it
{
expect
(
described_class
).
to
have_graphql_field
(
:health_status
)
}
it
{
expect
(
described_class
).
to
have_graphql_field
(
:blocked
)
}
it
{
expect
(
described_class
).
to
have_graphql_field
(
:blocked_by_count
)
}
it
{
expect
(
described_class
).
to
have_graphql_field
(
:blocked_by_issues
)
}
it
{
expect
(
described_class
).
to
have_graphql_field
(
:sla_due_at
)
}
it
{
expect
(
described_class
).
to
have_graphql_field
(
:metric_images
)
}
...
...
ee/spec/requests/api/graphql/project/issues_spec.rb
View file @
dcc5dabc
...
...
@@ -72,6 +72,9 @@ RSpec.describe 'getting an issue list for a project' do
id
blocked
blockedByCount
blockedByIssues {
nodes { id }
}
}
QUERY
end
...
...
@@ -94,16 +97,37 @@ RSpec.describe 'getting an issue list for a project' do
post_graphql
(
single_issue_query
,
current_user:
current_user
)
end
it
'returns the correct result'
,
:aggregate_failures
do
check_result
(
blocked_issue1
,
true
,
1
)
check_result
(
blocked_issue2
,
true
,
2
)
check_result
(
blocking_issue1
,
false
,
0
)
check_result
(
blocking_issue2
,
false
,
0
)
context
'correct result'
do
before
do
post_graphql
(
query
,
current_user:
current_user
)
end
it
'returns the correct blocked count result'
,
:aggregate_failures
do
expect_blocked_count
(
blocked_issue1
,
true
,
1
)
expect_blocked_count
(
blocked_issue2
,
true
,
2
)
expect_blocked_count
(
blocking_issue1
,
false
,
0
)
expect_blocked_count
(
blocking_issue2
,
false
,
0
)
expect_blocked_count
(
blocking_issue3
,
false
,
0
)
end
it
'returns the correct blocked issue detail result'
,
:aggregate_failures
do
expect_blocking_issues
(
blocked_issue1
,
[
blocking_issue1
])
expect_blocking_issues
(
blocked_issue2
,
[
blocking_issue2
,
blocking_issue3
])
expect_blocking_issues
(
blocking_issue1
,
[])
expect_blocking_issues
(
blocking_issue2
,
[])
expect_blocking_issues
(
blocking_issue3
,
[])
expect_blocking_issues
(
unrelated_issue
,
[])
end
end
def
check_result
(
issue
,
expected_blocked
,
expected_blocked_count
)
post_graphql
(
query
,
current_user:
current_user
)
def
expect_blocking_issues
(
issue
,
expected_blocking_issues
)
nodes
=
graphql_data
.
dig
(
'project'
,
'issues'
,
'nodes'
)
node
=
nodes
.
find
{
|
r
|
r
[
'id'
]
==
issue
.
to_global_id
.
to_s
}
expect
(
node
[
'blockedByIssues'
][
'nodes'
]).
to
match_array
expected_blocking_issues
.
map
{
|
i
|
{
"id"
=>
i
.
to_global_id
.
to_s
}}
end
def
expect_blocked_count
(
issue
,
expected_blocked
,
expected_blocked_count
)
nodes
=
graphql_data
.
dig
(
'project'
,
'issues'
,
'nodes'
)
node
=
nodes
.
find
{
|
r
|
r
[
'id'
]
==
issue
.
to_global_id
.
to_s
}
...
...
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