split requeueBuild vs requeueJob
This commit is contained in:
parent
27dee49a8e
commit
808e341227
|
@ -49,9 +49,8 @@ require 'travis/model'
|
|||
$.map(headers.concat(keys), (key) -> return $.camelize(key))
|
||||
).property('config')
|
||||
|
||||
requeue: (->
|
||||
requeue: ->
|
||||
Travis.ajax.post '/requests', build_id: @get('id')
|
||||
)
|
||||
|
||||
isAttributeLoaded: (key) ->
|
||||
if ['_duration', 'finishedAt', 'result'].contains(key) && !@get('finished')
|
||||
|
|
|
@ -33,6 +33,10 @@ require 'travis/model'
|
|||
Travis.Helpers.compact(@get('data.config'))
|
||||
).property('data.config')
|
||||
|
||||
isFinished: (->
|
||||
@get('state') == 'finished'
|
||||
).property('state')
|
||||
|
||||
sponsor: (->
|
||||
worker = @get('log.workerName')
|
||||
if worker && worker.length
|
||||
|
@ -52,6 +56,9 @@ require 'travis/model'
|
|||
[]
|
||||
).property('config')
|
||||
|
||||
requeue: ->
|
||||
Travis.ajax.post '/requests', job_id: @get('id')
|
||||
|
||||
appendLog: (text) ->
|
||||
if log = @get('log')
|
||||
log.append(text)
|
||||
|
|
|
@ -4,9 +4,14 @@
|
|||
<li>
|
||||
<a href="#" name="status-images" class="open-popup" {{action statusImages target="view"}}>Status Images</a>
|
||||
</li>
|
||||
{{#if view.canPush}}
|
||||
{{#if view.canRequeueBuild}}
|
||||
<li>
|
||||
<a href="#" {{action requeue target="view"}}>Rebuild</a>
|
||||
<a href="#" {{action requeueBuild target="view"}}>Rebuild</a>
|
||||
</li>
|
||||
{{/if}}
|
||||
{{#if view.canRequeueJob}}
|
||||
<li>
|
||||
<a href="#" {{action requeueJob target="view"}}>Rebuild</a>
|
||||
</li>
|
||||
{{/if}}
|
||||
</ul>
|
||||
|
|
|
@ -90,25 +90,38 @@
|
|||
element = $('#tools .menu').toggleClass('display')
|
||||
event.stopPropagation()
|
||||
|
||||
requeue: ->
|
||||
@closeMenu()
|
||||
@get('build').requeue()
|
||||
|
||||
statusImages: (event) ->
|
||||
@set('active', true)
|
||||
@closeMenu()
|
||||
@popup(event)
|
||||
event.stopPropagation()
|
||||
|
||||
canPush: (->
|
||||
@get('isBuildTab') && @get('build.isFinished') && @get('hasPushPermissions')
|
||||
).property('build.isFinished', 'hasPushPermissions', 'isBuildTab')
|
||||
requeueBuild: ->
|
||||
@closeMenu()
|
||||
@get('build').requeue()
|
||||
|
||||
requeueJob: ->
|
||||
@closeMenu()
|
||||
@get('job').requeue()
|
||||
|
||||
canRequeueBuild: (->
|
||||
@get('isBuildTab') && @get('build.isFinished') && @get('hasPermissions')
|
||||
).property('isBuildTab', 'build.isFinished', 'hasPermissions')
|
||||
|
||||
canRequeueJob: (->
|
||||
@get('isJobTab') && @get('job.isFinished') && @get('hasPermissions')
|
||||
).property('isJobTab', 'job.isFinished', 'hasPermissions')
|
||||
|
||||
isBuildTab: (->
|
||||
['current', 'build', 'job'].indexOf(@get('tab')) > -1
|
||||
# ['current', 'build', 'job'].indexOf(@get('tab')) > -1
|
||||
@get('tab') in ['current', 'build']
|
||||
).property('tab')
|
||||
|
||||
hasPushPermissions: (->
|
||||
isJobTab: (->
|
||||
@get('tab') == 'job'
|
||||
).property('tab')
|
||||
|
||||
hasPermissions: (->
|
||||
if permissions = Travis.app.get('currentUser.permissions')
|
||||
permissions.indexOf(@get('repo.id')) > -1
|
||||
).property('Travis.app.currentUser.permissions.length', 'repo.id')
|
||||
|
|
Loading…
Reference in New Issue
Block a user