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
1de120a2
Commit
1de120a2
authored
Feb 07, 2018
by
Kushal Pandya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Jan Provaznik: Add support for Epics on group roadmap
parent
739951e3
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
49 additions
and
9 deletions
+49
-9
config/routes/group.rb
config/routes/group.rb
+2
-0
ee/app/controllers/groups/epics_controller.rb
ee/app/controllers/groups/epics_controller.rb
+4
-0
ee/app/controllers/groups/roadmap_controller.rb
ee/app/controllers/groups/roadmap_controller.rb
+10
-0
ee/app/finders/epics_finder.rb
ee/app/finders/epics_finder.rb
+7
-2
ee/app/serializers/epic_entity.rb
ee/app/serializers/epic_entity.rb
+6
-0
spec/ee/spec/finders/epics_finder_spec.rb
spec/ee/spec/finders/epics_finder_spec.rb
+17
-6
spec/ee/spec/serializers/epic_entity_spec.rb
spec/ee/spec/serializers/epic_entity_spec.rb
+1
-1
spec/fixtures/api/schemas/entities/epic.json
spec/fixtures/api/schemas/entities/epic.json
+2
-0
No files found.
config/routes/group.rb
View file @
1de120a2
...
...
@@ -96,7 +96,9 @@ constraints(GroupUrlConstrainer.new) do
path
end
get
'boards(/*extra_params)'
,
as: :legacy_ee_group_boards_redirect
,
to:
legacy_ee_group_boards_redirect
## EE-specific
resource
:roadmap
,
only:
[
:show
],
controller:
'roadmap'
end
scope
(
path:
'*id'
,
...
...
ee/app/controllers/groups/epics_controller.rb
View file @
1de120a2
...
...
@@ -96,4 +96,8 @@ class Groups::EpicsController < Groups::ApplicationController
def
authorize_create_epic!
return
render_404
unless
can?
(
current_user
,
:create_epic
,
group
)
end
def
filter_params
super
.
merge
(
start_date:
params
[
:start_date
],
end_date:
params
[
:end_date
])
end
end
ee/app/controllers/groups/roadmap_controller.rb
0 → 100644
View file @
1de120a2
module
Groups
class
RoadmapController
<
Groups
::
ApplicationController
before_action
:group
def
show
# show roadmap for a group
@epics_count
=
EpicsFinder
.
new
(
current_user
,
group_id:
@group
.
id
).
execute
.
count
end
end
end
ee/app/finders/epics_finder.rb
View file @
1de120a2
...
...
@@ -53,9 +53,14 @@ class EpicsFinder < IssuableFinder
def
by_timeframe
(
items
)
return
items
unless
params
[
:start_date
]
&&
params
[
:end_date
]
end_date
=
params
[
:end_date
].
to_datetime
.
end_of_day
start_date
=
params
[
:start_date
].
to_datetime
.
beginning_of_day
items
.
where
(
'epics.start_date is not NULL or epics.end_date is not NULL'
)
.
where
(
'epics.start_date is NULL or epics.start_date <= ?'
,
params
[
:end_date
].
end_of_day
)
.
where
(
'epics.end_date is NULL or epics.end_date >= ?'
,
params
[
:start_date
].
beginning_of_day
)
.
where
(
'epics.start_date is NULL or epics.start_date <= ?'
,
end_date
)
.
where
(
'epics.end_date is NULL or epics.end_date >= ?'
,
start_date
)
rescue
ArgumentError
items
end
end
ee/app/serializers/epic_entity.rb
View file @
1de120a2
class
EpicEntity
<
IssuableEntity
expose
:group_id
expose
:group_name
do
|
epic
|
epic
.
group
.
name
end
expose
:group_full_name
do
|
epic
|
epic
.
group
.
full_name
end
expose
:start_date
expose
:end_date
expose
:web_url
do
|
epic
|
...
...
spec/ee/spec/finders/epics_finder_spec.rb
View file @
1de120a2
...
...
@@ -92,19 +92,30 @@ describe EpicsFinder do
context
'by timeframe'
do
it
'returns epics which start in the timeframe'
do
expect
(
epics
(
start_date:
2
.
days
.
ago
,
end_date:
1
.
day
.
ago
)).
to
contain_exactly
(
epic2
)
params
=
{
start_date:
2
.
days
.
ago
.
strftime
(
'%Y-%m-%d'
),
end_date:
1
.
day
.
ago
.
strftime
(
'%Y-%m-%d'
)
}
expect
(
epics
(
params
)).
to
contain_exactly
(
epic2
)
end
it
'returns epics which end in the timeframe'
do
expect
(
epics
(
start_date:
4
.
days
.
ago
,
end_date:
3
.
days
.
ago
)).
to
contain_exactly
(
epic3
)
params
=
{
start_date:
4
.
days
.
ago
.
strftime
(
'%Y-%m-%d'
),
end_date:
3
.
days
.
ago
.
strftime
(
'%Y-%m-%d'
)
}
expect
(
epics
(
params
)).
to
contain_exactly
(
epic3
)
end
it
'returns epics which start before and end after the timeframe'
do
expect
(
epics
(
start_date:
4
.
days
.
ago
,
end_date:
4
.
days
.
ago
)).
to
contain_exactly
(
epic3
)
end
params
=
{
start_date:
4
.
days
.
ago
.
strftime
(
'%Y-%m-%d'
),
end_date:
4
.
days
.
ago
.
strftime
(
'%Y-%m-%d'
)
}
it
'ignores epics which do not have start and end date set'
do
expect
(
epics
(
start_date:
2
.
days
.
ago
,
end_date:
1
.
day
.
ago
)).
not_to
include
(
epic1
)
expect
(
epics
(
params
)).
to
contain_exactly
(
epic3
)
end
end
end
...
...
spec/ee/spec/serializers/epic_entity_spec.rb
View file @
1de120a2
...
...
@@ -14,6 +14,6 @@ describe EpicEntity do
end
it
'has epic specific attributes'
do
expect
(
subject
).
to
include
(
:start_date
,
:end_date
,
:group_id
,
:web_url
)
expect
(
subject
).
to
include
(
:start_date
,
:end_date
,
:group_id
,
:
group_name
,
:group_full_name
,
:
web_url
)
end
end
spec/fixtures/api/schemas/entities/epic.json
View file @
1de120a2
...
...
@@ -20,6 +20,8 @@
"web_url"
:
{
"type"
:
"string"
},
"milestone"
:
{
"type"
:
[
"object"
,
"null"
]
},
"labels"
:
{
"type"
:
[
"array"
,
"null"
]
},
"group_name"
:
{
"type"
:
"string"
},
"group_full_name"
:
{
"type"
:
"string"
},
"group"
:
{
"id"
:
{
"type"
:
"integer"
},
"path"
:
{
"type"
:
"string"
}
...
...
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