Pull job/repository actions out of cog menu.
It's very hard to notice where something is, when it's hidden in that menu.
This commit is contained in:
parent
cebe5b1e1c
commit
2cc35556ab
|
@ -42,8 +42,10 @@
|
|||
<dd class="committer"><a {{bindAttr href="controller.urlCommitter"}}>{{commit.committerName}}</a></dd>
|
||||
{{/if}}
|
||||
</div>
|
||||
{{view Travis.RepoActionsView}}
|
||||
{{/with}}
|
||||
|
||||
|
||||
<dt>{{t builds.message}}</dt>
|
||||
<dd class="message">{{formatMessage build.commit.message repoBinding=build.repo}}</dd>
|
||||
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
<dd class="committer"><a {{bindAttr href="controller.urlCommitter"}}>{{commit.committerName}}</a></dd>
|
||||
{{/if}}
|
||||
</div>
|
||||
{{view Travis.RepoActionsView}}
|
||||
{{/with}}
|
||||
<dt>{{t jobs.message}}</dt>
|
||||
<dd class="message">{{formatMessage job.commit.message repoBinding=job.repo}}</dd>
|
||||
|
|
38
assets/scripts/app/templates/repos/show/actions.hbs
Normal file
38
assets/scripts/app/templates/repos/show/actions.hbs
Normal file
|
@ -0,0 +1,38 @@
|
|||
<div id="actions">
|
||||
<ul>
|
||||
<li>
|
||||
<a href="#" name="status-images" class="open-popup" {{action "statusImages" target="view"}}>Status Images</a>
|
||||
</li>
|
||||
{{#if view.displayCancelBuild}}
|
||||
<li>
|
||||
<a href="#" {{action "cancelBuild" target="view"}}
|
||||
{{bindAttr class="view.canCancelBuild::disabled"}}>Cancel Build</a>
|
||||
</li>
|
||||
{{/if}}
|
||||
{{#if view.displayCancelJob}}
|
||||
<li>
|
||||
<a href="#" {{action "cancelJob" target="view"}}
|
||||
{{bindAttr class="view.canCancelJob::disabled"}}>Cancel Job</a>
|
||||
</li>
|
||||
{{/if}}
|
||||
{{#if view.displayRequeueBuild}}
|
||||
<li>
|
||||
<a href="#" {{action "requeueBuild" target="view"}}
|
||||
{{bindAttr class="view.canRequeueBuild::disabled"}}>Restart Build</a>
|
||||
</li>
|
||||
{{/if}}
|
||||
{{#if view.displayRequeueJob}}
|
||||
<li>
|
||||
<a href="#" {{action "requeueJob" target="view"}}
|
||||
{{bindAttr class="view.canRequeueJob::disabled"}}>Restart Job</a>
|
||||
</li>
|
||||
{{/if}}
|
||||
{{!TODO: for some reason showDownloadLog, which just delegates to jobIdForLog
|
||||
does not refresh 'if' properly, need further investigation}}
|
||||
{{#if view.jobIdForLog}}
|
||||
<li>
|
||||
<a class="download-log" {{bindAttr href="view.plainTextLogUrl"}}>Download Log</a>
|
||||
</li>
|
||||
{{/if}}
|
||||
</ul>
|
||||
</div>
|
|
@ -1,34 +1,7 @@
|
|||
<div id="tools">
|
||||
<a href="#" {{action "menu" target="view"}}></a>
|
||||
<ul class="menu">
|
||||
<li>
|
||||
<a href="#" name="status-images" class="open-popup" {{action "statusImages" target="view"}}>Status Images</a>
|
||||
</li>
|
||||
{{#if view.displayCancelBuild}}
|
||||
<li>
|
||||
<a href="#" {{action "cancelBuild" target="view"}}
|
||||
{{bindAttr class="view.canCancelBuild::disabled"}}>Cancel Build</a>
|
||||
</li>
|
||||
{{/if}}
|
||||
{{#if view.displayCancelJob}}
|
||||
<li>
|
||||
<a href="#" {{action "cancelJob" target="view"}}
|
||||
{{bindAttr class="view.canCancelJob::disabled"}}>Cancel Job</a>
|
||||
</li>
|
||||
{{/if}}
|
||||
{{#if view.displayRequeueBuild}}
|
||||
<li>
|
||||
<a href="#" {{action "requeueBuild" target="view"}}
|
||||
{{bindAttr class="view.canRequeueBuild::disabled"}}>Restart Build</a>
|
||||
</li>
|
||||
{{/if}}
|
||||
{{#if view.displayRequeueJob}}
|
||||
<li>
|
||||
<a href="#" {{action "requeueJob" target="view"}}
|
||||
{{bindAttr class="view.canRequeueJob::disabled"}}> Restart Job </a>
|
||||
</li>
|
||||
{{/if}}
|
||||
{{#if view.displayRegenerateKey}}
|
||||
{{#if view.displayRegenerateKey}}
|
||||
<li>
|
||||
<a href="#" name="regenerate-key"
|
||||
{{action "regenerateKeyPopup" target="view"}}
|
||||
|
@ -37,13 +10,6 @@
|
|||
</a>
|
||||
</li>
|
||||
{{/if}}
|
||||
{{!TODO: for some reason showDownloadLog, which just delegates to jobIdForLog
|
||||
does not refresh 'if' properly, need further investigation}}
|
||||
{{#if view.jobIdForLog}}
|
||||
<li>
|
||||
<a class="download-log" {{bindAttr href="view.plainTextLogUrl"}}>Download log</a>
|
||||
</li>
|
||||
{{/if}}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
@ -57,7 +23,7 @@
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<a class="sync_now button" {{action "regenerateKey" target="view"}}>Yes! Do it!</a>
|
||||
<a class="sync_now button" {{action "regenerateKey" target="view"}}>Yes, do it!</a>
|
||||
<span class="or">or</span>
|
||||
<a href="#" class="cancel" {{action "popupClose" target="view"}}>Cancel</a>
|
||||
</p>
|
||||
|
|
|
@ -85,13 +85,47 @@ Travis.reopen
|
|||
$('#tools .menu').toggleClass('display')
|
||||
event.stopPropagation()
|
||||
|
||||
regenerateKeyPopup: ->
|
||||
if @get('canRegenerateKey')
|
||||
@set('active', true)
|
||||
@closeMenu()
|
||||
@popup(event)
|
||||
event.stopPropagation()
|
||||
|
||||
regenerateKey: ->
|
||||
@popupCloseAll()
|
||||
|
||||
(@get('repo.content') || @get('repo')).regenerateKey
|
||||
success: =>
|
||||
@popup('regeneration-success')
|
||||
error: ->
|
||||
Travis.lookup('controller:flash').loadFlashes([{ error: 'Travis encountered an error while trying to regenerate the key, please try again.'}])
|
||||
|
||||
displayRegenerateKey: true
|
||||
|
||||
canRegenerateKey: (->
|
||||
@get('displayRegenerateKey') && @get('hasPermission')
|
||||
).property('hasPermission')
|
||||
|
||||
hasPermission: (->
|
||||
if permissions = @get('currentUser.permissions')
|
||||
permissions.contains parseInt(@get('repo.id'))
|
||||
).property('currentUser.permissions.length', 'repo.id')
|
||||
|
||||
RepoActionsView: Travis.View.extend
|
||||
templateName: 'repos/show/actions'
|
||||
|
||||
repoBinding: 'controller.repo'
|
||||
buildBinding: 'controller.build'
|
||||
jobBinding: 'controller.job'
|
||||
tabBinding: 'controller.controllers.repo.tab'
|
||||
currentUserBinding: 'controller.controllers.repo.currentUser'
|
||||
|
||||
requeue: ->
|
||||
@closeMenu()
|
||||
@get('build').requeue()
|
||||
|
||||
cancelBuild: ->
|
||||
if @get('canCancelBuild')
|
||||
@closeMenu()
|
||||
Travis.flash(notice: 'Build cancelation has been scheduled.')
|
||||
@get('build').cancel().then ->
|
||||
Travis.flash(success: 'Build has been successfuly canceled.')
|
||||
|
@ -105,7 +139,6 @@ Travis.reopen
|
|||
|
||||
cancelJob: ->
|
||||
if @get('canCancelJob')
|
||||
@closeMenu()
|
||||
Travis.flash(notice: 'Job cancelation has been scheduled.')
|
||||
@get('job').cancel().then ->
|
||||
Travis.flash(success: 'Job has been successfuly canceled.')
|
||||
|
@ -118,41 +151,16 @@ Travis.reopen
|
|||
Travis.flash(error: 'An error occured when canceling the job')
|
||||
|
||||
statusImages: ->
|
||||
@set('active', true)
|
||||
@closeMenu()
|
||||
@popupCloseAll()
|
||||
view = Travis.StatusImagesView.create(toolsView: this)
|
||||
# TODO: create a general mechanism for managing current popup
|
||||
# and move all popups to use it
|
||||
Travis.View.currentPopupView = view
|
||||
view.appendTo($('body'))
|
||||
event.stopPropagation()
|
||||
|
||||
regenerateKeyPopup: ->
|
||||
if @get('canRegenerateKey')
|
||||
@set('active', true)
|
||||
@closeMenu()
|
||||
@popup(event)
|
||||
event.stopPropagation()
|
||||
|
||||
requeueBuild: ->
|
||||
if @get('canRequeueBuild')
|
||||
@closeMenu()
|
||||
@get('build').requeue()
|
||||
|
||||
requeueJob: ->
|
||||
if @get('canRequeueJob')
|
||||
@closeMenu()
|
||||
@get('job').requeue()
|
||||
|
||||
regenerateKey: ->
|
||||
@popupCloseAll()
|
||||
|
||||
(@get('repo.content') || @get('repo')).regenerateKey
|
||||
success: =>
|
||||
@popup('regeneration-success')
|
||||
error: ->
|
||||
Travis.lookup('controller:flash').loadFlashes([{ error: 'Travis encountered an error while trying to regenerate the key, please try again.'}])
|
||||
hasPermission: (->
|
||||
if permissions = @get('currentUser.permissions')
|
||||
permissions.contains parseInt(@get('repo.id'))
|
||||
).property('currentUser.permissions.length', 'repo.id')
|
||||
|
||||
displayRequeueBuild: (->
|
||||
@get('isBuildTab') && @get('build.isFinished')
|
||||
|
@ -200,22 +208,18 @@ Travis.reopen
|
|||
@get('isJobTab') && @get('job.canCancel')
|
||||
).property('isJobTab', 'job.canCancel')
|
||||
|
||||
displayRegenerateKey: true
|
||||
|
||||
canRegenerateKey: (->
|
||||
@get('displayRegenerateKey') && @get('hasPermission')
|
||||
).property('hasPermission')
|
||||
|
||||
|
||||
isJobTab: (->
|
||||
@get('tab') == 'job'
|
||||
).property('tab')
|
||||
).property('tab', 'repo.id')
|
||||
|
||||
isBuildTab: (->
|
||||
['current', 'build'].indexOf(@get('tab')) > -1
|
||||
).property('tab')
|
||||
|
||||
hasPermission: (->
|
||||
if permissions = @get('currentUser.permissions')
|
||||
permissions.contains parseInt(@get('repo.id'))
|
||||
).property('currentUser.permissions.length', 'repo.id')
|
||||
requeueBuild: ->
|
||||
if @get('canRequeueBuild')
|
||||
@get('build').requeue()
|
||||
|
||||
requeueJob: ->
|
||||
if @get('canRequeueJob')
|
||||
@get('job').requeue()
|
||||
|
|
|
@ -32,3 +32,7 @@
|
|||
&.disabled
|
||||
cursor: default
|
||||
color: $color-link-disabled
|
||||
|
||||
#actions
|
||||
float: right
|
||||
text-align: right
|
||||
|
|
Loading…
Reference in New Issue
Block a user