Properly add new builds to builds lists
This commit is contained in:
parent
7e1a943a80
commit
6877c3afc1
|
@ -49,7 +49,9 @@ Repo = Model.extend
|
|||
|
||||
builds: (->
|
||||
id = @get('id')
|
||||
builds = @store.find('build', event_type: 'push', repository_id: id)
|
||||
builds = @store.filter('build', event_type: 'push', repository_id: id, (b) ->
|
||||
b.get('repo.id') == id && b.get('eventType') == 'push'
|
||||
)
|
||||
|
||||
# TODO: move to controller
|
||||
array = ExpandableRecordArray.create
|
||||
|
@ -57,16 +59,16 @@ Repo = Model.extend
|
|||
content: Ember.A([])
|
||||
|
||||
array.load(builds)
|
||||
|
||||
id = @get('id')
|
||||
array.observe(@store.all('build'), (build) -> build.get('isLoaded') && build.get('repo.id') == id && !build.get('isPullRequest') )
|
||||
array.observe(builds)
|
||||
|
||||
array
|
||||
).property()
|
||||
|
||||
pullRequests: (->
|
||||
id = @get('id')
|
||||
builds = @store.find('build', event_type: 'pull_request', repository_id: id)
|
||||
builds = @store.filter('build', event_type: 'pull_request', repository_id: id, (b) ->
|
||||
b.get('repo.id') == id && b.get('eventType') == 'pull_request'
|
||||
)
|
||||
|
||||
# TODO: move to controller
|
||||
array = ExpandableRecordArray.create
|
||||
|
@ -76,7 +78,7 @@ Repo = Model.extend
|
|||
array.load(builds)
|
||||
|
||||
id = @get('id')
|
||||
array.observe(@store.all('build'), (build) -> build.get('isLoaded') && build.get('repo.id') == id && build.get('isPullRequest') )
|
||||
array.observe(builds)
|
||||
|
||||
array
|
||||
).property()
|
||||
|
|
|
@ -26,8 +26,7 @@ ExpandableRecordArray = Ember.ArrayProxy.extend
|
|||
@set 'isLoading', false
|
||||
@set 'isLoaded', true
|
||||
|
||||
observe: (collection, filterWith) ->
|
||||
@set 'filterWith', filterWith
|
||||
observe: (collection) ->
|
||||
collection.addArrayObserver this,
|
||||
willChange: 'observedArrayWillChange'
|
||||
didChange: 'observedArraydidChange'
|
||||
|
@ -42,7 +41,7 @@ ExpandableRecordArray = Ember.ArrayProxy.extend
|
|||
for object in addedObjects
|
||||
# TODO: I'm not sure why deleted objects get here, but I'll just filter them
|
||||
# for now
|
||||
if !object.get('isDeleted') && @get('filterWith').call(this, object)
|
||||
if !object.get('isDeleted')
|
||||
@pushObject(object) unless @contains(object)
|
||||
|
||||
pushObject: (record) ->
|
||||
|
|
Loading…
Reference in New Issue
Block a user