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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
c1c786fe
Commit
c1c786fe
authored
Mar 04, 2016
by
Jacob Schatz
Committed by
Phil Hughes
Mar 18, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Using status from ajax call.
Removing icon changes because refresh.
parent
1a482bfb
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
25 deletions
+13
-25
app/assets/javascripts/merge_request_widget.js.coffee
app/assets/javascripts/merge_request_widget.js.coffee
+11
-22
app/views/projects/merge_requests/widget/_show.html.haml
app/views/projects/merge_requests/widget/_show.html.haml
+2
-3
No files found.
app/assets/javascripts/merge_request_widget.js.coffee
View file @
c1c786fe
...
@@ -3,12 +3,14 @@ class @MergeRequestWidget
...
@@ -3,12 +3,14 @@ class @MergeRequestWidget
#
#
# check_enable - Boolean, whether to check automerge status
# check_enable - Boolean, whether to check automerge status
# url_to_automerge_check - String, URL to use to check automerge status
# url_to_automerge_check - String, URL to use to check automerge status
# current_status - String, current automerge status
# url_to_ci_check - String, URL to use to check CI status
# url_to_ci_check - String, URL to use to check CI status
#
#
constructor
:
(
@
opts
)
->
constructor
:
(
@
opts
)
->
@
first
=
true
modal
=
$
(
'#modal_merge_info'
).
modal
(
show
:
false
)
modal
=
$
(
'#modal_merge_info'
).
modal
(
show
:
false
)
@
getBuildStatus
()
@
getBuildStatus
()
@
readyForCICheck
=
true
# clear the build poller
# clear the build poller
mergeInProgress
:
(
deleteSourceBranch
=
false
)
->
mergeInProgress
:
(
deleteSourceBranch
=
false
)
->
...
@@ -31,19 +33,6 @@ class @MergeRequestWidget
...
@@ -31,19 +33,6 @@ class @MergeRequestWidget
$
.
get
@
opts
.
url_to_automerge_check
,
(
data
)
->
$
.
get
@
opts
.
url_to_automerge_check
,
(
data
)
->
$
(
'.mr-state-widget'
).
replaceWith
(
data
)
$
(
'.mr-state-widget'
).
replaceWith
(
data
)
ciIconForStatus
:
(
status
)
->
icon
=
undefined
switch
status
when
'success'
icon
=
'check'
when
'failed'
icon
=
'close'
when
'running'
or
'pending'
icon
=
'clock-o'
else
icon
=
'circle'
'fa fa-'
+
icon
+
' fa-fw'
ciLabelForStatus
:
(
status
)
->
ciLabelForStatus
:
(
status
)
->
if
status
==
'success'
if
status
==
'success'
'passed'
'passed'
...
@@ -54,7 +43,13 @@ class @MergeRequestWidget
...
@@ -54,7 +43,13 @@ class @MergeRequestWidget
urlToCiCheck
=
@
opts
.
url_to_ci_check
urlToCiCheck
=
@
opts
.
url_to_ci_check
_this
=
@
_this
=
@
@
fetchBuildStatusInterval
=
setInterval
(
->
@
fetchBuildStatusInterval
=
setInterval
(
->
if
not
_this
.
readyForCICheck
return
;
$
.
getJSON
urlToCiCheck
,
(
data
)
->
$
.
getJSON
urlToCiCheck
,
(
data
)
->
_this
.
readyForCICheck
=
true
if
_this
.
first
_this
.
first
=
false
_this
.
opts
.
current_status
=
data
.
status
if
data
.
status
isnt
_this
.
opts
.
current_status
if
data
.
status
isnt
_this
.
opts
.
current_status
notify
(
"Build
#{
_this
.
ciLabelForStatus
(
data
.
status
)
}
"
,
notify
(
"Build
#{
_this
.
ciLabelForStatus
(
data
.
status
)
}
"
,
_this
.
opts
.
ci_message
.
replace
(
'{{status}}'
,
_this
.
opts
.
ci_message
.
replace
(
'{{status}}'
,
...
@@ -65,16 +60,10 @@ class @MergeRequestWidget
...
@@ -65,16 +60,10 @@ class @MergeRequestWidget
return
return
),
2000
),
2000
_this
.
opts
.
current_status
=
data
.
status
_this
.
opts
.
current_status
=
data
.
status
$
(
'.mr-widget-heading i'
)
.
removeClass
()
.
addClass
(
_this
.
ciIconForStatus
(
data
.
status
));
$
(
'.mr-widget-heading .ci_widget'
)
.
removeClass
()
.
addClass
(
"ci_widget ci-
#{
data
.
status
}
"
);
$
(
'.mr-widget-heading span.ci-status-label'
)
.
text
(
_this
.
ciLabelForStatus
(
data
.
status
))
return
return
_this
.
readyForCICheck
=
false
return
return
),
5000
),
5000
getCiStatus
:
->
getCiStatus
:
->
...
...
app/views/projects/merge_requests/widget/_show.html.haml
View file @
c1c786fe
...
@@ -13,16 +13,15 @@
...
@@ -13,16 +13,15 @@
url_to_automerge_check
:
"
#{
merge_check_namespace_project_merge_request_path
(
@project
.
namespace
,
@project
,
@merge_request
)
}
"
,
url_to_automerge_check
:
"
#{
merge_check_namespace_project_merge_request_path
(
@project
.
namespace
,
@project
,
@merge_request
)
}
"
,
check_enable
:
#{
@merge_request
.
unchecked?
?
"true"
:
"false"
}
,
check_enable
:
#{
@merge_request
.
unchecked?
?
"true"
:
"false"
}
,
url_to_ci_check
:
"
#{
ci_status_namespace_project_merge_request_path
(
@project
.
namespace
,
@project
,
@merge_request
)
}
"
,
url_to_ci_check
:
"
#{
ci_status_namespace_project_merge_request_path
(
@project
.
namespace
,
@project
,
@merge_request
)
}
"
,
gitlab_icon
:
"
#{
asset_path
'gitlab_logo.png'
}
"
gitlab_icon
:
"
#{
asset_path
'gitlab_logo.png'
}
"
,
current_status
:
""
};
};
-
if
@merge_request
.
ci_commit
-
if
@merge_request
.
ci_commit
:javascript
:javascript
opts
.
current_status
=
"
#{
@merge_request
.
ci_commit
.
try
(
:status
)
}
"
;
opts
.
ci_message
=
"
Build {{status}} for
#{
@merge_request
.
ci_commit
.
sha
}
"
;
opts
.
ci_message
=
"
Build {{status}} for
#{
@merge_request
.
ci_commit
.
sha
}
"
;
-
else
-
else
:javascript
:javascript
opts
.
current_status
=
"
#{
@merge_request
.
source_project
.
ci_service
.
commit_status
(
@merge_request
.
last_commit
.
sha
,
merge_request
.
source_branch
)
if
@merge_request
.
source_project
.
ci_service
}
"
;
opts
.
ci_message
=
"
Build {{status}} for
#{
@merge_request
.
last_commit
.
sha
}
"
;
opts
.
ci_message
=
"
Build {{status}} for
#{
@merge_request
.
last_commit
.
sha
}
"
;
:javascript
:javascript
...
...
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