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
0
Merge Requests
0
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
Kazuhiko Shiozaki
gitlab-ce
Commits
3b5722bc
Commit
3b5722bc
authored
10 years ago
by
Marin Jankovski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve performance, ordering and pagination for group milestones.
parent
83fd03f2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
10 deletions
+13
-10
app/controllers/groups/milestones_controller.rb
app/controllers/groups/milestones_controller.rb
+12
-10
app/views/groups/milestones/index.html.haml
app/views/groups/milestones/index.html.haml
+1
-0
No files found.
app/controllers/groups/milestones_controller.rb
View file @
3b5722bc
...
@@ -4,22 +4,22 @@ class Groups::MilestonesController < ApplicationController
...
@@ -4,22 +4,22 @@ class Groups::MilestonesController < ApplicationController
before_filter
:authorize_group_milestone!
,
only: :update
before_filter
:authorize_group_milestone!
,
only: :update
def
index
def
index
project_milestones
=
Milestone
.
where
(
project_id:
group
.
projects
)
project_milestones
=
case
params
[
:status
]
when
'all'
;
status
when
'closed'
;
status
(
'closed'
)
else
status
(
'active'
)
end
@group_milestones
=
Milestones
::
GroupService
.
new
(
project_milestones
).
execute
@group_milestones
=
Milestones
::
GroupService
.
new
(
project_milestones
).
execute
@group_milestones
=
case
params
[
:status
]
@group_milestones
=
Kaminari
.
paginate_array
(
@group_milestones
).
page
(
params
[
:page
]).
per
(
30
)
when
'all'
;
@group_milestones
when
'closed'
;
status
(
'closed'
)
else
status
(
'active'
)
end
end
end
def
show
def
show
project_milestones
=
Milestone
.
where
(
project_id:
group
.
projects
)
project_milestones
=
Milestone
.
where
(
project_id:
group
.
projects
)
.
order
(
"due_date ASC"
)
@group_milestone
=
Milestones
::
GroupService
.
new
(
project_milestones
).
milestone
(
title
)
@group_milestone
=
Milestones
::
GroupService
.
new
(
project_milestones
).
milestone
(
title
)
end
end
def
update
def
update
project_milestones
=
Milestone
.
where
(
project_id:
group
.
projects
)
project_milestones
=
Milestone
.
where
(
project_id:
group
.
projects
)
.
order
(
"due_date ASC"
)
@group_milestones
=
Milestones
::
GroupService
.
new
(
project_milestones
).
milestone
(
title
)
@group_milestones
=
Milestones
::
GroupService
.
new
(
project_milestones
).
milestone
(
title
)
@group_milestones
.
milestones
.
each
do
|
milestone
|
@group_milestones
.
milestones
.
each
do
|
milestone
|
...
@@ -44,8 +44,10 @@ class Groups::MilestonesController < ApplicationController
...
@@ -44,8 +44,10 @@ class Groups::MilestonesController < ApplicationController
params
[
:title
]
params
[
:title
]
end
end
def
status
(
state
)
def
status
(
state
=
nil
)
@group_milestones
.
map
{
|
milestone
|
next
if
milestone
.
state
!=
state
;
milestone
}.
compact
conditions
=
{
project_id:
group
.
projects
}
conditions
.
reverse_merge!
(
state:
state
)
if
state
Milestone
.
where
(
conditions
).
order
(
"title ASC"
)
end
end
def
authorize_group_milestone!
def
authorize_group_milestone!
...
...
This diff is collapsed.
Click to expand it.
app/views/groups/milestones/index.html.haml
View file @
3b5722bc
...
@@ -47,3 +47,4 @@
...
@@ -47,3 +47,4 @@
-
milestone
.
projects
.
each
do
|
project
|
-
milestone
.
projects
.
each
do
|
project
|
%span
.label.label-default
%span
.label.label-default
=
project
.
name
=
project
.
name
=
paginate
@group_milestones
,
theme:
"gitlab"
This diff is collapsed.
Click to expand it.
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