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
Boxiang Sun
gitlab-ce
Commits
7c5af3ea
Commit
7c5af3ea
authored
Nov 18, 2016
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More aggressively preload on merge request and issue index pages
parent
aea8baed
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
13 additions
and
7 deletions
+13
-7
app/controllers/concerns/issuable_collections.rb
app/controllers/concerns/issuable_collections.rb
+2
-2
app/controllers/concerns/issues_action.rb
app/controllers/concerns/issues_action.rb
+0
-1
app/controllers/concerns/merge_requests_action.rb
app/controllers/concerns/merge_requests_action.rb
+0
-1
app/controllers/projects/merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+0
-1
app/helpers/issuables_helper.rb
app/helpers/issuables_helper.rb
+4
-2
app/views/projects/merge_requests/_merge_request.html.haml
app/views/projects/merge_requests/_merge_request.html.haml
+3
-0
changelogs/unreleased/optimize-mr-index.yml
changelogs/unreleased/optimize-mr-index.yml
+4
-0
No files found.
app/controllers/concerns/issuable_collections.rb
View file @
7c5af3ea
...
@@ -10,11 +10,11 @@ module IssuableCollections
...
@@ -10,11 +10,11 @@ module IssuableCollections
private
private
def
issues_collection
def
issues_collection
issues_finder
.
execute
issues_finder
.
execute
.
preload
(
:project
,
:author
,
:assignee
,
:labels
,
:milestone
,
project: :namespace
)
end
end
def
merge_requests_collection
def
merge_requests_collection
merge_requests_finder
.
execute
merge_requests_finder
.
execute
.
preload
(
:source_project
,
:target_project
,
:author
,
:assignee
,
:labels
,
:milestone
,
:merge_request_diff
,
target_project: :namespace
)
end
end
def
issues_finder
def
issues_finder
...
...
app/controllers/concerns/issues_action.rb
View file @
7c5af3ea
...
@@ -7,7 +7,6 @@ module IssuesAction
...
@@ -7,7 +7,6 @@ module IssuesAction
@issues
=
issues_collection
@issues
=
issues_collection
.
non_archived
.
non_archived
.
preload
(
:author
,
:project
)
.
page
(
params
[
:page
])
.
page
(
params
[
:page
])
respond_to
do
|
format
|
respond_to
do
|
format
|
...
...
app/controllers/concerns/merge_requests_action.rb
View file @
7c5af3ea
...
@@ -7,7 +7,6 @@ module MergeRequestsAction
...
@@ -7,7 +7,6 @@ module MergeRequestsAction
@merge_requests
=
merge_requests_collection
@merge_requests
=
merge_requests_collection
.
non_archived
.
non_archived
.
preload
(
:author
,
:target_project
)
.
page
(
params
[
:page
])
.
page
(
params
[
:page
])
end
end
end
end
app/controllers/projects/merge_requests_controller.rb
View file @
7c5af3ea
...
@@ -38,7 +38,6 @@ class Projects::MergeRequestsController < Projects::ApplicationController
...
@@ -38,7 +38,6 @@ class Projects::MergeRequestsController < Projects::ApplicationController
def
index
def
index
@merge_requests
=
merge_requests_collection
@merge_requests
=
merge_requests_collection
@merge_requests
=
@merge_requests
.
page
(
params
[
:page
])
@merge_requests
=
@merge_requests
.
page
(
params
[
:page
])
@merge_requests
=
@merge_requests
.
preload
(
:target_project
)
if
params
[
:label_name
].
present?
if
params
[
:label_name
].
present?
labels_params
=
{
project_id:
@project
.
id
,
title:
params
[
:label_name
]
}
labels_params
=
{
project_id:
@project
.
id
,
title:
params
[
:label_name
]
}
...
...
app/helpers/issuables_helper.rb
View file @
7c5af3ea
...
@@ -171,9 +171,11 @@ module IssuablesHelper
...
@@ -171,9 +171,11 @@ module IssuablesHelper
def
issuables_count_for_state
(
issuable_type
,
state
)
def
issuables_count_for_state
(
issuable_type
,
state
)
issuables_finder
=
public_send
(
"
#{
issuable_type
}
_finder"
)
issuables_finder
=
public_send
(
"
#{
issuable_type
}
_finder"
)
issuables_finder
.
params
[
:state
]
=
state
issuables_finder
.
execute
.
page
(
1
).
total_count
params
=
issuables_finder
.
params
.
merge
(
state:
state
)
finder
=
issuables_finder
.
class
.
new
(
issuables_finder
.
current_user
,
params
)
finder
.
execute
.
page
(
1
).
total_count
end
end
IRRELEVANT_PARAMS_FOR_CACHE_KEY
=
%i[utf8 sort page]
IRRELEVANT_PARAMS_FOR_CACHE_KEY
=
%i[utf8 sort page]
...
...
app/views/projects/merge_requests/_merge_request.html.haml
View file @
7c5af3ea
...
@@ -54,15 +54,18 @@
...
@@ -54,15 +54,18 @@
=
link_to
namespace_project_commits_path
(
merge_request
.
project
.
namespace
,
merge_request
.
project
,
merge_request
.
target_branch
)
do
=
link_to
namespace_project_commits_path
(
merge_request
.
project
.
namespace
,
merge_request
.
project
,
merge_request
.
target_branch
)
do
=
icon
(
'code-fork'
)
=
icon
(
'code-fork'
)
=
merge_request
.
target_branch
=
merge_request
.
target_branch
-
if
merge_request
.
milestone
-
if
merge_request
.
milestone
=
link_to
namespace_project_merge_requests_path
(
merge_request
.
project
.
namespace
,
merge_request
.
project
,
milestone_title:
merge_request
.
milestone
.
title
)
do
=
link_to
namespace_project_merge_requests_path
(
merge_request
.
project
.
namespace
,
merge_request
.
project
,
milestone_title:
merge_request
.
milestone
.
title
)
do
=
icon
(
'clock-o'
)
=
icon
(
'clock-o'
)
=
merge_request
.
milestone
.
title
=
merge_request
.
milestone
.
title
-
if
merge_request
.
labels
.
any?
-
if
merge_request
.
labels
.
any?
-
merge_request
.
labels
.
each
do
|
label
|
-
merge_request
.
labels
.
each
do
|
label
|
=
link_to_label
(
label
,
subject:
merge_request
.
project
,
type: :merge_request
)
=
link_to_label
(
label
,
subject:
merge_request
.
project
,
type: :merge_request
)
-
if
merge_request
.
tasks?
-
if
merge_request
.
tasks?
%span
.task-status
%span
.task-status
...
...
changelogs/unreleased/optimize-mr-index.yml
0 → 100644
View file @
7c5af3ea
---
title
:
More aggressively preload on merge request and issue index pages
merge_request
:
author
:
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