
This commit fixes caches view to show caches also if only PR caches exist. Previous version checked for pushes only.
28 lines
735 B
CoffeeScript
28 lines
735 B
CoffeeScript
`import Ember from 'ember'`
|
|
`import Ajax from 'travis/utils/ajax'`
|
|
|
|
Controller = Ember.Controller.extend
|
|
needs: ['repo']
|
|
repo: Ember.computed.alias('controllers.repo.repo')
|
|
|
|
isDeleting: false
|
|
|
|
cachesExist: (->
|
|
@get('model.pushes.length') || @get('model.pullRequests.length')
|
|
).property('model.pushes.length', 'model.pullRequests.length')
|
|
|
|
actions:
|
|
deleteRepoCache: ->
|
|
return if @get('isDeleting')
|
|
|
|
if confirm('Are you sure?')
|
|
@set('isDeleting', true)
|
|
|
|
deletingDone = => @set('isDeleting', false)
|
|
|
|
repo = @get('repo')
|
|
Ajax.ajax("/repos/#{@get('repo.id')}/caches", "DELETE").then(deletingDone, deletingDone).then =>
|
|
@set('model', {})
|
|
|
|
`export default Controller`
|