commit current status
This commit is contained in:
parent
8d5e7d5b87
commit
dda2051d57
17
app/controllers/branches.coffee
Normal file
17
app/controllers/branches.coffee
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
`import Ember from 'ember'`
|
||||||
|
`import { gravatarImage } from 'travis/utils/urls'`
|
||||||
|
`import GithubUrlPropertievs from 'travis/mixins/github-url-properties'`
|
||||||
|
|
||||||
|
BranchesController = Ember.Controller.extend
|
||||||
|
|
||||||
|
actions:
|
||||||
|
tiggerBuild: (branch) ->
|
||||||
|
console.log('trigger build')
|
||||||
|
|
||||||
|
viewAllBuilds: (branch) ->
|
||||||
|
console.log('view all builds')
|
||||||
|
# updateFilter: (value) ->
|
||||||
|
# @set('_lastFilterValue', value)
|
||||||
|
# Ember.run.throttle this, @updateFilter, [], 200, false
|
||||||
|
|
||||||
|
`export default BranchesController`
|
|
@ -41,10 +41,6 @@ Controller = Ember.ArrayController.extend
|
||||||
false
|
false
|
||||||
).property('tab', 'repo.builds', 'repo.branches')
|
).property('tab', 'repo.builds', 'repo.branches')
|
||||||
|
|
||||||
displayNewBranchRows: (->
|
|
||||||
true if @get('tab') == 'branches'
|
|
||||||
).property('tab', 'repo.builds', 'repo.branches')
|
|
||||||
|
|
||||||
noticeData: (->
|
noticeData: (->
|
||||||
return {
|
return {
|
||||||
repo: @get('repo'),
|
repo: @get('repo'),
|
||||||
|
|
|
@ -46,11 +46,11 @@ Router.map ->
|
||||||
@route 'search', path: '/search/:phrase'
|
@route 'search', path: '/search/:phrase'
|
||||||
@resource 'repo', path: '/:owner/:name', ->
|
@resource 'repo', path: '/:owner/:name', ->
|
||||||
@route 'index', path: '/'
|
@route 'index', path: '/'
|
||||||
|
@resource 'branches', path: '/branches'
|
||||||
@resource 'build', path: '/builds/:build_id'
|
@resource 'build', path: '/builds/:build_id'
|
||||||
@resource 'job', path: '/jobs/:job_id'
|
@resource 'job', path: '/jobs/:job_id'
|
||||||
@resource 'builds', path: '/builds'
|
@resource 'builds', path: '/builds'
|
||||||
@resource 'pullRequests', path: '/pull_requests'
|
@resource 'pullRequests', path: '/pull_requests'
|
||||||
@resource 'branches', path: '/branches'
|
|
||||||
@resource 'requests', path: '/requests'
|
@resource 'requests', path: '/requests'
|
||||||
@resource 'caches', path: '/caches' if config.endpoints.caches
|
@resource 'caches', path: '/caches' if config.endpoints.caches
|
||||||
@resource 'request', path: '/requests/:request_id'
|
@resource 'request', path: '/requests/:request_id'
|
||||||
|
|
|
@ -1,5 +1,25 @@
|
||||||
`import AbstractBuildsRoute from 'travis/routes/abstract-builds'`
|
`import Ember from 'ember'`
|
||||||
|
`import TravisRoute from 'travis/routes/basic'`
|
||||||
|
`import config from 'travis/config/environment'`
|
||||||
|
|
||||||
|
Route = TravisRoute.extend
|
||||||
|
|
||||||
|
model: (params) ->
|
||||||
|
apiEndpoint = config.apiEndpoint
|
||||||
|
repoId = @modelFor('repo').get('id')
|
||||||
|
|
||||||
|
options = {}
|
||||||
|
if @get('auth.signedIn')
|
||||||
|
options.headers = { Authorization: "token #{@auth.token()}" }
|
||||||
|
|
||||||
|
$.ajax("#{apiEndpoint}/repos/#{repoId}/branch/master", options).then (response) ->
|
||||||
|
|
||||||
|
console.log(response)
|
||||||
|
# response.repositories.sortBy('last_build.finished_at').filter( (repo) ->
|
||||||
|
# repo.last_build
|
||||||
|
# ).map( (repo) ->
|
||||||
|
# Ember.Object.create(repo)
|
||||||
|
# )
|
||||||
|
|
||||||
Route = AbstractBuildsRoute.extend(contentType: 'branches')
|
|
||||||
|
|
||||||
`export default Route`
|
`export default Route`
|
||||||
|
|
|
@ -9,29 +9,6 @@ Route = TravisRoute.extend
|
||||||
|
|
||||||
repo.fetchSettings().then (settings) ->
|
repo.fetchSettings().then (settings) ->
|
||||||
|
|
||||||
console.log(settings)
|
|
||||||
repo.set('settings', settings)
|
repo.set('settings', settings)
|
||||||
|
|
||||||
# return {
|
|
||||||
|
|
||||||
# settings: (->
|
|
||||||
# $.ajax('https://api.travis-ci.org/v3/repos/#{repo.id}/settings', {
|
|
||||||
# headers: {
|
|
||||||
# Authorization: 'token ' + @auth.token()
|
|
||||||
# }
|
|
||||||
# }).then (response) ->
|
|
||||||
# console.log(response);
|
|
||||||
# return response
|
|
||||||
# )
|
|
||||||
# env_vars: (->
|
|
||||||
# $.ajax('/settings/env_vars?repository_id={repo.id}', {
|
|
||||||
# headers: {
|
|
||||||
# Authorization: 'token ' + @auth.token()
|
|
||||||
# }
|
|
||||||
# }).then (response) ->
|
|
||||||
# console.log(response);
|
|
||||||
# return response
|
|
||||||
# )
|
|
||||||
# }
|
|
||||||
|
|
||||||
`export default Route`
|
`export default Route`
|
||||||
|
|
25
app/templates/branches.hbs
Normal file
25
app/templates/branches.hbs
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<h2>Default Branch</h2>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<h2>Active Branches</h2>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<h2>Inactive Branches</h2>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
|
||||||
|
{{!-- {{#if content.isLoaded}} --}}
|
||||||
|
|
||||||
|
{{branch-row build=build}}
|
||||||
|
|
||||||
|
|
||||||
|
{{!-- {{else}}
|
||||||
|
{{loading-indicator}}
|
||||||
|
{{/if}} --}}
|
|
@ -1,13 +1,7 @@
|
||||||
{{#if content.isLoaded}}
|
{{#if content.isLoaded}}
|
||||||
<ul>
|
<ul>
|
||||||
{{#each controller as |build|}}
|
{{#each controller as |build|}}
|
||||||
|
{{builds-item build=build}}
|
||||||
{{#if displayNewBranchRows}}
|
|
||||||
{{branch-row build=build}}
|
|
||||||
{{else}}
|
|
||||||
{{builds-item build=build}}
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
{{else}}
|
{{else}}
|
||||||
{{no-builds repo=noticeData isPR=displayPullRequests isBranch=displayBranches}}
|
{{no-builds repo=noticeData isPR=displayPullRequests isBranch=displayBranches}}
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
|
12
tests/unit/controllers/branches-test.coffee
Normal file
12
tests/unit/controllers/branches-test.coffee
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
`import { test, moduleFor } from 'ember-qunit'`
|
||||||
|
|
||||||
|
moduleFor 'controller:branches', {
|
||||||
|
# Specify the other units that are required for this test.
|
||||||
|
# needs: ['controller:foo']
|
||||||
|
}
|
||||||
|
|
||||||
|
# Replace this with your real tests.
|
||||||
|
test 'it exists', (assert) ->
|
||||||
|
controller = @subject()
|
||||||
|
assert.ok controller
|
||||||
|
|
Loading…
Reference in New Issue
Block a user