Slightly better implementation of showAll for jobs in queues
This commit is contained in:
parent
9c8f93f705
commit
d1633e796a
|
@ -20,7 +20,7 @@
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
{{#if queue.isMore}}
|
{{#if queue.isMore}}
|
||||||
<a {{action loadMoreJobs this.queue target="view"}} class="show-more-jobs">
|
<a {{action showAll this.queue target="view"}} class="show-more-jobs">
|
||||||
{{queue.leftLength}} more jobs - show all
|
{{queue.leftLength}} more jobs - show all
|
||||||
</a>
|
</a>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
|
@ -38,12 +38,9 @@
|
||||||
templateName: 'queues/list'
|
templateName: 'queues/list'
|
||||||
controller: Em.ArrayController.create()
|
controller: Em.ArrayController.create()
|
||||||
|
|
||||||
loadMoreJobs: (event) ->
|
showAll: (event) ->
|
||||||
queue = event.context
|
queue = event.context
|
||||||
# nasty hack to not have to implement showAll for
|
queue.showAll()
|
||||||
# limitedArray
|
|
||||||
# TODO: implement it properly later
|
|
||||||
queue.incrementProperty('limit', 1000000)
|
|
||||||
|
|
||||||
didInsertElement: ->
|
didInsertElement: ->
|
||||||
queues = for queue in Travis.QUEUES
|
queues = for queue in Travis.QUEUES
|
||||||
|
|
|
@ -6,9 +6,12 @@ Travis.LimitedArray = Em.ArrayProxy.extend
|
||||||
@_super.apply this, arguments
|
@_super.apply this, arguments
|
||||||
|
|
||||||
arrangedContent: (->
|
arrangedContent: (->
|
||||||
if content = @get('content')
|
content = @get('content')
|
||||||
|
if @get('disable')
|
||||||
|
content
|
||||||
|
else if content
|
||||||
content.slice(0, @get('limit'))
|
content.slice(0, @get('limit'))
|
||||||
).property('content', 'limit')
|
).property('content', 'limit', 'disable')
|
||||||
|
|
||||||
totalLength: (->
|
totalLength: (->
|
||||||
@get('content.length')
|
@get('content.length')
|
||||||
|
@ -27,9 +30,15 @@ Travis.LimitedArray = Em.ArrayProxy.extend
|
||||||
@get('leftLength') > 0
|
@get('leftLength') > 0
|
||||||
).property('leftLength')
|
).property('leftLength')
|
||||||
|
|
||||||
|
showAll: ->
|
||||||
|
@set 'limit', 1000000000
|
||||||
|
@set 'disable', true
|
||||||
|
|
||||||
contentArrayDidChange: (array, index, removedCount, addedCount) ->
|
contentArrayDidChange: (array, index, removedCount, addedCount) ->
|
||||||
@_super.apply this, arguments
|
@_super.apply this, arguments
|
||||||
|
|
||||||
|
return if @get('disable')
|
||||||
|
|
||||||
limit = @get 'limit'
|
limit = @get 'limit'
|
||||||
arrangedContent = @get('arrangedContent')
|
arrangedContent = @get('arrangedContent')
|
||||||
length = arrangedContent.get 'length'
|
length = arrangedContent.get 'length'
|
||||||
|
|
Loading…
Reference in New Issue
Block a user