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
0a3c6915
Commit
0a3c6915
authored
Jan 17, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
0d5467d9
e520a946
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
31 additions
and
27 deletions
+31
-27
app/assets/stylesheets/framework/dropdowns.scss
app/assets/stylesheets/framework/dropdowns.scss
+1
-1
app/controllers/projects/milestones_controller.rb
app/controllers/projects/milestones_controller.rb
+1
-1
app/finders/milestones_finder.rb
app/finders/milestones_finder.rb
+4
-8
app/models/milestone.rb
app/models/milestone.rb
+3
-4
app/services/issuable_base_service.rb
app/services/issuable_base_service.rb
+2
-2
app/services/milestones/promote_service.rb
app/services/milestones/promote_service.rb
+1
-3
app/services/projects/autocomplete_service.rb
app/services/projects/autocomplete_service.rb
+1
-1
app/views/projects/artifacts/_tree_file.html.haml
app/views/projects/artifacts/_tree_file.html.haml
+1
-1
changelogs/unreleased/47988-improve-milestone-queries-with-subqueries.yml
...eased/47988-improve-milestone-queries-with-subqueries.yml
+5
-0
changelogs/unreleased/56363-inconsitent-file-size-indication-across-different-ci-pages.yml
...sitent-file-size-indication-across-different-ci-pages.yml
+6
-0
lib/banzai/filter/milestone_reference_filter.rb
lib/banzai/filter/milestone_reference_filter.rb
+2
-2
spec/features/projects/artifacts/user_browses_artifacts_spec.rb
...eatures/projects/artifacts/user_browses_artifacts_spec.rb
+2
-2
spec/models/milestone_spec.rb
spec/models/milestone_spec.rb
+2
-2
No files found.
app/assets/stylesheets/framework/dropdowns.scss
View file @
0a3c6915
...
...
@@ -129,7 +129,7 @@
@extend
.dropdown-toggle
;
padding-right
:
25px
;
position
:
relative
;
width
:
16
3
px
;
width
:
16
0
px
;
text-overflow
:
ellipsis
;
overflow
:
hidden
;
...
...
app/controllers/projects/milestones_controller.rb
View file @
0a3c6915
...
...
@@ -144,7 +144,7 @@ class Projects::MilestonesController < Projects::ApplicationController
def
search_params
if
request
.
format
.
json?
&&
project_group
&&
can?
(
current_user
,
:read_group
,
project_group
)
groups
=
project_group
.
self_and_ancestors
_ids
groups
=
project_group
.
self_and_ancestors
.
select
(
:id
)
end
params
.
permit
(
:state
).
merge
(
project_ids:
@project
.
id
,
group_ids:
groups
)
...
...
app/finders/milestones_finder.rb
View file @
0a3c6915
...
...
@@ -3,8 +3,8 @@
# Search for milestones
#
# params - Hash
# project_ids: Array of project ids or single project id.
# group_ids: Array of group ids or single group id.
# project_ids: Array of project ids or single project id
or ActiveRecord relation
.
# group_ids: Array of group ids or single group id
or ActiveRecord relation
.
# order - Orders by field default due date asc.
# title - filter by title.
# state - filters by state.
...
...
@@ -12,17 +12,13 @@
class
MilestonesFinder
include
FinderMethods
attr_reader
:params
,
:project_ids
,
:group_ids
attr_reader
:params
def
initialize
(
params
=
{})
@project_ids
=
Array
(
params
[
:project_ids
])
@group_ids
=
Array
(
params
[
:group_ids
])
@params
=
params
end
def
execute
return
Milestone
.
none
if
project_ids
.
empty?
&&
group_ids
.
empty?
items
=
Milestone
.
all
items
=
by_groups_and_projects
(
items
)
items
=
by_title
(
items
)
...
...
@@ -34,7 +30,7 @@ class MilestonesFinder
private
def
by_groups_and_projects
(
items
)
items
.
for_projects_and_groups
(
p
roject_ids
,
group_ids
)
items
.
for_projects_and_groups
(
p
arams
[
:project_ids
],
params
[
:group_ids
]
)
end
# rubocop: disable CodeReuse/ActiveRecord
...
...
app/models/milestone.rb
View file @
0a3c6915
...
...
@@ -47,7 +47,7 @@ class Milestone < ActiveRecord::Base
groups
=
groups
.
compact
if
groups
.
is_a?
Array
groups
=
[]
if
groups
.
nil?
where
(
project
:
projects
).
or
(
where
(
group
:
groups
))
where
(
project
_id:
projects
).
or
(
where
(
group_id
:
groups
))
end
scope
:order_by_name_asc
,
->
{
order
(
Arel
::
Nodes
::
Ascending
.
new
(
arel_table
[
:title
].
lower
))
}
...
...
@@ -193,7 +193,7 @@ class Milestone < ActiveRecord::Base
return
STATE_COUNT_HASH
unless
projects
||
groups
counts
=
Milestone
.
for_projects_and_groups
(
projects
&
.
map
(
&
:id
),
groups
&
.
map
(
&
:id
)
)
.
for_projects_and_groups
(
projects
,
groups
)
.
reorder
(
nil
)
.
group
(
:state
)
.
count
...
...
@@ -277,8 +277,7 @@ class Milestone < ActiveRecord::Base
if
project
relation
=
Milestone
.
for_projects_and_groups
([
project_id
],
[
project
.
group
&
.
id
])
elsif
group
project_ids
=
group
.
projects
.
map
(
&
:id
)
relation
=
Milestone
.
for_projects_and_groups
(
project_ids
,
[
group
.
id
])
relation
=
Milestone
.
for_projects_and_groups
(
group
.
projects
.
select
(
:id
),
[
group
.
id
])
end
title_exists
=
relation
.
find_by_title
(
title
)
...
...
app/services/issuable_base_service.rb
View file @
0a3c6915
...
...
@@ -63,10 +63,10 @@ class IssuableBaseService < BaseService
return
unless
milestone_id
params
[
:milestone_id
]
=
''
if
milestone_id
==
IssuableFinder
::
NONE
group
_ids
=
project
.
group
&
.
self_and_ancestors
&
.
pluck
(
:id
)
group
s
=
project
.
group
&
.
self_and_ancestors
&
.
select
(
:id
)
milestone
=
Milestone
.
for_projects_and_groups
([
project
.
id
],
group
_id
s
).
find_by_id
(
milestone_id
)
Milestone
.
for_projects_and_groups
([
project
.
id
],
groups
).
find_by_id
(
milestone_id
)
params
[
:milestone_id
]
=
''
unless
milestone
end
...
...
app/services/milestones/promote_service.rb
View file @
0a3c6915
...
...
@@ -82,11 +82,9 @@ module Milestones
end
# rubocop: enable CodeReuse/ActiveRecord
# rubocop: disable CodeReuse/ActiveRecord
def
group_project_ids
@group_project_ids
||=
group
.
projects
.
pluck
(
:id
)
group
.
projects
.
select
(
:id
)
end
# rubocop: enable CodeReuse/ActiveRecord
def
raise_error
(
message
)
raise
PromoteMilestoneError
,
"Promotion failed -
#{
message
}
"
...
...
app/services/projects/autocomplete_service.rb
View file @
0a3c6915
...
...
@@ -16,7 +16,7 @@ module Projects
order:
{
due_date: :asc
,
title: :asc
}
}
finder_params
[
:group_ids
]
=
@project
.
group
.
self_and_ancestors
_ids
if
@project
.
group
finder_params
[
:group_ids
]
=
@project
.
group
.
self_and_ancestors
.
select
(
:id
)
if
@project
.
group
MilestonesFinder
.
new
(
finder_params
).
execute
.
select
([
:iid
,
:title
])
end
...
...
app/views/projects/artifacts/_tree_file.html.haml
View file @
0a3c6915
...
...
@@ -14,4 +14,4 @@
=
link_to
path_to_file
,
class:
'str-truncated'
do
%span
=
blob
.
name
%td
=
number_to_human_size
(
blob
.
size
,
precision:
2
)
=
number_to_human_size
(
blob
.
size
)
changelogs/unreleased/47988-improve-milestone-queries-with-subqueries.yml
0 → 100644
View file @
0a3c6915
---
title
:
Improve milestone queries using subqueries instead of separate queries for ids
merge_request
:
24325
author
:
type
:
performance
changelogs/unreleased/56363-inconsitent-file-size-indication-across-different-ci-pages.yml
0 → 100644
View file @
0a3c6915
---
title
:
Show CI artifact file size with 3 significant digits on 'browse job artifacts'
page
merge_request
:
24387
author
:
type
:
fixed
lib/banzai/filter/milestone_reference_filter.rb
View file @
0a3c6915
...
...
@@ -101,9 +101,9 @@ module Banzai
def
self_and_ancestors_ids
(
parent
)
if
group_context?
(
parent
)
parent
.
self_and_ancestors
_ids
parent
.
self_and_ancestors
.
select
(
:id
)
elsif
project_context?
(
parent
)
parent
.
group
&
.
self_and_ancestors
_ids
parent
.
group
&
.
self_and_ancestors
&
.
select
(
:id
)
end
end
...
...
spec/features/projects/artifacts/user_browses_artifacts_spec.rb
View file @
0a3c6915
...
...
@@ -25,8 +25,8 @@ describe "User browses artifacts" do
page
.
within
(
".tree-table"
)
do
expect
(
page
).
to
have_no_content
(
".."
)
.
and
have_content
(
"other_artifacts_0.1.2"
)
.
and
have_content
(
"ci_artifacts.txt"
)
.
and
have_content
(
"rails_sample.jpg"
)
.
and
have_content
(
"ci_artifacts.txt
27 Bytes
"
)
.
and
have_content
(
"rails_sample.jpg
34.4 KB
"
)
end
page
.
within
(
".build-header"
)
do
...
...
spec/models/milestone_spec.rb
View file @
0a3c6915
...
...
@@ -288,8 +288,8 @@ describe Milestone do
end
context
'relations as params'
do
let
(
:projects
)
{
Project
.
where
(
id:
project
.
id
)
}
let
(
:groups
)
{
Group
.
where
(
id:
group
.
id
)
}
let
(
:projects
)
{
Project
.
where
(
id:
project
.
id
)
.
select
(
:id
)
}
let
(
:groups
)
{
Group
.
where
(
id:
group
.
id
)
.
select
(
:id
)
}
it_behaves_like
'filters by projects and groups'
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