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
b2e31786
Commit
b2e31786
authored
Jul 07, 2020
by
charlieablett
Committed by
Jan Provaznik
Aug 10, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expose epic groupings in boards
Added a new epic field to the board type.
parent
d57379f8
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
64 additions
and
1 deletion
+64
-1
ee/app/finders/epics_finder.rb
ee/app/finders/epics_finder.rb
+12
-0
ee/app/graphql/ee/types/board_type.rb
ee/app/graphql/ee/types/board_type.rb
+4
-0
ee/app/graphql/resolvers/board_groupings/epics_resolver.rb
ee/app/graphql/resolvers/board_groupings/epics_resolver.rb
+27
-0
ee/spec/finders/epics_finder_spec.rb
ee/spec/finders/epics_finder_spec.rb
+20
-0
ee/spec/graphql/ee/types/board_type_spec.rb
ee/spec/graphql/ee/types/board_type_spec.rb
+1
-1
No files found.
ee/app/finders/epics_finder.rb
View file @
b2e31786
...
@@ -30,6 +30,7 @@ class EpicsFinder < IssuableFinder
...
@@ -30,6 +30,7 @@ class EpicsFinder < IssuableFinder
def
self
.
scalar_params
def
self
.
scalar_params
@scalar_params
||=
%i[
@scalar_params
||=
%i[
board
parent_id
parent_id
author_id
author_id
author_username
author_username
...
@@ -108,6 +109,7 @@ class EpicsFinder < IssuableFinder
...
@@ -108,6 +109,7 @@ class EpicsFinder < IssuableFinder
end
end
def
filter_items
(
items
)
def
filter_items
(
items
)
items
=
in_board
(
items
)
items
=
by_created_at
(
items
)
items
=
by_created_at
(
items
)
items
=
by_updated_at
(
items
)
items
=
by_updated_at
(
items
)
items
=
by_author
(
items
)
items
=
by_author
(
items
)
...
@@ -154,6 +156,16 @@ class EpicsFinder < IssuableFinder
...
@@ -154,6 +156,16 @@ class EpicsFinder < IssuableFinder
items
.
iid_starts_with
(
query
)
items
.
iid_starts_with
(
query
)
end
end
def
in_board
(
items
)
board
=
params
[
:board
]
return
items
unless
board
.
present?
list_service
=
Boards
::
Issues
::
ListService
.
new
(
board
.
resource_parent
,
current_user
,
{
board_id:
board
.
id
})
issues
=
list_service
.
execute
.
except
(
:order
).
pluck_primary_key
epics_in_boards
=
EpicIssue
.
where
(
issue:
issues
)
items
.
id_in
(
epics_in_boards
.
select
(
"epic_id as id"
))
end
def
related_groups
def
related_groups
include_ancestors
=
params
.
fetch
(
:include_ancestor_groups
,
false
)
include_ancestors
=
params
.
fetch
(
:include_ancestor_groups
,
false
)
include_descendants
=
params
.
fetch
(
:include_descendant_groups
,
true
)
include_descendants
=
params
.
fetch
(
:include_descendant_groups
,
true
)
...
...
ee/app/graphql/ee/types/board_type.rb
View file @
b2e31786
...
@@ -20,6 +20,10 @@ module EE
...
@@ -20,6 +20,10 @@ module EE
field
:weight
,
type:
GraphQL
::
INT_TYPE
,
null:
true
,
field
:weight
,
type:
GraphQL
::
INT_TYPE
,
null:
true
,
description:
'Weight of the board.'
description:
'Weight of the board.'
field
:epic_groups
,
::
Types
::
EpicType
.
connection_type
,
null:
true
,
description:
'Epics associated with board issues.'
,
resolver:
::
Resolvers
::
BoardGroupings
::
EpicsResolver
end
end
end
end
end
end
...
...
ee/app/graphql/resolvers/board_groupings/epics_resolver.rb
0 → 100644
View file @
b2e31786
# frozen_string_literal: true
module
Resolvers
module
BoardGroupings
class
EpicsResolver
<
BaseResolver
type
Types
::
EpicType
,
null:
true
def
resolve
(
**
args
)
board
=
object
.
respond_to?
(
:sync
)
?
object
.
sync
:
object
return
[]
unless
resolver_object
.
present?
return
[]
unless
epic_feature_enabled?
EpicsFinder
.
new
(
context
[
:current_user
],
args
.
merge
(
board:
board
)).
execute
end
private
attr_reader
:resolver_object
def
epic_feature_enabled?
group
.
feature_available?
(
:epics
)
end
end
end
end
ee/spec/finders/epics_finder_spec.rb
View file @
b2e31786
...
@@ -459,6 +459,26 @@ RSpec.describe EpicsFinder do
...
@@ -459,6 +459,26 @@ RSpec.describe EpicsFinder do
end
end
end
end
context
'by issue board'
do
let_it_be
(
:epic1
)
{
create
(
:epic
,
group:
group
,
title:
"first epic"
)
}
let_it_be
(
:epic2
)
{
create
(
:epic
,
group:
group
,
title:
"second epic"
)
}
let_it_be
(
:label
)
{
create
(
:group_label
,
group:
group
,
name:
'some label'
)
}
let_it_be
(
:project
)
{
create
(
:project
,
namespace:
group
)
}
let_it_be
(
:board
)
{
create
(
:board
,
group:
group
)
}
let_it_be
(
:label_list
)
{
create
(
:list
,
board:
board
,
label:
label
)
}
let_it_be
(
:backlog_list
)
{
create
(
:backlog_list
,
board:
board
)
}
let_it_be
(
:issue
)
{
create
(
:labeled_issue
,
project:
project
,
labels:
[
label
])
}
let_it_be
(
:epic_issue
)
{
create
(
:epic_issue
,
epic:
epic1
,
issue:
issue
)
}
it
'returns epics that are in the board'
do
params
=
{
board_id:
board
.
id
}
expect
(
epics
(
params
)).
to
contain_exactly
(
epic1
)
end
end
context
'when using group cte for search'
do
context
'when using group cte for search'
do
context
'and two labels more search string are present'
do
context
'and two labels more search string are present'
do
let_it_be
(
:label1
)
{
create
(
:label
)
}
let_it_be
(
:label1
)
{
create
(
:label
)
}
...
...
ee/spec/graphql/ee/types/board_type_spec.rb
View file @
b2e31786
...
@@ -4,6 +4,6 @@ require 'spec_helper'
...
@@ -4,6 +4,6 @@ require 'spec_helper'
RSpec
.
describe
GitlabSchema
.
types
[
'Board'
]
do
RSpec
.
describe
GitlabSchema
.
types
[
'Board'
]
do
it
'includes the ee specific fields'
do
it
'includes the ee specific fields'
do
expect
(
described_class
).
to
have_graphql_field
(
'weight'
)
expect
(
described_class
).
to
have_graphql_field
s
(
:weight
,
:epic_groups
)
end
end
end
end
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