Fix queue and running jobs controllers for ED

This commit is contained in:
Piotr Sarnacki 2015-01-28 13:00:20 +01:00
parent 6b177d2238
commit 15a4ba045d
3 changed files with 4 additions and 33 deletions

View File

@ -3,7 +3,8 @@ Job = Travis.Job
Controller = Em.ArrayController.extend
content: (->
Job.queued()
@store.filter 'job', {}, (job) ->
['created', 'queued'].indexOf(job.get('state')) != -1
).property()
Travis.QueueController = Controller

View File

@ -3,7 +3,8 @@ Job = Travis.Job
Controller = Em.ArrayController.extend
content: (->
Job.running()
@store.filter 'job', { state: 'started' }, (job) ->
['started', 'received'].indexOf(job.get('state')) != -1
).property()
Travis.RunningJobsController = Controller

View File

@ -143,34 +143,3 @@ Ajax = Travis.ajax
slug: (->
"#{@get('repo.slug')} ##{@get('number')}"
).property()
@Travis.Job.reopenClass
queued: ->
filtered = Ember.FilteredRecordArray.create(
modelClass: Travis.Job
filterFunction: (job) ->
['created', 'queued'].indexOf(job.get('state')) != -1
filterProperties: ['state', 'queue']
)
@fetch().then (array) ->
filtered.updateFilter()
filtered.set('isLoaded', true)
filtered
running: ->
filtered = Ember.FilteredRecordArray.create(
modelClass: Travis.Job
filterFunction: (job) ->
['started', 'received'].indexOf(job.get('state')) != -1
filterProperties: ['state']
)
@fetch(state: 'started').then (array) ->
filtered.updateFilter()
filtered.set('isLoaded', true)
filtered