Commit 96df25d8 authored by Michael Kozono's avatar Michael Kozono

Merge branch '197227-milestone-tab-async' into 'master'

Seach issues in graphQl by milestone and assignees

See merge request gitlab-org/gitlab!25794
parents 6429f5bc fd25fe9f
...@@ -15,6 +15,15 @@ module Resolvers ...@@ -15,6 +15,15 @@ module Resolvers
argument :label_name, GraphQL::STRING_TYPE.to_list_type, argument :label_name, GraphQL::STRING_TYPE.to_list_type,
required: false, required: false,
description: 'Labels applied to this issue' description: 'Labels applied to this issue'
argument :milestone_title, GraphQL::STRING_TYPE.to_list_type,
required: false,
description: 'Milestones applied to this issue'
argument :assignee_username, GraphQL::STRING_TYPE,
required: false,
description: 'Username of a user assigned to the issues'
argument :assignee_id, GraphQL::STRING_TYPE,
required: false,
description: 'ID of a user assigned to the issues, "none" and "any" values supported'
argument :created_before, Types::TimeType, argument :created_before, Types::TimeType,
required: false, required: false,
description: 'Issues created before this date' description: 'Issues created before this date'
......
---
title: Search issues in GraphQL API by milestone title and assignees
merge_request: 25794
author:
type: added
...@@ -5403,6 +5403,16 @@ type Project { ...@@ -5403,6 +5403,16 @@ type Project {
A single issue of the project A single issue of the project
""" """
issue( issue(
"""
ID of a user assigned to the issues, "none" and "any" values supported
"""
assigneeId: String
"""
Username of a user assigned to the issues
"""
assigneeUsername: String
""" """
Issues closed after this date Issues closed after this date
""" """
...@@ -5438,6 +5448,11 @@ type Project { ...@@ -5438,6 +5448,11 @@ type Project {
""" """
labelName: [String] labelName: [String]
"""
Milestones applied to this issue
"""
milestoneTitle: [String]
""" """
Search query for finding issues by title or description Search query for finding issues by title or description
""" """
...@@ -5473,6 +5488,16 @@ type Project { ...@@ -5473,6 +5488,16 @@ type Project {
""" """
after: String after: String
"""
ID of a user assigned to the issues, "none" and "any" values supported
"""
assigneeId: String
"""
Username of a user assigned to the issues
"""
assigneeUsername: String
""" """
Returns the elements in the list that come before the specified cursor. Returns the elements in the list that come before the specified cursor.
""" """
...@@ -5523,6 +5548,11 @@ type Project { ...@@ -5523,6 +5548,11 @@ type Project {
""" """
last: Int last: Int
"""
Milestones applied to this issue
"""
milestoneTitle: [String]
""" """
Search query for finding issues by title or description Search query for finding issues by title or description
""" """
......
...@@ -749,6 +749,40 @@ ...@@ -749,6 +749,40 @@
}, },
"defaultValue": null "defaultValue": null
}, },
{
"name": "milestoneTitle",
"description": "Milestones applied to this issue",
"type": {
"kind": "LIST",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
},
"defaultValue": null
},
{
"name": "assigneeUsername",
"description": "Username of a user assigned to the issues",
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"defaultValue": null
},
{
"name": "assigneeId",
"description": "ID of a user assigned to the issues, \"none\" and \"any\" values supported",
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"defaultValue": null
},
{ {
"name": "createdBefore", "name": "createdBefore",
"description": "Issues created before this date", "description": "Issues created before this date",
...@@ -894,6 +928,40 @@ ...@@ -894,6 +928,40 @@
}, },
"defaultValue": null "defaultValue": null
}, },
{
"name": "milestoneTitle",
"description": "Milestones applied to this issue",
"type": {
"kind": "LIST",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
},
"defaultValue": null
},
{
"name": "assigneeUsername",
"description": "Username of a user assigned to the issues",
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"defaultValue": null
},
{
"name": "assigneeId",
"description": "ID of a user assigned to the issues, \"none\" and \"any\" values supported",
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"defaultValue": null
},
{ {
"name": "createdBefore", "name": "createdBefore",
"description": "Issues created before this date", "description": "Issues created before this date",
......
...@@ -9,8 +9,10 @@ describe Resolvers::IssuesResolver do ...@@ -9,8 +9,10 @@ describe Resolvers::IssuesResolver do
context "with a project" do context "with a project" do
let_it_be(:project) { create(:project) } let_it_be(:project) { create(:project) }
let_it_be(:issue1) { create(:issue, project: project, state: :opened, created_at: 3.hours.ago, updated_at: 3.hours.ago) } let_it_be(:milestone) { create(:milestone, project: project) }
let_it_be(:issue2) { create(:issue, project: project, state: :closed, title: 'foo', created_at: 1.hour.ago, updated_at: 1.hour.ago, closed_at: 1.hour.ago) } let_it_be(:assignee) { create(:user) }
let_it_be(:issue1) { create(:issue, project: project, state: :opened, created_at: 3.hours.ago, updated_at: 3.hours.ago, milestone: milestone) }
let_it_be(:issue2) { create(:issue, project: project, state: :closed, title: 'foo', created_at: 1.hour.ago, updated_at: 1.hour.ago, closed_at: 1.hour.ago, assignees: [assignee]) }
let_it_be(:label1) { create(:label, project: project) } let_it_be(:label1) { create(:label, project: project) }
let_it_be(:label2) { create(:label, project: project) } let_it_be(:label2) { create(:label, project: project) }
...@@ -31,6 +33,26 @@ describe Resolvers::IssuesResolver do ...@@ -31,6 +33,26 @@ describe Resolvers::IssuesResolver do
expect(resolve_issues(state: 'closed')).to contain_exactly(issue2) expect(resolve_issues(state: 'closed')).to contain_exactly(issue2)
end end
it 'filters by milestone' do
expect(resolve_issues(milestone_title: milestone.title)).to contain_exactly(issue1)
end
it 'filters by assignee_username' do
expect(resolve_issues(assignee_username: assignee.username)).to contain_exactly(issue2)
end
it 'filters by assignee_id' do
expect(resolve_issues(assignee_id: assignee.id)).to contain_exactly(issue2)
end
it 'filters by any assignee' do
expect(resolve_issues(assignee_id: IssuableFinder::FILTER_ANY)).to contain_exactly(issue2)
end
it 'filters by no assignee' do
expect(resolve_issues(assignee_id: IssuableFinder::FILTER_NONE)).to contain_exactly(issue1)
end
it 'filters by labels' do it 'filters by labels' do
expect(resolve_issues(label_name: [label1.title])).to contain_exactly(issue1, issue2) expect(resolve_issues(label_name: [label1.title])).to contain_exactly(issue1, issue2)
expect(resolve_issues(label_name: [label1.title, label2.title])).to contain_exactly(issue2) expect(resolve_issues(label_name: [label1.title, label2.title])).to contain_exactly(issue2)
......
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