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>
|
<dd class="committer"><a {{bindAttr href="controller.urlCommitter"}}>{{commit.committerName}}</a></dd>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
|
{{view Travis.RepoActionsView}}
|
||||||
{{/with}}
|
{{/with}}
|
||||||
|
|
||||||
|
|
||||||
<dt>{{t builds.message}}</dt>
|
<dt>{{t builds.message}}</dt>
|
||||||
<dd class="message">{{formatMessage build.commit.message repoBinding=build.repo}}</dd>
|
<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>
|
<dd class="committer"><a {{bindAttr href="controller.urlCommitter"}}>{{commit.committerName}}</a></dd>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
|
{{view Travis.RepoActionsView}}
|
||||||
{{/with}}
|
{{/with}}
|
||||||
<dt>{{t jobs.message}}</dt>
|
<dt>{{t jobs.message}}</dt>
|
||||||
<dd class="message">{{formatMessage job.commit.message repoBinding=job.repo}}</dd>
|
<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">
|
<div id="tools">
|
||||||
<a href="#" {{action "menu" target="view"}}></a>
|
<a href="#" {{action "menu" target="view"}}></a>
|
||||||
<ul class="menu">
|
<ul class="menu">
|
||||||
<li>
|
{{#if view.displayRegenerateKey}}
|
||||||
<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}}
|
|
||||||
<li>
|
<li>
|
||||||
<a href="#" name="regenerate-key"
|
<a href="#" name="regenerate-key"
|
||||||
{{action "regenerateKeyPopup" target="view"}}
|
{{action "regenerateKeyPopup" target="view"}}
|
||||||
|
@ -37,13 +10,6 @@
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
{{/if}}
|
{{/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>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -57,7 +23,7 @@
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<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>
|
<span class="or">or</span>
|
||||||
<a href="#" class="cancel" {{action "popupClose" target="view"}}>Cancel</a>
|
<a href="#" class="cancel" {{action "popupClose" target="view"}}>Cancel</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
|
@ -85,13 +85,47 @@ Travis.reopen
|
||||||
$('#tools .menu').toggleClass('display')
|
$('#tools .menu').toggleClass('display')
|
||||||
event.stopPropagation()
|
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: ->
|
requeue: ->
|
||||||
@closeMenu()
|
|
||||||
@get('build').requeue()
|
@get('build').requeue()
|
||||||
|
|
||||||
cancelBuild: ->
|
cancelBuild: ->
|
||||||
if @get('canCancelBuild')
|
if @get('canCancelBuild')
|
||||||
@closeMenu()
|
|
||||||
Travis.flash(notice: 'Build cancelation has been scheduled.')
|
Travis.flash(notice: 'Build cancelation has been scheduled.')
|
||||||
@get('build').cancel().then ->
|
@get('build').cancel().then ->
|
||||||
Travis.flash(success: 'Build has been successfuly canceled.')
|
Travis.flash(success: 'Build has been successfuly canceled.')
|
||||||
|
@ -105,7 +139,6 @@ Travis.reopen
|
||||||
|
|
||||||
cancelJob: ->
|
cancelJob: ->
|
||||||
if @get('canCancelJob')
|
if @get('canCancelJob')
|
||||||
@closeMenu()
|
|
||||||
Travis.flash(notice: 'Job cancelation has been scheduled.')
|
Travis.flash(notice: 'Job cancelation has been scheduled.')
|
||||||
@get('job').cancel().then ->
|
@get('job').cancel().then ->
|
||||||
Travis.flash(success: 'Job has been successfuly canceled.')
|
Travis.flash(success: 'Job has been successfuly canceled.')
|
||||||
|
@ -118,41 +151,16 @@ Travis.reopen
|
||||||
Travis.flash(error: 'An error occured when canceling the job')
|
Travis.flash(error: 'An error occured when canceling the job')
|
||||||
|
|
||||||
statusImages: ->
|
statusImages: ->
|
||||||
@set('active', true)
|
|
||||||
@closeMenu()
|
|
||||||
@popupCloseAll()
|
@popupCloseAll()
|
||||||
view = Travis.StatusImagesView.create(toolsView: this)
|
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
|
Travis.View.currentPopupView = view
|
||||||
view.appendTo($('body'))
|
view.appendTo($('body'))
|
||||||
event.stopPropagation()
|
event.stopPropagation()
|
||||||
|
|
||||||
regenerateKeyPopup: ->
|
hasPermission: (->
|
||||||
if @get('canRegenerateKey')
|
if permissions = @get('currentUser.permissions')
|
||||||
@set('active', true)
|
permissions.contains parseInt(@get('repo.id'))
|
||||||
@closeMenu()
|
).property('currentUser.permissions.length', 'repo.id')
|
||||||
@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.'}])
|
|
||||||
|
|
||||||
displayRequeueBuild: (->
|
displayRequeueBuild: (->
|
||||||
@get('isBuildTab') && @get('build.isFinished')
|
@get('isBuildTab') && @get('build.isFinished')
|
||||||
|
@ -200,22 +208,18 @@ Travis.reopen
|
||||||
@get('isJobTab') && @get('job.canCancel')
|
@get('isJobTab') && @get('job.canCancel')
|
||||||
).property('isJobTab', 'job.canCancel')
|
).property('isJobTab', 'job.canCancel')
|
||||||
|
|
||||||
displayRegenerateKey: true
|
|
||||||
|
|
||||||
canRegenerateKey: (->
|
|
||||||
@get('displayRegenerateKey') && @get('hasPermission')
|
|
||||||
).property('hasPermission')
|
|
||||||
|
|
||||||
|
|
||||||
isJobTab: (->
|
isJobTab: (->
|
||||||
@get('tab') == 'job'
|
@get('tab') == 'job'
|
||||||
).property('tab')
|
).property('tab', 'repo.id')
|
||||||
|
|
||||||
isBuildTab: (->
|
isBuildTab: (->
|
||||||
['current', 'build'].indexOf(@get('tab')) > -1
|
['current', 'build'].indexOf(@get('tab')) > -1
|
||||||
).property('tab')
|
).property('tab')
|
||||||
|
|
||||||
hasPermission: (->
|
requeueBuild: ->
|
||||||
if permissions = @get('currentUser.permissions')
|
if @get('canRequeueBuild')
|
||||||
permissions.contains parseInt(@get('repo.id'))
|
@get('build').requeue()
|
||||||
).property('currentUser.permissions.length', 'repo.id')
|
|
||||||
|
requeueJob: ->
|
||||||
|
if @get('canRequeueJob')
|
||||||
|
@get('job').requeue()
|
||||||
|
|
|
@ -32,3 +32,7 @@
|
||||||
&.disabled
|
&.disabled
|
||||||
cursor: default
|
cursor: default
|
||||||
color: $color-link-disabled
|
color: $color-link-disabled
|
||||||
|
|
||||||
|
#actions
|
||||||
|
float: right
|
||||||
|
text-align: right
|
||||||
|
|
Loading…
Reference in New Issue
Block a user