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
3f059257
Commit
3f059257
authored
Sep 23, 2016
by
Yorick Peterse
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'fix/speed-up-group-milestone-show' into 'master'
Speed up group milestones show page See merge request !6457
parents
d114a522
3753b847
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
10 deletions
+26
-10
CHANGELOG
CHANGELOG
+3
-1
app/models/global_milestone.rb
app/models/global_milestone.rb
+7
-6
db/migrate/20160920160832_add_index_to_labels_title.rb
db/migrate/20160920160832_add_index_to_labels_title.rb
+11
-0
db/schema.rb
db/schema.rb
+2
-1
spec/models/global_milestone_spec.rb
spec/models/global_milestone_spec.rb
+3
-2
No files found.
CHANGELOG
View file @
3f059257
Please view this file on the master branch, on stable branches it's out of date.
v 8.13.0 (unreleased)
- Speed-up group milestones show page
v 8.12.0
(unreleased)
v 8.12.0
- Update the rouge gem to 2.0.6, which adds highlighting support for JSX, Prometheus, and others. !6251
- Only check :can_resolve permission if the note is resolvable
- Bump fog-aws to v0.11.0 to support ap-south-1 region
...
...
app/models/global_milestone.rb
View file @
3f059257
...
...
@@ -8,7 +8,8 @@ class GlobalMilestone
milestones
=
milestones
.
group_by
(
&
:title
)
milestones
.
map
do
|
title
,
milestones
|
new
(
title
,
milestones
)
milestones_relation
=
Milestone
.
where
(
id:
milestones
.
map
(
&
:id
))
new
(
title
,
milestones_relation
)
end
end
...
...
@@ -31,7 +32,7 @@ class GlobalMilestone
end
def
projects
@projects
||=
Project
.
for_milestones
(
milestones
.
map
(
&
:id
))
@projects
||=
Project
.
for_milestones
(
milestones
.
select
(
:id
))
end
def
state
...
...
@@ -53,19 +54,19 @@ class GlobalMilestone
end
def
issues
@issues
||=
Issue
.
of_milestones
(
milestones
.
map
(
&
:id
)).
includes
(
:project
)
@issues
||=
Issue
.
of_milestones
(
milestones
.
select
(
:id
)).
includes
(
:project
,
:assignee
,
:labels
)
end
def
merge_requests
@merge_requests
||=
MergeRequest
.
of_milestones
(
milestones
.
map
(
&
:id
)).
includes
(
:target_project
)
@merge_requests
||=
MergeRequest
.
of_milestones
(
milestones
.
select
(
:id
)).
includes
(
:target_project
,
:assignee
,
:labels
)
end
def
participants
@participants
||=
milestones
.
map
(
&
:participants
).
flatten
.
compact
.
uniq
@participants
||=
milestones
.
includes
(
:participants
).
map
(
&
:participants
).
flatten
.
compact
.
uniq
end
def
labels
@labels
||=
GlobalLabel
.
build_collection
(
milestones
.
map
(
&
:labels
).
flatten
)
@labels
||=
GlobalLabel
.
build_collection
(
milestones
.
includes
(
:labels
).
map
(
&
:labels
).
flatten
)
.
sort_by!
(
&
:title
)
end
...
...
db/migrate/20160920160832_add_index_to_labels_title.rb
0 → 100644
View file @
3f059257
class
AddIndexToLabelsTitle
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
disable_ddl_transaction!
def
change
add_concurrent_index
:labels
,
:title
end
end
db/schema.rb
View file @
3f059257
...
...
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
version:
201609
15042921
)
do
ActiveRecord
::
Schema
.
define
(
version:
201609
20160832
)
do
# These are extensions that must be enabled in order to support this database
enable_extension
"plpgsql"
...
...
@@ -521,6 +521,7 @@ ActiveRecord::Schema.define(version: 20160915042921) do
add_index
"labels"
,
[
"priority"
],
name:
"index_labels_on_priority"
,
using: :btree
add_index
"labels"
,
[
"project_id"
],
name:
"index_labels_on_project_id"
,
using: :btree
add_index
"labels"
,
[
"title"
],
name:
"index_labels_on_title"
,
using: :btree
create_table
"lfs_objects"
,
force: :cascade
do
|
t
|
t
.
string
"oid"
,
null:
false
...
...
spec/models/global_milestone_spec.rb
View file @
3f059257
...
...
@@ -50,8 +50,9 @@ describe GlobalMilestone, models: true do
milestone1_project2
,
milestone1_project3
,
]
milestones_relation
=
Milestone
.
where
(
id:
milestones
.
map
(
&
:id
))
@global_milestone
=
GlobalMilestone
.
new
(
milestone1_project1
.
title
,
milestones
)
@global_milestone
=
GlobalMilestone
.
new
(
milestone1_project1
.
title
,
milestones
_relation
)
end
it
'has exactly one group milestone'
do
...
...
@@ -67,7 +68,7 @@ describe GlobalMilestone, models: true do
let
(
:milestone
)
{
create
(
:milestone
,
title:
"git / test"
,
project:
project1
)
}
it
'strips out slashes and spaces'
do
global_milestone
=
GlobalMilestone
.
new
(
milestone
.
title
,
[
milestone
]
)
global_milestone
=
GlobalMilestone
.
new
(
milestone
.
title
,
Milestone
.
where
(
id:
milestone
.
id
)
)
expect
(
global_milestone
.
safe_title
).
to
eq
(
'git-test'
)
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