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
c767f35c
Commit
c767f35c
authored
Mar 21, 2016
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated based on feedback
parent
3b6e2a68
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
46 deletions
+60
-46
app/assets/javascripts/merge_request_widget.js.coffee
app/assets/javascripts/merge_request_widget.js.coffee
+26
-26
app/views/projects/merge_requests/widget/_heading.html.haml
app/views/projects/merge_requests/widget/_heading.html.haml
+34
-20
No files found.
app/assets/javascripts/merge_request_widget.js.coffee
View file @
c767f35c
...
@@ -8,10 +8,11 @@ class @MergeRequestWidget
...
@@ -8,10 +8,11 @@ class @MergeRequestWidget
constructor
:
(
@
opts
)
->
constructor
:
(
@
opts
)
->
@
firstCICheck
=
true
@
firstCICheck
=
true
@
getCIStatus
()
notifyPermissions
()
@
readyForCICheck
=
true
@
readyForCICheck
=
true
# clear the build poller
clearInterval
@
fetchBuildStatusInterval
@
pollCIStatus
()
notifyPermissions
()
mergeInProgress
:
(
deleteSourceBranch
=
false
)
->
mergeInProgress
:
(
deleteSourceBranch
=
false
)
->
$
.
ajax
$
.
ajax
...
@@ -39,23 +40,32 @@ class @MergeRequestWidget
...
@@ -39,23 +40,32 @@ class @MergeRequestWidget
else
else
status
status
getCIStatus
:
->
pollCIStatus
:
->
_this
=
@
@
fetchBuildStatusInterval
=
setInterval
(
=>
@
fetchBuildStatusInterval
=
setInterval
(
=>
return
if
not
@
readyForCICheck
return
if
not
@
readyForCICheck
$
.
getJSON
@
opts
.
ci_status_url
,
(
data
)
=>
@
getCIStatus
(
true
)
@
readyForCICheck
=
true
@
readyForCICheck
=
false
),
5000
getCIStatus
:
(
showNotification
)
->
_this
=
@
$
(
'.ci-widget-fetching'
).
show
()
$
.
getJSON
@
opts
.
ci_status_url
,
(
data
)
=>
@
readyForCICheck
=
true
if
@
firstCICheck
if
@
firstCICheck
@
firstCICheck
=
false
@
firstCICheck
=
false
@
opts
.
ci_status
=
data
.
status
@
opts
.
ci_status
=
data
.
status
if
data
.
status
isnt
@
opts
.
ci_status
if
data
.
status
isnt
@
opts
.
ci_status
@
showCIState
data
.
status
@
showCIStatus
data
.
status
if
data
.
coverage
if
data
.
coverage
@
showCICoverage
data
.
coverage
@
showCICoverage
data
.
coverage
if
showNotification
message
=
@
opts
.
ci_message
.
replace
(
'{{status}}'
,
@
ciLabelForStatus
(
data
.
status
))
message
=
@
opts
.
ci_message
.
replace
(
'{{status}}'
,
@
ciLabelForStatus
(
data
.
status
))
message
=
message
.
replace
(
'{{sha}}'
,
data
.
sha
)
message
=
message
.
replace
(
'{{sha}}'
,
data
.
sha
)
message
=
message
.
replace
(
'{{title}}'
,
data
.
title
)
message
=
message
.
replace
(
'{{title}}'
,
data
.
title
)
...
@@ -69,19 +79,9 @@ class @MergeRequestWidget
...
@@ -69,19 +79,9 @@ class @MergeRequestWidget
Turbolinks
.
visit
_this
.
opts
.
builds_path
Turbolinks
.
visit
_this
.
opts
.
builds_path
)
)
@
opts
.
ci_status
=
data
.
status
@
opts
.
ci_status
=
data
.
status
@
readyForCICheck
=
false
),
5000
getCIState
:
->
$
(
'.ci-widget-fetching'
).
show
()
$
.
getJSON
@
opts
.
ci_status_url
,
(
data
)
=>
@
showCIState
data
.
status
if
data
.
coverage
@
showCICoverage
data
.
coverage
showCIStat
e
:
(
state
)
->
showCIStat
us
:
(
state
)
->
$
(
'.ci_widget'
).
hide
()
$
(
'.ci_widget'
).
hide
()
allowed_states
=
[
"failed"
,
"canceled"
,
"running"
,
"pending"
,
"success"
,
"skipped"
,
"not_found"
]
allowed_states
=
[
"failed"
,
"canceled"
,
"running"
,
"pending"
,
"success"
,
"skipped"
,
"not_found"
]
if
state
in
allowed_states
if
state
in
allowed_states
...
...
app/views/projects/merge_requests/widget/_heading.html.haml
View file @
c767f35c
-
if
@ci_commit
or
@merge_request
.
has_ci?
-
if
@ci_commit
.mr-widget-heading
.mr-widget-heading
-
if
@merge_request
.
has_ci?
-
%w[success skipped canceled failed running pending]
.
each
do
|
status
|
.ci_widget
.ci-widget-fetching
.ci_widget
{
class:
"ci-#{status}"
,
style:
(
"display:none"
unless
@ci_commit
.
status
==
status
)
}
=
icon
(
'spinner spin'
)
=
ci_icon_for_status
(
status
)
%span
%span
Checking CI status for
#{
@merge_request
.
last_commit_short_sha
}
…
CI build
=
ci_label_for_status
(
status
)
for
-
commit
=
@merge_request
.
last_commit
=
succeed
"."
do
=
link_to
@ci_commit
.
short_sha
,
namespace_project_commit_path
(
@merge_request
.
source_project
.
namespace
,
@merge_request
.
source_project
,
@ci_commit
.
sha
),
class:
"monospace"
%span
.ci-coverage
=
link_to
"View details"
,
builds_namespace_project_merge_request_path
(
@project
.
namespace
,
@project
,
@merge_request
),
class:
"js-show-tab"
,
data:
{
action:
'builds'
}
-
elsif
@merge_request
.
has_ci?
-
# Compatibility with old CI integrations (ex jenkins) when you request status from CI server via AJAX
-
# Remove in later versions when services like Jenkins will set CI status via Commit status API
.mr-widget-heading
-
%w[success skipped canceled failed running pending]
.
each
do
|
status
|
-
%w[success skipped canceled failed running pending]
.
each
do
|
status
|
.ci_widget
{
class:
"ci-#{status}"
,
style:
(
"display:none"
unless
status
==
@ci_commit
.
status
)
}
.ci_widget
{
class:
"ci-#{status}"
,
style:
"display:none"
}
=
ci_icon_for_status
(
status
)
=
ci_icon_for_status
(
status
)
%span
%span
CI build
CI build
...
@@ -16,20 +28,22 @@
...
@@ -16,20 +28,22 @@
=
succeed
"."
do
=
succeed
"."
do
=
link_to
commit
.
short_id
,
namespace_project_commit_path
(
@merge_request
.
source_project
.
namespace
,
@merge_request
.
source_project
,
commit
),
class:
"monospace"
=
link_to
commit
.
short_id
,
namespace_project_commit_path
(
@merge_request
.
source_project
.
namespace
,
@merge_request
.
source_project
,
commit
),
class:
"monospace"
%span
.ci-coverage
%span
.ci-coverage
-
if
details_path
=
builds_namespace_project_merge_request_path
(
@project
.
namespace
,
@project
,
@merge_request
)
-
if
details_path
=
ci_build_details_path
(
@merge_request
)
=
link_to
"View details"
,
details_path
,
:"data-no-turbolink"
=>
"data-no-turbolink"
=
link_to
"View details"
,
details_path
,
:"data-no-turbolink"
=>
"data-no-turbolink"
-
if
@merge_request
.
has_ci?
-
# Compatibility with old CI integrations (ex jenkins) when you request status from CI server via AJAX
-
# Remove in later versions when services like Jenkins will set CI status via Commit status API
.ci_widget.ci-not_found
{
style:
"display:none"
}
=
icon
(
"times-circle"
)
Could not find CI status for
#{
@merge_request
.
last_commit_short_sha
}
.
.ci_widget.ci-error
{
style:
"display:none"
}
.ci_widget
=
icon
(
"times-circle"
)
=
icon
(
"spinner spin"
)
Could not connect to the CI server. Please check your settings and try again.
Checking CI status for
#{
@merge_request
.
last_commit_short_sha
}
…
.ci_widget.ci-not_found
{
style:
"display:none"
}
=
icon
(
"times-circle"
)
Could not find CI status for
#{
@merge_request
.
last_commit_short_sha
}
.
.ci_widget.ci-error
{
style:
"display:none"
}
=
icon
(
"times-circle"
)
Could not connect to the CI server. Please check your settings and try again.
:javascript
:javascript
$
(
function
()
{
$
(
function
()
{
merge_request_widget
.
getCIState
(
);
merge_request_widget
.
getCIStatus
(
false
);
});
});
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