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
02da71f3
Commit
02da71f3
authored
Jun 17, 2021
by
Vitali Tatarintev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change the number of pipelines per page to 15
Changelog: changed
parent
c5c32ad2
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
52 additions
and
4 deletions
+52
-4
app/controllers/projects/commit_controller.rb
app/controllers/projects/commit_controller.rb
+2
-1
app/controllers/projects/merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+1
-1
app/controllers/projects/pipelines_controller.rb
app/controllers/projects/pipelines_controller.rb
+0
-1
app/models/ci/pipeline.rb
app/models/ci/pipeline.rb
+2
-0
spec/controllers/projects/commit_controller_spec.rb
spec/controllers/projects/commit_controller_spec.rb
+21
-1
spec/controllers/projects/merge_requests_controller_spec.rb
spec/controllers/projects/merge_requests_controller_spec.rb
+14
-0
spec/controllers/projects/pipelines_controller_spec.rb
spec/controllers/projects/pipelines_controller_spec.rb
+8
-0
spec/models/ci/pipeline_spec.rb
spec/models/ci/pipeline_spec.rb
+4
-0
No files found.
app/controllers/projects/commit_controller.rb
View file @
02da71f3
...
...
@@ -52,7 +52,8 @@ class Projects::CommitController < Projects::ApplicationController
# rubocop: disable CodeReuse/ActiveRecord
def
pipelines
@pipelines
=
@commit
.
pipelines
.
order
(
id: :desc
)
@pipelines
=
@pipelines
.
where
(
ref:
params
[
:ref
]).
page
(
params
[
:page
]).
per
(
30
)
if
params
[
:ref
]
@pipelines
=
@pipelines
.
where
(
ref:
params
[
:ref
])
if
params
[
:ref
]
@pipelines
=
@pipelines
.
page
(
params
[
:page
])
respond_to
do
|
format
|
format
.
html
...
...
app/controllers/projects/merge_requests_controller.rb
View file @
02da71f3
...
...
@@ -167,7 +167,7 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo
def
pipelines
set_pipeline_variables
@pipelines
=
@pipelines
.
page
(
params
[
:page
])
.
per
(
30
)
@pipelines
=
@pipelines
.
page
(
params
[
:page
])
Gitlab
::
PollingInterval
.
set_header
(
response
,
interval:
10_000
)
...
...
app/controllers/projects/pipelines_controller.rb
View file @
02da71f3
...
...
@@ -42,7 +42,6 @@ class Projects::PipelinesController < Projects::ApplicationController
.
new
(
project
,
current_user
,
index_params
)
.
execute
.
page
(
params
[
:page
])
.
per
(
20
)
@pipelines_count
=
limited_pipelines_count
(
project
)
...
...
app/models/ci/pipeline.rb
View file @
02da71f3
...
...
@@ -29,6 +29,8 @@ module Ci
BridgeStatusError
=
Class
.
new
(
StandardError
)
paginates_per
15
sha_attribute
:source_sha
sha_attribute
:target_sha
...
...
spec/controllers/projects/commit_controller_spec.rb
View file @
02da71f3
...
...
@@ -483,7 +483,7 @@ RSpec.describe Projects::CommitController do
end
context
'when rendering a JSON format'
do
it
'responds with serialized pipelines'
do
it
'responds with serialized pipelines'
,
:aggregate_failures
do
get_pipelines
(
id:
commit
.
id
,
format: :json
)
expect
(
response
).
to
be_ok
...
...
@@ -491,6 +491,26 @@ RSpec.describe Projects::CommitController do
expect
(
json_response
[
'count'
][
'all'
]).
to
eq
1
expect
(
response
).
to
include_pagination_headers
end
context
'with pagination'
do
let!
(
:extra_pipeline
)
{
create
(
:ci_pipeline
,
project:
project
,
ref:
project
.
default_branch
,
sha:
commit
.
sha
,
status: :running
)
}
it
'paginates the result when ref is blank'
do
allow
(
Ci
::
Pipeline
).
to
receive
(
:default_per_page
).
and_return
(
1
)
get_pipelines
(
id:
commit
.
id
,
format: :json
)
expect
(
json_response
[
'pipelines'
].
count
).
to
eq
(
1
)
end
it
'paginates the result when ref is present'
do
allow
(
Ci
::
Pipeline
).
to
receive
(
:default_per_page
).
and_return
(
1
)
get_pipelines
(
id:
commit
.
id
,
ref:
project
.
default_branch
,
format: :json
)
expect
(
json_response
[
'pipelines'
].
count
).
to
eq
(
1
)
end
end
end
end
end
...
...
spec/controllers/projects/merge_requests_controller_spec.rb
View file @
02da71f3
...
...
@@ -860,6 +860,20 @@ RSpec.describe Projects::MergeRequestsController do
end
end
end
context
'with pagination'
do
before
do
create
(
:ci_pipeline
,
project:
merge_request
.
source_project
,
ref:
merge_request
.
source_branch
,
sha:
merge_request
.
diff_head_sha
)
end
it
'paginates the result'
do
allow
(
Ci
::
Pipeline
).
to
receive
(
:default_per_page
).
and_return
(
1
)
get
:pipelines
,
params:
{
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
,
id:
merge_request
.
iid
},
format: :json
expect
(
json_response
[
'pipelines'
].
count
).
to
eq
(
1
)
end
end
end
describe
'GET context commits'
do
...
...
spec/controllers/projects/pipelines_controller_spec.rb
View file @
02da71f3
...
...
@@ -66,6 +66,14 @@ RSpec.describe Projects::PipelinesController do
expect
(
json_response
[
'pipelines'
][
0
]).
not_to
include
(
'coverage'
)
end
it
'paginates the result'
do
allow
(
Ci
::
Pipeline
).
to
receive
(
:default_per_page
).
and_return
(
2
)
get_pipelines_index_json
check_pipeline_response
(
returned:
2
,
all:
6
)
end
context
'when performing gitaly calls'
,
:request_store
do
it
'limits the Gitaly requests'
do
# Isolate from test preparation (Repository#exists? is also cached in RequestStore)
...
...
spec/models/ci/pipeline_spec.rb
View file @
02da71f3
...
...
@@ -11,6 +11,10 @@ RSpec.describe Ci::Pipeline, :mailer, factory_default: :keep do
let_it_be
(
:namespace
)
{
create_default
(
:namespace
).
freeze
}
let_it_be
(
:project
)
{
create_default
(
:project
,
:repository
).
freeze
}
it
'paginates 15 pipeleines per page'
do
expect
(
described_class
.
default_per_page
).
to
eq
(
15
)
end
it_behaves_like
'having unique enum values'
it
{
is_expected
.
to
belong_to
(
:project
)
}
...
...
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