BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
ee2c13d7
Commit
ee2c13d7
authored
Sep 26, 2017
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add 1000+ counters (instead of inifnite) to jobs controller
parent
3fb24bc6
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
5 deletions
+21
-5
numbers_helper.rb
app/helpers/numbers_helper.rb
+11
-0
index.html.haml
app/views/projects/jobs/index.html.haml
+1
-1
_tabs.html.haml
app/views/shared/builds/_tabs.html.haml
+4
-4
add-1000-plus-counters-for-jobs-page.yml
...elogs/unreleased/add-1000-plus-counters-for-jobs-page.yml
+5
-0
No files found.
app/helpers/numbers_helper.rb
0 → 100644
View file @
ee2c13d7
module
NumbersHelper
def
limited_counter_with_delimiter
(
resource
,
**
options
)
limit
=
options
.
fetch
(
:limit
,
1000
).
to_i
count
=
resource
.
limit
(
limit
+
1
).
count
(
:all
)
if
count
>
limit
number_with_delimiter
(
count
-
1
,
options
)
+
'+'
else
number_with_delimiter
(
count
,
options
)
end
end
end
app/views/projects/jobs/index.html.haml
View file @
ee2c13d7
...
...
@@ -9,7 +9,7 @@
.nav-controls
-
if
can?
(
current_user
,
:update_build
,
@project
)
-
if
@all_builds
.
running_or_pending
.
any?
-
if
@all_builds
.
running_or_pending
.
limit
(
1
).
any?
=
link_to
'Cancel running'
,
cancel_all_project_jobs_path
(
@project
),
data:
{
confirm:
'Are you sure?'
},
class:
'btn btn-danger'
,
method: :post
...
...
app/views/shared/builds/_tabs.html.haml
View file @
ee2c13d7
...
...
@@ -3,22 +3,22 @@
=
link_to
build_path_proc
.
call
(
nil
)
do
All
%span
.badge.js-totalbuilds-count
=
number_with_delimiter
(
all_builds
.
count
(
:id
)
)
=
limited_counter_with_delimiter
(
all_builds
)
%li
{
class:
active_when
(
scope
==
'pending'
)
}
>
=
link_to
build_path_proc
.
call
(
'pending'
)
do
Pending
%span
.badge
=
number_with_delimiter
(
all_builds
.
pending
.
count
(
:id
)
)
=
limited_counter_with_delimiter
(
all_builds
.
pending
)
%li
{
class:
active_when
(
scope
==
'running'
)
}
>
=
link_to
build_path_proc
.
call
(
'running'
)
do
Running
%span
.badge
=
number_with_delimiter
(
all_builds
.
running
.
count
(
:id
)
)
=
limited_counter_with_delimiter
(
all_builds
.
running
)
%li
{
class:
active_when
(
scope
==
'finished'
)
}
>
=
link_to
build_path_proc
.
call
(
'finished'
)
do
Finished
%span
.badge
=
number_with_delimiter
(
all_builds
.
finished
.
count
(
:id
)
)
=
limited_counter_with_delimiter
(
all_builds
.
finished
)
changelogs/unreleased/add-1000-plus-counters-for-jobs-page.yml
0 → 100644
View file @
ee2c13d7
---
title
:
Add 1000+ counters to job page
merge_request
:
author
:
type
:
fixed
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