Add actions for remove log
This commit is contained in:
parent
3582969e90
commit
3bf326a942
|
@ -39,7 +39,7 @@
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if view.displayRemoveLog}}
|
{{#if view.displayRemoveLog}}
|
||||||
<li class="icon remove-log" title="Remove Log">
|
<li class="icon remove-log" title="Remove Log">
|
||||||
<a href="#" {{action "removeLog" target="view"}}
|
<a href="#" name="remove-log-popup" class="open-popup" {{action "removeLogPopup" target=view}}
|
||||||
{{bind-attr class="view.canRemoveLog::disabled"}}></a>
|
{{bind-attr class="view.canRemoveLog::disabled"}}></a>
|
||||||
</li>
|
</li>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
@ -53,3 +53,14 @@
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="remove-log-popup" class="popup">
|
||||||
|
<a href="#" class="close" {{action "popupClose" target=view}}></a>
|
||||||
|
<p><strong>This action will remove the log permanently!</strong></p>
|
||||||
|
<p>Do you want to continue?</p>
|
||||||
|
<p>
|
||||||
|
<a class="sync_now button" {{action "removeLog" target="view"}}>Yes, please!</a>
|
||||||
|
<span class="or">or</span>
|
||||||
|
<a href="#" class="cancel" {{action "popupClose" target=view}}>Cancel</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
|
@ -181,7 +181,7 @@ Travis.reopen
|
||||||
|
|
||||||
requeueJob: ->
|
requeueJob: ->
|
||||||
if @get('canRequeueJob')
|
if @get('canRequeueJob')
|
||||||
@requeue @get('job')
|
@requeue @get('_job')
|
||||||
|
|
||||||
cancelBuild: ->
|
cancelBuild: ->
|
||||||
if @get('canCancelBuild')
|
if @get('canCancelBuild')
|
||||||
|
@ -198,8 +198,9 @@ Travis.reopen
|
||||||
|
|
||||||
|
|
||||||
removeLog: ->
|
removeLog: ->
|
||||||
|
@popupCloseAll()
|
||||||
if @get('canRemoveLog')
|
if @get('canRemoveLog')
|
||||||
job = @get('job') || @get('build.jobs.firstObject')
|
job = @get('_job') || @get('build.jobs.firstObject')
|
||||||
job.removeLog().then ->
|
job.removeLog().then ->
|
||||||
Travis.flash(success: 'Log has been successfully removed.')
|
Travis.flash(success: 'Log has been successfully removed.')
|
||||||
, (xhr) ->
|
, (xhr) ->
|
||||||
|
@ -213,7 +214,7 @@ Travis.reopen
|
||||||
cancelJob: ->
|
cancelJob: ->
|
||||||
if @get('canCancelJob')
|
if @get('canCancelJob')
|
||||||
Travis.flash(notice: 'Job cancellation has been scheduled.')
|
Travis.flash(notice: 'Job cancellation has been scheduled.')
|
||||||
@get('job').cancel().then ->
|
@get('_job').cancel().then ->
|
||||||
Travis.flash(success: 'Job has been successfully canceled.')
|
Travis.flash(success: 'Job has been successfully canceled.')
|
||||||
, (xhr) ->
|
, (xhr) ->
|
||||||
if xhr.status == 422
|
if xhr.status == 422
|
||||||
|
@ -228,6 +229,12 @@ Travis.reopen
|
||||||
@popup('code-climate')
|
@popup('code-climate')
|
||||||
event.stopPropagation() if event?
|
event.stopPropagation() if event?
|
||||||
|
|
||||||
|
removeLogPopup: ->
|
||||||
|
if @get('canRemoveLog')
|
||||||
|
@set('active', true)
|
||||||
|
@popup(event)
|
||||||
|
event.stopPropagation()
|
||||||
|
|
||||||
hasPermission: (->
|
hasPermission: (->
|
||||||
if permissions = @get('currentUser.permissions')
|
if permissions = @get('currentUser.permissions')
|
||||||
permissions.contains parseInt(@get('repo.id'))
|
permissions.contains parseInt(@get('repo.id'))
|
||||||
|
@ -255,19 +262,21 @@ Travis.reopen
|
||||||
).property('displayRequeueJob', 'hasPermission')
|
).property('displayRequeueJob', 'hasPermission')
|
||||||
|
|
||||||
showDownloadLog: (->
|
showDownloadLog: (->
|
||||||
@get('jobIdForLog')
|
@get('_job')
|
||||||
).property('jobIdForLog')
|
).property('_job')
|
||||||
|
|
||||||
jobIdForLog: (->
|
_job: (->
|
||||||
@get('job.id') ||
|
|
||||||
(@get('build.jobs.length') == 1 && @get('build.jobs').objectAt(0).get?('id'))
|
|
||||||
).property('job.id', 'build.jobs.firstObject.id', 'build.jobs.length')
|
|
||||||
|
|
||||||
job: (->
|
|
||||||
if id = @get('jobIdForLog')
|
if id = @get('jobIdForLog')
|
||||||
Travis.Job.find(id)
|
Travis.Job.find(id)
|
||||||
).property('jobIdForLog')
|
).property('jobIdForLog')
|
||||||
|
|
||||||
|
jobIdForLog: (->
|
||||||
|
job = @get('job.id')
|
||||||
|
unless job
|
||||||
|
if @get('build.jobs.length') == 1
|
||||||
|
job = @get('build.jobs').objectAt?(0).get?('id')
|
||||||
|
job
|
||||||
|
).property('job.id', 'build.jobs.firstObject.id', 'build.jobs.length')
|
||||||
|
|
||||||
plainTextLogUrl: (->
|
plainTextLogUrl: (->
|
||||||
if id = @get('jobIdForLog')
|
if id = @get('jobIdForLog')
|
||||||
|
@ -283,10 +292,9 @@ Travis.reopen
|
||||||
).property('displayRemoveLog', 'hasPermission')
|
).property('displayRemoveLog', 'hasPermission')
|
||||||
|
|
||||||
displayRemoveLog: (->
|
displayRemoveLog: (->
|
||||||
#(@get('isJobTab') || (@get('isBuildTab') && @get('build.jobs.length') == 1)) &&
|
if job = Travis.Job.find(@get('jobIdForLog'))
|
||||||
# @get('build.jobs').objectAt(0).get?('canRemoveLog')
|
(@get('isJobTab') || (@get('isBuildTab') && @get('build.jobs.length') == 1)) && job.get('canRemoveLog')
|
||||||
false
|
).property('isJobTab', 'isBuildTab', 'build.jobs.length', 'job.canRemoveLog', 'jobIdForLog')
|
||||||
).property('isJobTab', 'isBuildTab', 'build.jobs.length', 'job.canRemoveLog')
|
|
||||||
|
|
||||||
canCancelBuild: (->
|
canCancelBuild: (->
|
||||||
@get('displayCancelBuild') && @get('hasPermission')
|
@get('displayCancelBuild') && @get('hasPermission')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user