Prevent sending double restart request
When requeue icon was clicked 2 times it was sometimes the case that we sent 2 requests. This commit prevents that and also adds a little nice indicator instead of restart button while we're sending the request.
This commit is contained in:
parent
2172fb705a
commit
31cb3c0bb5
|
@ -14,14 +14,22 @@
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if view.displayRequeueBuild}}
|
{{#if view.displayRequeueBuild}}
|
||||||
<li class="icon" title="Restart Build">
|
<li class="icon" title="Restart Build">
|
||||||
<a href="#" {{action "requeueBuild" target="view"}}
|
{{#if view.requeueing}}
|
||||||
{{bind-attr class="view.canRequeueBuild::disabled"}}><img class="icon" src="/images/icons/repeat.png" width="20"></a>
|
<span class="icon loading"></span>
|
||||||
|
{{else}}
|
||||||
|
<a href="#" {{action "requeueBuild" target="view"}}
|
||||||
|
{{bind-attr class="view.canRequeueBuild::disabled"}}><img class="icon" src="/images/icons/repeat.png" width="20"></a>
|
||||||
|
{{/if}}
|
||||||
</li>
|
</li>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if view.displayRequeueJob}}
|
{{#if view.displayRequeueJob}}
|
||||||
<li class="icon" title="Restart Job">
|
<li class="icon" title="Restart Job">
|
||||||
<a href="#" {{action "requeueJob" target="view"}}
|
{{#if view.requeueing}}
|
||||||
{{bind-attr class="view.canRequeueJob::disabled"}}><img src="/images/icons/repeat.png" width="20"></a>
|
<span class="icon loading"></span>
|
||||||
|
{{else}}
|
||||||
|
<a href="#" {{action "requeueJob" target="view"}}
|
||||||
|
{{bind-attr class="view.canRequeueJob::disabled"}}><img src="/images/icons/repeat.png" width="20"></a>
|
||||||
|
{{/if}}
|
||||||
</li>
|
</li>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{!TODO: for some reason showDownloadLog, which just delegates to jobIdForLog
|
{{!TODO: for some reason showDownloadLog, which just delegates to jobIdForLog
|
||||||
|
|
|
@ -154,9 +154,6 @@ Travis.reopen
|
||||||
tabBinding: 'controller.tab'
|
tabBinding: 'controller.tab'
|
||||||
currentUserBinding: 'controller.currentUser'
|
currentUserBinding: 'controller.currentUser'
|
||||||
|
|
||||||
requeue: ->
|
|
||||||
@get('build').requeue()
|
|
||||||
|
|
||||||
cancelBuild: ->
|
cancelBuild: ->
|
||||||
if @get('canCancelBuild')
|
if @get('canCancelBuild')
|
||||||
Travis.flash(notice: 'Build cancelation has been scheduled.')
|
Travis.flash(notice: 'Build cancelation has been scheduled.')
|
||||||
|
@ -256,12 +253,20 @@ Travis.reopen
|
||||||
@popup('code-climate')
|
@popup('code-climate')
|
||||||
event.stopPropagation() if event?
|
event.stopPropagation() if event?
|
||||||
|
|
||||||
|
requeueFinished: ->
|
||||||
|
@set('requeueing', false)
|
||||||
|
|
||||||
|
requeue: (thing) ->
|
||||||
|
return if @get('requeueing')
|
||||||
|
@set('requeueing', true)
|
||||||
|
thing.requeue().then(this.requeueFinished.bind(this), this.requeueFinished.bind(this))
|
||||||
|
|
||||||
requeueBuild: ->
|
requeueBuild: ->
|
||||||
if @get('canRequeueBuild')
|
if @get('canRequeueBuild')
|
||||||
@get('build').requeue()
|
@requeue @get('build')
|
||||||
|
|
||||||
requeueJob: ->
|
requeueJob: ->
|
||||||
if @get('canRequeueJob')
|
if @get('canRequeueJob')
|
||||||
@get('job').requeue()
|
@requeue @get('job')
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -61,6 +61,19 @@
|
||||||
text-align: right
|
text-align: right
|
||||||
|
|
||||||
li.icon
|
li.icon
|
||||||
|
span.loading
|
||||||
|
display: inline-block
|
||||||
|
height: 20px
|
||||||
|
position: relative
|
||||||
|
top: 1px
|
||||||
|
cursor: pointer
|
||||||
|
color: #fef4e9
|
||||||
|
border: solid 1px #d6d6d6
|
||||||
|
background-color: #f4f4f4
|
||||||
|
text-align: center
|
||||||
|
margin-left: 5px
|
||||||
|
background-position: center center
|
||||||
|
|
||||||
a
|
a
|
||||||
display: inline-block
|
display: inline-block
|
||||||
width: 25px
|
width: 25px
|
||||||
|
|
Loading…
Reference in New Issue
Block a user