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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
2605a0a8
Commit
2605a0a8
authored
Jun 01, 2016
by
Josh Frye
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor. Add tests.
parent
4d9622e7
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
10 additions
and
17 deletions
+10
-17
CHANGELOG
CHANGELOG
+1
-0
app/models/ci/build.rb
app/models/ci/build.rb
+1
-1
app/models/project.rb
app/models/project.rb
+2
-6
app/views/layouts/nav/_project.html.haml
app/views/layouts/nav/_project.html.haml
+0
-9
app/views/projects/pipelines/_head.html.haml
app/views/projects/pipelines/_head.html.haml
+1
-1
features/project/builds/summary.feature
features/project/builds/summary.feature
+1
-0
features/steps/project/builds/summary.rb
features/steps/project/builds/summary.rb
+4
-0
No files found.
CHANGELOG
View file @
2605a0a8
...
...
@@ -28,6 +28,7 @@ v 8.9.0 (unreleased)
- Make authentication service for Container Registry to be compatible with < Docker 1.11
- Add Application Setting to configure Container Registry token expire delay (default 5min)
- Cache assigned issue and merge request counts in sidebar nav
- Cache project build count in sidebar nav
v 8.8.3
- Fix incorrect links on pipeline page when merge request created from fork
...
...
app/models/ci/build.rb
View file @
2605a0a8
...
...
@@ -313,7 +313,7 @@ module Ci
build_data
=
Gitlab
::
BuildDataBuilder
.
build
(
self
)
project
.
execute_hooks
(
build_data
.
dup
,
:build_hooks
)
project
.
execute_services
(
build_data
.
dup
,
:build_hooks
)
project
.
expire_running_or_pending_build_count
project
.
running_or_pending_build_count
(
force:
true
)
end
def
artifacts?
...
...
app/models/project.rb
View file @
2605a0a8
...
...
@@ -1012,13 +1012,9 @@ class Project < ActiveRecord::Base
update_attribute
(
:pending_delete
,
true
)
end
def
running_or_pending_build_count
Rails
.
cache
.
fetch
([
'projects'
,
id
,
'running_or_pending_build_count'
])
do
def
running_or_pending_build_count
(
force:
false
)
Rails
.
cache
.
fetch
([
'projects'
,
id
,
'running_or_pending_build_count'
]
,
force:
force
)
do
builds
.
running_or_pending
.
count
(
:all
)
end
end
def
expire_running_or_pending_build_count
Rails
.
cache
.
delete
([
'projects'
,
id
,
'running_or_pending_build_count'
])
end
end
app/views/layouts/nav/_project.html.haml
View file @
2605a0a8
...
...
@@ -52,15 +52,6 @@
=
icon
(
'ship fw'
)
%span
Pipelines
%span
.badge.count.ci_counter
=
number_with_delimiter
(
@project
.
ci_commits
.
running_or_pending
.
count
)
-
if
project_nav_tab?
:builds
=
nav_link
(
controller:
%w(builds)
)
do
=
link_to
project_builds_path
(
@project
),
title:
'Builds'
,
class:
'shortcuts-builds'
do
=
icon
(
'cubes fw'
)
%span
Builds
%span
.badge.count.builds_counter
=
number_with_delimiter
(
@project
.
running_or_pending_build_count
)
-
if
project_nav_tab?
:container_registry
=
nav_link
(
controller:
%w(container_registry)
)
do
...
...
app/views/projects/pipelines/_head.html.haml
View file @
2605a0a8
...
...
@@ -11,4 +11,4 @@
=
link_to
project_builds_path
(
@project
),
title:
'Builds'
,
class:
'shortcuts-builds'
do
%span
Builds
%span
.badge.count.builds_counter
=
number_with_delimiter
(
@project
.
builds
.
running_or_pending
.
count
(
:all
)
)
%span
.badge.count.builds_counter
=
number_with_delimiter
(
@project
.
running_or_pending_build_count
)
features/project/builds/summary.feature
View file @
2605a0a8
...
...
@@ -24,3 +24,4 @@ Feature: Project Builds Summary
Then
recent build has been erased
And
recent build summary does not have artifacts widget
And
recent build summary contains information saying that build has been erased
And
the build count cache is updated
features/steps/project/builds/summary.rb
View file @
2605a0a8
...
...
@@ -36,4 +36,8 @@ class Spinach::Features::ProjectBuildsSummary < Spinach::FeatureSteps
expect
(
page
).
to
have_content
'Build has been erased'
end
end
step
'the build count cache is updated'
do
expect
(
@build
.
project
.
running_or_pending_build_count
).
to
eq
@build
.
project
.
builds
.
running_or_pending
.
count
(
:all
)
end
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