commit
d69ab156e0
|
@ -132,10 +132,8 @@ require 'travis/model'
|
||||||
).property('finishedAt')
|
).property('finishedAt')
|
||||||
|
|
||||||
canRemoveLog: (->
|
canRemoveLog: (->
|
||||||
# This should somehow get the status of removed log, but unfortunately there is
|
!@get('log.removed')
|
||||||
# no easy way to do that at the moment
|
).property('log.removed')
|
||||||
true
|
|
||||||
).property()
|
|
||||||
|
|
||||||
slug: (->
|
slug: (->
|
||||||
"#{@get('repo.slug')} ##{@get('number')}"
|
"#{@get('repo.slug')} ##{@get('number')}"
|
||||||
|
|
|
@ -39,7 +39,10 @@ require 'travis/log_chunks'
|
||||||
console.log 'log model: fetching log' if Log.DEBUG
|
console.log 'log model: fetching log' if Log.DEBUG
|
||||||
@clearParts()
|
@clearParts()
|
||||||
handlers =
|
handlers =
|
||||||
json: (json) => @loadParts(json['log']['parts'])
|
json: (json) =>
|
||||||
|
if json['log']['removed_at']
|
||||||
|
@set('removed', true)
|
||||||
|
@loadParts(json['log']['parts'])
|
||||||
text: (text) => @loadText(text)
|
text: (text) => @loadText(text)
|
||||||
Travis.Log.Request.create(id: id, handlers: handlers).run() if id = @get('job.id')
|
Travis.Log.Request.create(id: id, handlers: handlers).run() if id = @get('job.id')
|
||||||
|
|
||||||
|
|
8
assets/scripts/app/templates/remove_log.hbs
Normal file
8
assets/scripts/app/templates/remove_log.hbs
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
<a href="#" class="close" {{action "close" 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">Yes, please!</a>
|
||||||
|
<span class="or">or</span>
|
||||||
|
<a href="#" class="cancel">Cancel</a>
|
||||||
|
</p>
|
|
@ -32,16 +32,22 @@
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</li>
|
</li>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if view.showDownloadLog}}
|
{{#if view.jobIdForLog}}
|
||||||
<li class="icon download-log" title="Download Log">
|
{{#if view.showDownloadLog}}
|
||||||
<a class="download-log" {{bind-attr href="view.plainTextLogUrl"}}></a>
|
<li class="icon download-log" title="Download Log">
|
||||||
</li>
|
<a class="download-log" {{bind-attr href="view.plainTextLogUrl"}}></a>
|
||||||
|
</li>
|
||||||
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if view.displayRemoveLog}}
|
{{! the next if is a hack for refreshing displayRemoveLog when we change
|
||||||
<li class="icon remove-log" title="Remove Log">
|
views, it sometimes doesn't work properly }}
|
||||||
<a href="#" {{action "removeLog" target="view"}}
|
{{#if view.jobIdForLog}}
|
||||||
{{bind-attr class="view.canRemoveLog::disabled"}}></a>
|
{{#if view.displayRemoveLog}}
|
||||||
</li>
|
<li class="icon remove-log" title="Remove Log">
|
||||||
|
<a href="#" name="remove-log-popup" class="open-popup" {{action "removeLogPopup" target=view}}
|
||||||
|
{{bind-attr class="view.canRemoveLog::disabled"}}></a>
|
||||||
|
</li>
|
||||||
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if view.displayCodeClimate}}
|
{{#if view.displayCodeClimate}}
|
||||||
<li class="icon code-climate" title="Test Coverage with Code Climate">
|
<li class="icon code-climate" title="Test Coverage with Code Climate">
|
||||||
|
@ -53,3 +59,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>
|
||||||
|
|
|
@ -20,7 +20,7 @@ Travis.NotFoundView = Ember.View.extend
|
||||||
name = event?.target?.name || name
|
name = event?.target?.name || name
|
||||||
$("##{name}").toggleClass('display')
|
$("##{name}").toggleClass('display')
|
||||||
popupClose: ->
|
popupClose: ->
|
||||||
$(event.target).closest('.popup').removeClass('display')
|
$('.popup').removeClass('display')
|
||||||
popupCloseAll: ->
|
popupCloseAll: ->
|
||||||
if view = Travis.View.currentPopupView
|
if view = Travis.View.currentPopupView
|
||||||
view.destroy()
|
view.destroy()
|
||||||
|
|
|
@ -19,12 +19,12 @@ Travis.reopen
|
||||||
).property('controller.repo.slug')
|
).property('controller.repo.slug')
|
||||||
|
|
||||||
actions:
|
actions:
|
||||||
statusImages: ->
|
statusImages: () ->
|
||||||
@popupCloseAll()
|
@popupCloseAll()
|
||||||
view = Travis.StatusImagesView.create(toolsView: this)
|
view = Travis.StatusImagesView.create(toolsView: this)
|
||||||
Travis.View.currentPopupView = view
|
Travis.View.currentPopupView = view
|
||||||
view.appendTo($('body'))
|
view.appendTo($('body'))
|
||||||
event.stopPropagation()
|
return false
|
||||||
|
|
||||||
ReposEmptyView: Travis.View.extend
|
ReposEmptyView: Travis.View.extend
|
||||||
template: (->
|
template: (->
|
||||||
|
@ -116,14 +116,14 @@ Travis.reopen
|
||||||
menu: ->
|
menu: ->
|
||||||
@popupCloseAll()
|
@popupCloseAll()
|
||||||
$('#tools .menu').toggleClass('display')
|
$('#tools .menu').toggleClass('display')
|
||||||
event.stopPropagation()
|
return false
|
||||||
|
|
||||||
regenerateKeyPopup: ->
|
regenerateKeyPopup: ->
|
||||||
if @get('canRegenerateKey')
|
if @get('canRegenerateKey')
|
||||||
@set('active', true)
|
@set('active', true)
|
||||||
@closeMenu()
|
@closeMenu()
|
||||||
@popup(event)
|
@popup('regenerate-key-popup')
|
||||||
event.stopPropagation()
|
return false
|
||||||
|
|
||||||
regenerateKey: ->
|
regenerateKey: ->
|
||||||
@popupCloseAll()
|
@popupCloseAll()
|
||||||
|
@ -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
|
||||||
|
@ -226,7 +227,13 @@ Travis.reopen
|
||||||
codeClimatePopup: ->
|
codeClimatePopup: ->
|
||||||
@popupCloseAll()
|
@popupCloseAll()
|
||||||
@popup('code-climate')
|
@popup('code-climate')
|
||||||
event.stopPropagation() if event?
|
return false
|
||||||
|
|
||||||
|
removeLogPopup: ->
|
||||||
|
if @get('canRemoveLog')
|
||||||
|
@set('active', true)
|
||||||
|
@popup('remove-log-popup')
|
||||||
|
return false
|
||||||
|
|
||||||
hasPermission: (->
|
hasPermission: (->
|
||||||
if permissions = @get('currentUser.permissions')
|
if permissions = @get('currentUser.permissions')
|
||||||
|
@ -258,16 +265,18 @@ Travis.reopen
|
||||||
@get('jobIdForLog')
|
@get('jobIdForLog')
|
||||||
).property('jobIdForLog')
|
).property('jobIdForLog')
|
||||||
|
|
||||||
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')
|
||||||
|
@ -279,14 +288,14 @@ Travis.reopen
|
||||||
).property('jobIdForLog', 'job.log.token', 'build.jobs.firstObject.log.token')
|
).property('jobIdForLog', 'job.log.token', 'build.jobs.firstObject.log.token')
|
||||||
|
|
||||||
canRemoveLog: (->
|
canRemoveLog: (->
|
||||||
@get('displayRemoveLog') && @get('hasPermission')
|
@get('displayRemoveLog')
|
||||||
).property('displayRemoveLog', 'hasPermission')
|
).property('displayRemoveLog')
|
||||||
|
|
||||||
displayRemoveLog: (->
|
displayRemoveLog: (->
|
||||||
#(@get('isJobTab') || (@get('isBuildTab') && @get('build.jobs.length') == 1)) &&
|
if job = @get('_job')
|
||||||
# @get('build.jobs').objectAt(0).get?('canRemoveLog')
|
(@get('isJobTab') || (@get('isBuildTab') && @get('build.jobs.length') == 1)) &&
|
||||||
false
|
job.get('canRemoveLog') && @get('hasPermission')
|
||||||
).property('isJobTab', 'isBuildTab', 'build.jobs.length', 'job.canRemoveLog')
|
).property('isJobTab', 'isBuildTab', 'build.jobs.length', '_job.canRemoveLog', 'jobIdForLog', 'canRemoveLog', 'hasPermission')
|
||||||
|
|
||||||
canCancelBuild: (->
|
canCancelBuild: (->
|
||||||
@get('displayCancelBuild') && @get('hasPermission')
|
@get('displayCancelBuild') && @get('hasPermission')
|
||||||
|
|
|
@ -72,7 +72,8 @@
|
||||||
p:last-child
|
p:last-child
|
||||||
margin-top: 10px
|
margin-top: 10px
|
||||||
|
|
||||||
#regenerate-key
|
#regenerate-key,
|
||||||
|
#remove-log-popup
|
||||||
.cancel
|
.cancel
|
||||||
text-decoration: underline
|
text-decoration: underline
|
||||||
p
|
p
|
||||||
|
@ -84,6 +85,8 @@
|
||||||
margin-bottom: 5px
|
margin-bottom: 5px
|
||||||
a.button
|
a.button
|
||||||
font-size: 13px
|
font-size: 13px
|
||||||
|
strong
|
||||||
|
color: $red
|
||||||
|
|
||||||
#status-images, #regenerate-key
|
#status-images, #regenerate-key
|
||||||
input
|
input
|
||||||
|
@ -108,3 +111,4 @@
|
||||||
padding-left: 15px
|
padding-left: 15px
|
||||||
img#code-climate-logo
|
img#code-climate-logo
|
||||||
margin-right: 50px
|
margin-right: 50px
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user