initial attempt to trigger the first build of a repo through api
This commit is contained in:
parent
d15d35a9ff
commit
5b361a49ef
|
@ -1,5 +1,21 @@
|
||||||
`import Ember from 'ember'`
|
`import Ember from 'ember'`
|
||||||
|
`import Ajax from 'travis/utils/ajax'`
|
||||||
|
`import config from 'travis/config/environment'`
|
||||||
|
|
||||||
NoBuildsComponent = Ember.Component.extend()
|
NoBuildsComponent = Ember.Component.extend
|
||||||
|
|
||||||
|
actions:
|
||||||
|
triggerBuild: () ->
|
||||||
|
@set('isLoading', true)
|
||||||
|
apiEndpoint = config.apiEndpoint
|
||||||
|
$.ajax(apiEndpoint + "/v3/repo/#{@get('repo.repo.id')}/requests", {
|
||||||
|
headers: {
|
||||||
|
Authorization: 'token ' + @get('repo.auth')
|
||||||
|
},
|
||||||
|
type: "POST"
|
||||||
|
}).then( =>
|
||||||
|
@set('isLoading', false)
|
||||||
|
# @transitionToRoute('repo')
|
||||||
|
);
|
||||||
|
|
||||||
`export default NoBuildsComponent`
|
`export default NoBuildsComponent`
|
||||||
|
|
|
@ -22,14 +22,21 @@ Controller = Ember.ArrayController.extend
|
||||||
).property('tab', 'lastObject.number')
|
).property('tab', 'lastObject.number')
|
||||||
|
|
||||||
displayPullRequests: (->
|
displayPullRequests: (->
|
||||||
if Ember.isEmpty(@get('repo.builds.content'))
|
if @get('tab') == 'pull_requests'
|
||||||
return false # if there is no build there is no PR
|
if Ember.isEmpty(@get('repo.pullRequests.content'))
|
||||||
else if Ember.isEmpty(@get('repo.pullRequests.content'))
|
true
|
||||||
return true
|
|
||||||
else
|
else
|
||||||
return false
|
false
|
||||||
|
else
|
||||||
|
false
|
||||||
|
).property('tab', 'repo.builds', 'repo.pullRequests')
|
||||||
|
|
||||||
).property('tab', 'lastObject.number')
|
things: (->
|
||||||
|
return {
|
||||||
|
repo: @get('repo'),
|
||||||
|
auth: @auth.token()
|
||||||
|
}
|
||||||
|
).property('repo')
|
||||||
|
|
||||||
olderThanNumber: (id, number, type) ->
|
olderThanNumber: (id, number, type) ->
|
||||||
options = { repository_id: id, after_number: number }
|
options = { repository_id: id, after_number: number }
|
||||||
|
@ -38,4 +45,5 @@ Controller = Ember.ArrayController.extend
|
||||||
|
|
||||||
@store.find('build', options)
|
@store.find('build', options)
|
||||||
|
|
||||||
|
|
||||||
`export default Controller`
|
`export default Controller`
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
{{#each controller as |build|}}
|
{{#each controller as |build|}}
|
||||||
{{builds-item build=build}}
|
{{builds-item build=build}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{no-builds isPR=displayPullRequests}}
|
{{no-builds repo=things isPR=displayPullRequests}}
|
||||||
{{/each}}
|
{{/each}}
|
||||||
{{#if displayShowMoreButton}}
|
{{#if displayShowMoreButton}}
|
||||||
<p>
|
<p>
|
||||||
|
|
|
@ -65,7 +65,11 @@
|
||||||
{{#unless isPR}}
|
{{#unless isPR}}
|
||||||
<h2 class="page-title">No builds for this repository</h2>
|
<h2 class="page-title">No builds for this repository</h2>
|
||||||
<p class="page-notice">Want to start testing this project on Travis CI?</p>
|
<p class="page-notice">Want to start testing this project on Travis CI?</p>
|
||||||
<a href="http://docs.travis-ci.com/user/getting-started/" class="button button--green">Read the Docs on Getting Started</a>
|
{{#if isLoading}}
|
||||||
|
{{loading-indicator}}
|
||||||
|
{{else}}
|
||||||
|
<a href="#" class="button button--green" {{action "triggerBuild"}}>Trigger the first build</a>
|
||||||
|
{{/if}}
|
||||||
{{else}}
|
{{else}}
|
||||||
<h2 class="page-title">No Pull Request builds for this Repositiory</h2>
|
<h2 class="page-title">No Pull Request builds for this Repositiory</h2>
|
||||||
{{/unless}}
|
{{/unless}}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user