Merge branch 'ps-ember-update' of github.com:travis-ci/travis-web into ps-ember-update

This commit is contained in:
Sven Fuchs 2013-02-28 21:38:08 +01:00
commit b1b16f9039
21 changed files with 83 additions and 93 deletions

View File

@ -4,6 +4,7 @@ rvm:
before_script: before_script:
- "gem install travis-artifacts" - "gem install travis-artifacts"
- "bundle exec rakep" - "bundle exec rakep"
- "phantomjs --version"
env: env:
global: global:

View File

@ -1,15 +1,18 @@
Travis.BuildsController = Em.ArrayController.extend Travis.BuildsController = Em.ArrayController.extend
# sortAscending: false sortAscending: false
sortProperties: ['number']
needs: ['repo'] needs: ['repo']
repoBinding: 'controllers.repo.repo' repoBinding: 'controllers.repo.repo'
buildsBinding: 'controllers.repo.builds' contentBinding: 'controllers.repo.builds'
tabBinding: 'controllers.repo.tab' tabBinding: 'controllers.repo.tab'
isLoadedBinding: 'content.isLoaded'
showMore: -> showMore: ->
id = @get('repo.id') id = @get('repo.id')
number = @get('builds.lastObject.number') number = @get('lastObject.number')
@get('builds').load Travis.Build.olderThanNumber(id, number, @get('tab')) @get('content').load Travis.Build.olderThanNumber(id, number, @get('tab'))
displayShowMoreButton: (-> displayShowMoreButton: (->
@get('tab') != 'branches' @get('tab') != 'branches'

View File

@ -3,8 +3,14 @@ require 'travis/limited_array'
Travis.ReposController = Ember.ArrayController.extend Travis.ReposController = Ember.ArrayController.extend
defaultTab: 'recent' defaultTab: 'recent'
isLoadedBinding: 'content.isLoaded' isLoadedBinding: 'content.isLoaded'
needs: ['currentUser'] needs: ['currentUser', 'repo']
currentUserBinding: 'controllers.currentUser' currentUserBinding: 'controllers.currentUser'
selectedRepo: (->
# we need to observe also repo.content here, because we use
# ObjectProxy in repo controller
# TODO: get rid of ObjectProxy there
@get('controllers.repo.repo.content') || @get('controllers.repo.repo')
).property('controllers.repo.repo', 'controllers.repo.repo.content')
init: -> init: ->
Ember.run.later(@updateTimes.bind(this), Travis.INTERVALS.updateTimes) Ember.run.later(@updateTimes.bind(this), Travis.INTERVALS.updateTimes)

View File

@ -2,7 +2,7 @@ require 'travis/location'
require 'travis/line_number_parser' require 'travis/line_number_parser'
Ember.Router.reopen Ember.Router.reopen
location: (if testMode? then Ember.HashLocation.create() else Travis.Location.create()) location: (if testMode? then Ember.NoneLocation.create() else Travis.Location.create())
handleURL: (url) -> handleURL: (url) ->
url = url.replace(/#.*?$/, '') url = url.replace(/#.*?$/, '')

View File

@ -1,4 +1,4 @@
{{#if builds.isLoaded}} {{#if content.isLoaded}}
<table id="builds" class="list"> <table id="builds" class="list">
<thead> <thead>
<tr> <tr>
@ -21,7 +21,7 @@
</thead> </thead>
<tbody> <tbody>
{{#each build in builds}} {{#each build in controller}}
{{#view Travis.BuildsItemView contextBinding="build"}} {{#view Travis.BuildsItemView contextBinding="build"}}
<td class="number"> <td class="number">
<span class="status"></span> <span class="status"></span>

View File

@ -16,25 +16,27 @@
<dd class="duration" {{bindAttr title="startedAt"}}>{{formatDuration build.duration}}</dd> <dd class="duration" {{bindAttr title="startedAt"}}>{{formatDuration build.duration}}</dd>
</div> </div>
<div class="right"> {{#if commit}}
<dt>{{t builds.commit}}</dt> <div class="right">
<dd class="commit"><a href="{{unbound urlGithubCommit}}">{{formatCommit build.commit}}</a></dd> <dt>{{t builds.commit}}</dt>
{{#if commit.compareUrl}} <dd class="commit"><a {{bindAttr href="urlGithubCommit"}}>{{formatCommit build.commit}}</a></dd>
<dt>{{t builds.compare}}</dt> {{#if commit.compareUrl}}
<dd class="compare"><a href="{{unbound commit.compareUrl}}">{{pathFrom build.commit.compareUrl}}</a></dd> <dt>{{t builds.compare}}</dt>
{{/if}} <dd class="compare"><a {{bindAttr href="commit.compareUrl"}}>{{pathFrom build.commit.compareUrl}}</a></dd>
{{#if commit.authorName}} {{/if}}
<dt>{{t builds.author}}</dt> {{#if commit.authorName}}
<dd class="author"><a href="{{unbound urlAuthor}}">{{build.commit.authorName}}</a></dd> <dt>{{t builds.author}}</dt>
{{/if}} <dd class="author"><a {{bindAttr href="urlAuthor"}}>{{build.commit.authorName}}</a></dd>
{{#if commit.committerName}} {{/if}}
<dt>{{t builds.committer}}</dt> {{#if commit.committerName}}
<dd class="committer"><a href="{{unbound urlCommitter}}">{{build.commit.committerName}}</a></dd> <dt>{{t builds.committer}}</dt>
{{/if}} <dd class="committer"><a {{bindAttr href="urlCommitter"}}>{{build.commit.committerName}}</a></dd>
</div> {{/if}}
</div>
{{/if}}
<dt>{{t builds.message}}</dt> <dt>{{t builds.message}}</dt>
<dd class="message">{{{formatMessage build.commit.message}}}</dd> <dd class="message">{{formatMessage build.commit.message}}</dd>
{{#unless isMatrix}} {{#unless isMatrix}}
<dt>{{t builds.config}}</dt> <dt>{{t builds.config}}</dt>

View File

@ -5,7 +5,7 @@
{{#if repo.isLoaded}} {{#if repo.isLoaded}}
{{#with repo}} {{#with repo}}
<h3> <h3>
<a {{bindAttr href="urlGithub"}}>{{slug}}</a> <a {{bindAttr href="controller.urlGithub"}}>{{slug}}</a>
</h3> </h3>
<p class="description">{{description}}</p> <p class="description">{{description}}</p>

View File

@ -13,7 +13,9 @@
repoBinding: 'content' repoBinding: 'content'
classNames: ['repo'] classNames: ['repo']
classNameBindings: ['color', 'selected'] classNameBindings: ['color', 'selected']
selectedBinding: 'repo.selected' selected: (->
@get('content') == @get('controller.selectedRepo')
).property('controller.selectedRepo')
color: (-> color: (->
Travis.Helpers.colorForState(@get('repo.lastBuildState')) Travis.Helpers.colorForState(@get('repo.lastBuildState'))

View File

@ -1,13 +1,13 @@
describe 'on the "build" state', -> describe 'on the "build" state', ->
beforeEach -> beforeEach ->
app 'travis-ci/travis-core/builds/1' app '/travis-ci/travis-core/builds/1'
console.log 'wait for repos'
waitFor reposRendered waitFor reposRendered
runs -> runs ->
console.log 'wait for build'
waitFor buildRendered waitFor buildRendered
afterEach ->
window.history.pushState({}, null, '/spec.html')
it 'displays the expected stuff', -> it 'displays the expected stuff', ->
listsRepos [ listsRepos [
{ slug: 'travis-ci/travis-hub', build: { number: 4, url: '/travis-ci/travis-hub/builds/4', duration: '1 min', finishedAt: '-' } } { slug: 'travis-ci/travis-hub', build: { number: 4, url: '/travis-ci/travis-hub/builds/4', duration: '1 min', finishedAt: '-' } }
@ -52,14 +52,11 @@ describe 'on the "build" state', ->
describe 'on the "current" state', -> describe 'on the "current" state', ->
beforeEach -> beforeEach ->
app 'travis-ci/travis-core' app '/travis-ci/travis-core'
waitFor reposRendered waitFor reposRendered
runs -> runs ->
waitFor buildRendered waitFor buildRendered
afterEach ->
window.history.pushState({}, null, '/spec.html')
it 'correctly updates values on pusher build:started event', -> it 'correctly updates values on pusher build:started event', ->
payload = payload =
build: build:
@ -72,8 +69,8 @@ describe 'on the "current" state', ->
finished_at: '2012-07-02T00:02:55Z' finished_at: '2012-07-02T00:02:55Z'
event_type: 'push' event_type: 'push'
result: 1 result: 1
commit_message: 'commit message 3' message: 'commit message 3'
commit: '1234567' commit: 'foo1234'
state: 'started' state: 'started'
repository: repository:
id: 1 id: 1
@ -81,10 +78,19 @@ describe 'on the "current" state', ->
last_build_id: 11 last_build_id: 11
Em.run -> Em.run ->
Travis.app.receive 'build:started', payload Travis.receive 'build:started', payload
waits(100)
runs -> runs ->
displaysSummaryBuildLink '/travis-ci/travis-core/builds/11', '3' displaysSummaryBuildLink '/travis-ci/travis-core/builds/11', '3'
displaysSummary
type: 'build'
id: 11
repo: 'travis-ci/travis-core'
commit: 'foo1234'
branch: 'master'
compare: '0123456..1234567'
finishedAt: 'less than a minute ago'
duration: '55 sec'
message: 'commit message 3'

View File

@ -1,11 +1,8 @@
describe 'on the "builds" state', -> describe 'on the "builds" state', ->
beforeEach -> beforeEach ->
app 'travis-ci/travis-core/builds' app '/travis-ci/travis-core/builds'
waitFor buildsRendered waitFor buildsRendered
afterEach ->
window.history.pushState({}, null, '/spec.html')
it 'displays the expected stuff', -> it 'displays the expected stuff', ->
listsRepos [ listsRepos [
{ slug: 'travis-ci/travis-hub', build: { number: 4, url: '/travis-ci/travis-hub/builds/4', duration: '1 min', finishedAt: '-' } } { slug: 'travis-ci/travis-hub', build: { number: 4, url: '/travis-ci/travis-hub/builds/4', duration: '1 min', finishedAt: '-' } }

View File

@ -3,9 +3,6 @@ describe 'on the "current" state', ->
app 'travis-ci/travis-core' app 'travis-ci/travis-core'
waitFor buildRendered waitFor buildRendered
afterEach ->
window.history.pushState({}, null, '/spec.html')
it 'displays the expected stuff', -> it 'displays the expected stuff', ->
listsRepos [ listsRepos [
{ slug: 'travis-ci/travis-hub', build: { number: 4, url: '/travis-ci/travis-hub/builds/4', duration: '1 min', finishedAt: '-' } } { slug: 'travis-ci/travis-hub', build: { number: 4, url: '/travis-ci/travis-hub/builds/4', duration: '1 min', finishedAt: '-' } }

View File

@ -1,7 +1,4 @@
describe 'events', -> describe 'events', ->
afterEach ->
window.history.pushState({}, null, '/spec.html')
describe 'an event adding a repository', -> describe 'an event adding a repository', ->
beforeEach -> beforeEach ->
app 'travis-ci/travis-core' app 'travis-ci/travis-core'

View File

@ -3,9 +3,6 @@ describe 'on the "index" state', ->
app 'travis-ci/travis-core' app 'travis-ci/travis-core'
waitFor buildRendered waitFor buildRendered
afterEach ->
window.history.pushState({}, null, '/spec.html')
it 'displays the expected stuff', -> it 'displays the expected stuff', ->
listsRepos [ listsRepos [
{ slug: 'travis-ci/travis-hub', build: { number: 4, url: '/travis-ci/travis-hub/builds/4', duration: '1 min', finishedAt: '-' } } { slug: 'travis-ci/travis-hub', build: { number: 4, url: '/travis-ci/travis-hub/builds/4', duration: '1 min', finishedAt: '-' } }

View File

@ -5,9 +5,6 @@ describe 'on the "job" state', ->
runs -> runs ->
waitFor hasText('#tab_build', 'Build #1') waitFor hasText('#tab_build', 'Build #1')
afterEach ->
window.history.pushState({}, null, '/spec.html')
it 'displays the expected stuff', -> it 'displays the expected stuff', ->
listsRepos [ listsRepos [
{ slug: 'travis-ci/travis-hub', build: { number: 4, url: '/travis-ci/travis-hub/builds/4', duration: '1 min', finishedAt: '-' } } { slug: 'travis-ci/travis-hub', build: { number: 4, url: '/travis-ci/travis-hub/builds/4', duration: '1 min', finishedAt: '-' } }

View File

@ -5,9 +5,6 @@ describe 'the sidebar', ->
runs -> runs ->
waitFor hasText('#tab_build', 'Build #1') waitFor hasText('#tab_build', 'Build #1')
afterEach ->
window.history.pushState({}, null, '/spec.html')
it 'displays the expected stuff', -> it 'displays the expected stuff', ->
listsQueues [ listsQueues [
{ name: 'common', item: { number: '5.1', repo: 'travis-ci/travis-core' } } { name: 'common', item: { number: '5.1', repo: 'travis-ci/travis-core' } }

View File

@ -1,30 +1,14 @@
minispade.require 'app' minispade.require 'app'
@reset = ->
Em.run ->
if Travis.app
if Travis.app.store
Travis.app.store.destroy()
Travis.app.destroy()
delete Travis.app
delete Travis.store
waits(500) # TODO not sure what we need to wait for here
$('#application').remove()
$('body').append( $('<div id="application"></div>') )
@app = (url) -> @app = (url) ->
reset() # TODO: this should wait till app is initialized, not some
Em.run -> # arbitrary amount of time
Travis.run(rootElement: $('#application')) waits(50)
waitFor -> Travis.app runs ->
# TODO: so much waiting here, I'm sure we can minimize this Travis.reset()
runs ->
url = "/#{url}" if url && !url.match(/^\//) url = "/#{url}" unless url.match /^\//
Travis.app.router.route(url) Travis.__container__.lookup('router:main').handleURL(url)
waits 500
runs ->
foo = 'bar'
_Date = Date _Date = Date
@Date = (date) -> @Date = (date) ->

View File

@ -7,9 +7,9 @@ repos = [
] ]
builds = [ builds = [
{ id: 1, repository_id: '1', commit_id: 1, job_ids: [1, 2, 3], number: 1, pull_request: false, config: { rvm: ['rbx', '1.9.3', 'jruby'] }, duration: 30, started_at: '2012-07-02T00:00:00Z', finished_at: '2012-07-02T00:00:30Z', result: 0 }, { id: 1, repository_id: '1', commit_id: 1, job_ids: [1, 2, 3], number: 1, pull_request: false, config: { rvm: ['rbx', '1.9.3', 'jruby'] }, duration: 30, started_at: '2012-07-02T00:00:00Z', finished_at: '2012-07-02T00:00:30Z', state: 'passed' },
{ id: 2, repository_id: '1', commit_id: 2, job_ids: [4], number: 2, pull_request: false, config: { rvm: ['rbx'] } }, { id: 2, repository_id: '1', commit_id: 2, job_ids: [4], number: 2, pull_request: false, config: { rvm: ['rbx'] } },
{ id: 3, repository_id: '2', commit_id: 3, job_ids: [5], number: 3, pull_request: false, config: { rvm: ['rbx'] }, duration: 30, started_at: '2012-07-02T00:01:00Z', finished_at: '2012-07-01T00:01:30Z', result: 1 }, { id: 3, repository_id: '2', commit_id: 3, job_ids: [5], number: 3, pull_request: false, config: { rvm: ['rbx'] }, duration: 30, started_at: '2012-07-02T00:01:00Z', finished_at: '2012-07-01T00:01:30Z', state: 'failed' },
{ id: 4, repository_id: '3', commit_id: 4, job_ids: [6], number: 4, pull_request: false, config: { rvm: ['rbx'] }, started_at: '2012-07-02T00:02:00Z' }, { id: 4, repository_id: '3', commit_id: 4, job_ids: [6], number: 4, pull_request: false, config: { rvm: ['rbx'] }, started_at: '2012-07-02T00:02:00Z' },
] ]
@ -21,11 +21,11 @@ commits = [
] ]
jobs = [ jobs = [
{ id: 1, repository_id: 1, build_id: 1, commit_id: 1, log_id: 1, number: '1.1', config: { rvm: 'rbx' }, duration: 30, started_at: '2012-07-02T00:00:00Z', finished_at: '2012-07-02T00:00:30Z', result: 0 } { id: 1, repository_id: 1, build_id: 1, commit_id: 1, log_id: 1, number: '1.1', config: { rvm: 'rbx' }, duration: 30, started_at: '2012-07-02T00:00:00Z', finished_at: '2012-07-02T00:00:30Z', state: 'passed' }
{ id: 2, repository_id: 1, build_id: 1, commit_id: 1, log_id: 2, number: '1.2', config: { rvm: '1.9.3' }, duration: 40, started_at: '2012-07-02T00:00:00Z', finished_at: '2012-07-02T00:00:40Z', result: 1 } { id: 2, repository_id: 1, build_id: 1, commit_id: 1, log_id: 2, number: '1.2', config: { rvm: '1.9.3' }, duration: 40, started_at: '2012-07-02T00:00:00Z', finished_at: '2012-07-02T00:00:40Z', state: 'failed' }
{ id: 3, repository_id: 1, build_id: 1, commit_id: 1, log_id: 3, number: '1.3', config: { rvm: 'jruby' }, allow_failure: true } { id: 3, repository_id: 1, build_id: 1, commit_id: 1, log_id: 3, number: '1.3', config: { rvm: 'jruby' }, allow_failure: true }
{ id: 4, repository_id: 1, build_id: 2, commit_id: 2, log_id: 4, number: '2.1', config: { rvm: 'rbx' } } { id: 4, repository_id: 1, build_id: 2, commit_id: 2, log_id: 4, number: '2.1', config: { rvm: 'rbx' } }
{ id: 5, repository_id: 2, build_id: 3, commit_id: 3, log_id: 5, number: '3.1', config: { rvm: 'rbx' }, duration: 30, started_at: '2012-07-02T00:01:00Z', finished_at: '2012-07-02T00:01:30Z', result: 1 } { id: 5, repository_id: 2, build_id: 3, commit_id: 3, log_id: 5, number: '3.1', config: { rvm: 'rbx' }, duration: 30, started_at: '2012-07-02T00:01:00Z', finished_at: '2012-07-02T00:01:30Z', state: 'failed' }
{ id: 6, repository_id: 3, build_id: 4, commit_id: 4, log_id: 6, number: '4.1', config: { rvm: 'rbx' }, started_at: '2012-07-02T00:02:00Z' } { id: 6, repository_id: 3, build_id: 4, commit_id: 4, log_id: 6, number: '4.1', config: { rvm: 'rbx' }, started_at: '2012-07-02T00:02:00Z' }
{ id: 7, repository_id: 1, build_id: 5, commit_id: 5, log_id: 7, number: '5.1', config: { rvm: 'rbx' }, state: 'created', queue: 'builds.common' } { id: 7, repository_id: 1, build_id: 5, commit_id: 5, log_id: 7, number: '5.1', config: { rvm: 'rbx' }, state: 'created', queue: 'builds.common' }
{ id: 8, repository_id: 1, build_id: 5, commit_id: 5, log_id: 8, number: '5.2', config: { rvm: 'rbx' }, state: 'created', queue: 'builds.common' } { id: 8, repository_id: 1, build_id: 5, commit_id: 5, log_id: 8, number: '5.2', config: { rvm: 'rbx' }, state: 'created', queue: 'builds.common' }

View File

@ -32,6 +32,12 @@ window.Travis = Em.Application.extend(Ember.Evented,
@set('auth', Travis.Auth.create(app: this, endpoint: Travis.config.api_endpoint)) @set('auth', Travis.Auth.create(app: this, endpoint: Travis.config.api_endpoint))
reset: ->
@store.destroy()
@setup()
@_super.apply(this, arguments);
storeAfterSignInPath: (path) -> storeAfterSignInPath: (path) ->
@get('auth').storeAfterSignInPath(path) @get('auth').storeAfterSignInPath(path)

View File

@ -14,6 +14,7 @@ html, body
height: 100% height: 100%
.application .application
position: relative
width: 100% width: 100%
min-height: 100% min-height: 100%
margin-top: 40px margin-top: 40px
@ -23,7 +24,7 @@ html, body
#top #top
position: absolute position: absolute
top: 0 top: -40px
left: 0 left: 0
width: 100% width: 100%
height: 40px height: 40px

View File

@ -13,6 +13,7 @@
<script> <script>
window.testMode = true; window.testMode = true;
minispade.require('travis') minispade.require('travis')
Travis.advanceReadiness()
</script> </script>
<script src="/scripts/specs.js"></script> <script src="/scripts/specs.js"></script>

View File

@ -1,9 +1,5 @@
#HTMLReporter { #HTMLReporter {
position: absolute; height: 400px;
top: 10px;
right: 10px;
width: 50%;
height: 150px;
z-index: 1000; z-index: 1000;
background-color: white; background-color: white;
overflow: auto; overflow: auto;