travis-web/app/controllers/running-jobs.coffee
Piotr Sarnacki a4a75912b0 Implement ajax polling for things that are visible on the screen
We sometimes miss pusher updates, which started to be more common
lately. Until we investigate what's going on, this should be a good
workaround for keeping UI in sync with the DB.
2015-05-07 13:49:21 +02:00

25 lines
622 B
CoffeeScript

`import Ember from 'ember'`
Controller = Ember.ArrayController.extend
init: ->
@_super.apply this, arguments
if !Ember.testing
Visibility.every @config.intervals.updateTimes, @updateTimes.bind(this)
updateTimes: ->
if content = @get('content')
content.forEach (job) -> job.updateTimes()
isLoaded: false
content: (->
# TODO: this should also query for received jobs
result = @store.filter('job', {}, (job) ->
['started', 'received'].indexOf(job.get('state')) != -1
)
result.then =>
@set('isLoaded', true)
result
).property()
`export default Controller`