query for more branches if first call is not last page
This commit is contained in:
parent
3306e5a7e6
commit
8f61f49826
|
@ -8,12 +8,21 @@ Route = TravisRoute.extend
|
||||||
apiEndpoint = config.apiEndpoint
|
apiEndpoint = config.apiEndpoint
|
||||||
repoId = @modelFor('repo').get('id')
|
repoId = @modelFor('repo').get('id')
|
||||||
|
|
||||||
|
allTheBranches = Ember.ArrayProxy.create()
|
||||||
|
|
||||||
options = {}
|
options = {}
|
||||||
if @get('auth.signedIn')
|
if @get('auth.signedIn')
|
||||||
options.headers = { Authorization: "token #{@auth.token()}" }
|
options.headers = { Authorization: "token #{@auth.token()}" }
|
||||||
|
|
||||||
$.ajax("#{apiEndpoint}/v3/repo/#{repoId}/branches?include=build.commit&limit=100", options).then (response) ->
|
$.ajax("#{apiEndpoint}/v3/repo/#{repoId}/branches?include=build.commit&limit=100", options).then (response) ->
|
||||||
response.branches
|
allTheBranches = response.branches
|
||||||
|
unless response['@pagination'].is_last
|
||||||
|
$.ajax("#{apiEndpoint}/v3/repo/#{repoId}/branches?include=build.commit&limit=100&offset=1", options).then (response) ->
|
||||||
|
allTheBranches = allTheBranches.concat(response.branches)
|
||||||
|
allTheBranches
|
||||||
|
else
|
||||||
|
allTheBranches
|
||||||
|
|
||||||
|
|
||||||
activate: () ->
|
activate: () ->
|
||||||
$('.tab.tabs--main li').removeClass('active')
|
$('.tab.tabs--main li').removeClass('active')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user