Fix remove-log popup
This commit is contained in:
parent
d46c0f13ac
commit
dd21d1b5e8
10
app/components/code-climate-popup.coffee
Normal file
10
app/components/code-climate-popup.coffee
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
`import Ember from 'ember'`
|
||||||
|
|
||||||
|
Component = Ember.Component.extend(
|
||||||
|
actions:
|
||||||
|
close: ->
|
||||||
|
$('.popup').removeClass('display')
|
||||||
|
return false
|
||||||
|
)
|
||||||
|
|
||||||
|
`export default Component`
|
23
app/components/remove-log-popup.coffee
Normal file
23
app/components/remove-log-popup.coffee
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
`import Ember from 'ember'`
|
||||||
|
|
||||||
|
Component = Ember.Component.extend(
|
||||||
|
actions:
|
||||||
|
close: ->
|
||||||
|
$('.popup').removeClass('display')
|
||||||
|
return false
|
||||||
|
|
||||||
|
removeLog: ->
|
||||||
|
$('.popup').removeClass('display')
|
||||||
|
job = @get('job')
|
||||||
|
job.removeLog().then ->
|
||||||
|
Travis.flash(success: 'Log has been successfully removed.')
|
||||||
|
, (xhr) ->
|
||||||
|
if xhr.status == 409
|
||||||
|
Travis.flash(error: 'Log can\'t be removed')
|
||||||
|
else if xhr.status == 401
|
||||||
|
Travis.flash(error: 'You don\'t have sufficient access to remove the log')
|
||||||
|
else
|
||||||
|
Travis.flash(error: 'An error occured when removing the log')
|
||||||
|
)
|
||||||
|
|
||||||
|
`export default Component`
|
|
@ -1,6 +1,6 @@
|
||||||
<div id="code-climate" class="popup">
|
<div id="code-climate" class="popup">
|
||||||
<img src="/images/icons/code-climate-logo.svg" id="code-climate-logo"/>
|
<img src="/images/icons/code-climate-logo.svg" id="code-climate-logo"/>
|
||||||
<a href="#" class="close" {{action "popupClose" target=view}}></a>
|
<a href="#" class="close" {{action "close"}}></a>
|
||||||
<p>
|
<p>
|
||||||
<b>Want test coverage for your tests?</b>
|
<b>Want test coverage for your tests?</b>
|
||||||
</p>
|
</p>
|
||||||
|
|
10
app/templates/components/remove-log-popup.hbs
Normal file
10
app/templates/components/remove-log-popup.hbs
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
<div id="remove-log-popup" class="popup">
|
||||||
|
<a href="#" class="close" {{action "close"}}></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"}}>Yes, please!</a>
|
||||||
|
<span class="or">or</span>
|
||||||
|
<a href="#" class="cancel" {{action "close"}}>Cancel</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
|
@ -18,16 +18,4 @@
|
||||||
|
|
||||||
</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>
|
|
||||||
|
|
||||||
{{code-climate-popup}}
|
{{code-climate-popup}}
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
{{remove-log-popup job=view.job}}
|
||||||
|
|
||||||
<section id="log-container" class="log">
|
<section id="log-container" class="log">
|
||||||
{{#if view.job.notStarted}}
|
{{#if view.job.notStarted}}
|
||||||
<div class="log-notice">Hang tight, the log cannot be shown until the build has started.</div>
|
<div class="log-notice">Hang tight, the log cannot be shown until the build has started.</div>
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
<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>
|
|
|
@ -121,23 +121,8 @@ View = BasicView.extend
|
||||||
@engine.autoCloseFold = !Travis.tailing.isActive()
|
@engine.autoCloseFold = !Travis.tailing.isActive()
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
|
|
||||||
removeLog: ->
|
|
||||||
@popupCloseAll()
|
|
||||||
if @get('canRemoveLog')
|
|
||||||
job = @get('_job') || @get('build.jobs.firstObject')
|
|
||||||
job.removeLog().then ->
|
|
||||||
Travis.flash(success: 'Log has been successfully removed.')
|
|
||||||
, (xhr) ->
|
|
||||||
if xhr.status == 409
|
|
||||||
Travis.flash(error: 'Log can\'t be removed')
|
|
||||||
else if xhr.status == 401
|
|
||||||
Travis.flash(error: 'You don\'t have sufficient access to remove the log')
|
|
||||||
else
|
|
||||||
Travis.flash(error: 'An error occured when removing the log')
|
|
||||||
|
|
||||||
removeLogPopup: ->
|
removeLogPopup: ->
|
||||||
if @get('canRemoveLog')
|
if @get('canRemoveLog')
|
||||||
@set('active', true)
|
|
||||||
@popup('remove-log-popup')
|
@popup('remove-log-popup')
|
||||||
return false
|
return false
|
||||||
|
|
||||||
|
|
10
remove-log-popup.coffee
Normal file
10
remove-log-popup.coffee
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
<div id="remove-log-popup" class="popup">
|
||||||
|
<a href="#" class="close" {{action "close"}}></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"}}>Yes, please!</a>
|
||||||
|
<span class="or">or</span>
|
||||||
|
<a href="#" class="cancel" {{action "close"}}>Cancel</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
Loading…
Reference in New Issue
Block a user