Commit bfb5044a authored by Pavel Shutsin's avatar Pavel Shutsin

Add epic filter for issues GraphQL

It can be used for Issues Analytics
parent 5f55a666
......@@ -29,7 +29,7 @@ module IssueResolverArguments
description: 'Usernames of users assigned to the issue'
argument :assignee_id, GraphQL::STRING_TYPE,
required: false,
description: 'ID of a user assigned to the issues, "none" and "any" values supported'
description: 'ID of a user assigned to the issues, "none" and "any" values are supported'
argument :created_before, Types::TimeType,
required: false,
description: 'Issues created before this date'
......
......@@ -8387,7 +8387,7 @@ type Group {
after: String
"""
ID of a user assigned to the issues, "none" and "any" values supported
ID of a user assigned to the issues, "none" and "any" values are supported
"""
assigneeId: String
......@@ -8431,6 +8431,11 @@ type Group {
"""
createdBefore: Time
"""
ID of an epic associated with the issues, "none" and "any" values are supported
"""
epicId: String
"""
Returns the first _n_ elements from the list.
"""
......@@ -14695,7 +14700,7 @@ type Project {
"""
issue(
"""
ID of a user assigned to the issues, "none" and "any" values supported
ID of a user assigned to the issues, "none" and "any" values are supported
"""
assigneeId: String
......@@ -14734,6 +14739,11 @@ type Project {
"""
createdBefore: Time
"""
ID of an epic associated with the issues, "none" and "any" values are supported
"""
epicId: String
"""
IID of the issue. For example, "1"
"""
......@@ -14795,7 +14805,7 @@ type Project {
"""
issueStatusCounts(
"""
ID of a user assigned to the issues, "none" and "any" values supported
ID of a user assigned to the issues, "none" and "any" values are supported
"""
assigneeId: String
......@@ -14885,7 +14895,7 @@ type Project {
after: String
"""
ID of a user assigned to the issues, "none" and "any" values supported
ID of a user assigned to the issues, "none" and "any" values are supported
"""
assigneeId: String
......@@ -14929,6 +14939,11 @@ type Project {
"""
createdBefore: Time
"""
ID of an epic associated with the issues, "none" and "any" values are supported
"""
epicId: String
"""
Returns the first _n_ elements from the list.
"""
......
......@@ -23095,7 +23095,7 @@
},
{
"name": "assigneeId",
"description": "ID of a user assigned to the issues, \"none\" and \"any\" values supported",
"description": "ID of a user assigned to the issues, \"none\" and \"any\" values are supported",
"type": {
"kind": "SCALAR",
"name": "String",
......@@ -23225,6 +23225,16 @@
},
"defaultValue": null
},
{
"name": "epicId",
"description": "ID of an epic associated with the issues, \"none\" and \"any\" values are supported",
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"defaultValue": null
},
{
"name": "includeSubgroups",
"description": "Include issues belonging to subgroups",
......@@ -43209,7 +43219,7 @@
},
{
"name": "assigneeId",
"description": "ID of a user assigned to the issues, \"none\" and \"any\" values supported",
"description": "ID of a user assigned to the issues, \"none\" and \"any\" values are supported",
"type": {
"kind": "SCALAR",
"name": "String",
......@@ -43338,6 +43348,16 @@
}
},
"defaultValue": null
},
{
"name": "epicId",
"description": "ID of an epic associated with the issues, \"none\" and \"any\" values are supported",
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"defaultValue": null
}
],
"type": {
......@@ -43448,7 +43468,7 @@
},
{
"name": "assigneeId",
"description": "ID of a user assigned to the issues, \"none\" and \"any\" values supported",
"description": "ID of a user assigned to the issues, \"none\" and \"any\" values are supported",
"type": {
"kind": "SCALAR",
"name": "String",
......@@ -43653,7 +43673,7 @@
},
{
"name": "assigneeId",
"description": "ID of a user assigned to the issues, \"none\" and \"any\" values supported",
"description": "ID of a user assigned to the issues, \"none\" and \"any\" values are supported",
"type": {
"kind": "SCALAR",
"name": "String",
......@@ -43783,6 +43803,16 @@
},
"defaultValue": null
},
{
"name": "epicId",
"description": "ID of an epic associated with the issues, \"none\" and \"any\" values are supported",
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"defaultValue": null
},
{
"name": "after",
"description": "Returns the elements in the list that come after the specified cursor.",
......@@ -10,6 +10,10 @@ module EE
argument :iteration_id, ::GraphQL::ID_TYPE.to_list_type,
required: false,
description: 'Iterations applied to the issue'
argument :epic_id, GraphQL::STRING_TYPE,
required: false,
description: 'ID of an epic associated with the issues, "none" and "any" values are supported'
end
private
......
......@@ -7,7 +7,7 @@ RSpec.describe Resolvers::IssuesResolver do
let_it_be(:current_user) { create(:user) }
let_it_be(:group) { create(:group) }
let_it_be(:project) { create(:project, namespace: group) }
let_it_be(:project) { create(:project, namespace: group, skip_disk_validation: true) }
context "with a project" do
describe '#resolve' do
......@@ -72,6 +72,26 @@ RSpec.describe Resolvers::IssuesResolver do
expect(resolve_issues(iteration_id: iteration1.id)).to eq [issue_with_iteration]
end
end
describe 'filter by epic' do
let_it_be(:epic) { create :epic, group: group }
let_it_be(:epic2) { create :epic, group: group }
let_it_be(:issue1) { create :issue, project: project, epic: epic }
let_it_be(:issue2) { create :issue, project: project, epic: epic2 }
let_it_be(:issue3) { create :issue, project: project }
it 'returns issues without epic when epic_id is "none"' do
expect(resolve_issues(epic_id: 'none')).to match_array([issue3])
end
it 'returns issues with any epic when epic_id is "any"' do
expect(resolve_issues(epic_id: 'any')).to match_array([issue1, issue2])
end
it 'returns issues with any epic when epic_id is specific' do
expect(resolve_issues(epic_id: epic.id)).to match_array([issue1])
end
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