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
a33fbb3c
Commit
a33fbb3c
authored
Mar 14, 2017
by
Bob Van Landuyt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Render cached pipeline status on project dashboard
parent
4b249d52
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
3 deletions
+32
-3
app/helpers/ci_status_helper.rb
app/helpers/ci_status_helper.rb
+14
-0
app/models/project.rb
app/models/project.rb
+4
-0
app/views/shared/projects/_project.html.haml
app/views/shared/projects/_project.html.haml
+3
-3
spec/models/project_spec.rb
spec/models/project_spec.rb
+11
-0
No files found.
app/helpers/ci_status_helper.rb
View file @
a33fbb3c
...
@@ -59,6 +59,20 @@ module CiStatusHelper
...
@@ -59,6 +59,20 @@ module CiStatusHelper
custom_icon
(
icon_name
)
custom_icon
(
icon_name
)
end
end
def
render_project_pipeline_status
(
pipeline_status
,
tooltip_placement:
'auto left'
)
project
=
pipeline_status
.
project
path
=
pipelines_namespace_project_commit_path
(
project
.
namespace
,
project
,
pipeline_status
.
sha
)
render_status_with_link
(
'commit'
,
pipeline_status
.
status
,
path
,
tooltip_placement:
tooltip_placement
)
end
def
render_commit_status
(
commit
,
ref:
nil
,
tooltip_placement:
'auto left'
)
def
render_commit_status
(
commit
,
ref:
nil
,
tooltip_placement:
'auto left'
)
project
=
commit
.
project
project
=
commit
.
project
path
=
pipelines_namespace_project_commit_path
(
path
=
pipelines_namespace_project_commit_path
(
...
...
app/models/project.rb
View file @
a33fbb3c
...
@@ -1209,6 +1209,10 @@ class Project < ActiveRecord::Base
...
@@ -1209,6 +1209,10 @@ class Project < ActiveRecord::Base
end
end
end
end
def
pipeline_status
@pipeline_status
||=
Ci
::
PipelineStatus
.
load_for_project
(
self
)
end
def
mark_import_as_failed
(
error_message
)
def
mark_import_as_failed
(
error_message
)
original_errors
=
errors
.
dup
original_errors
=
errors
.
dup
sanitized_message
=
Gitlab
::
UrlSanitizer
.
sanitize
(
error_message
)
sanitized_message
=
Gitlab
::
UrlSanitizer
.
sanitize
(
error_message
)
...
...
app/views/shared/projects/_project.html.haml
View file @
a33fbb3c
...
@@ -7,16 +7,16 @@
...
@@ -7,16 +7,16 @@
-
show_last_commit_as_description
=
false
unless
local_assigns
[
:show_last_commit_as_description
]
==
true
&&
project
.
commit
-
show_last_commit_as_description
=
false
unless
local_assigns
[
:show_last_commit_as_description
]
==
true
&&
project
.
commit
-
css_class
+=
" no-description"
if
project
.
description
.
blank?
&&
!
show_last_commit_as_description
-
css_class
+=
" no-description"
if
project
.
description
.
blank?
&&
!
show_last_commit_as_description
-
cache_key
=
[
project
.
namespace
,
project
,
controller
.
controller_name
,
controller
.
action_name
,
current_application_settings
,
'v2.3'
]
-
cache_key
=
[
project
.
namespace
,
project
,
controller
.
controller_name
,
controller
.
action_name
,
current_application_settings
,
'v2.3'
]
-
cache_key
.
push
(
project
.
commit
&
.
sha
,
project
.
commit
&
.
status
)
-
cache_key
.
push
(
project
.
pipeline_status
)
if
project
.
pipeline_status
.
has_status?
%li
.project-row
{
class:
css_class
}
%li
.project-row
{
class:
css_class
}
=
cache
(
cache_key
)
do
=
cache
(
cache_key
)
do
.controls
.controls
-
if
project
.
archived
-
if
project
.
archived
%span
.label.label-warning
archived
%span
.label.label-warning
archived
-
if
project
.
commit
.
try
(
:status
)
-
if
project
.
pipeline_status
.
has_status?
%span
%span
=
render_
commit_status
(
project
.
commit
)
=
render_
project_pipeline_status
(
project
.
pipeline_status
)
-
if
forks
-
if
forks
%span
%span
=
icon
(
'code-fork'
)
=
icon
(
'code-fork'
)
...
...
spec/models/project_spec.rb
View file @
a33fbb3c
...
@@ -1916,4 +1916,15 @@ describe Project, models: true do
...
@@ -1916,4 +1916,15 @@ describe Project, models: true do
end
end
end
end
end
end
describe
'#pipeline_status'
do
let
(
:project
)
{
create
(
:project
)
}
it
'builds a pipeline status'
do
expect
(
project
.
pipeline_status
).
to
be_a
(
Ci
::
PipelineStatus
)
end
it
'hase a loaded pipeline status'
do
expect
(
project
.
pipeline_status
).
to
be_loaded
end
end
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