Merge branch 'master' of github.com:travis-ci/travis-web

This commit is contained in:
Sven Fuchs 2013-04-14 14:12:55 +02:00
commit bd70c5ff97
25 changed files with 202 additions and 51 deletions

View File

@ -20,7 +20,7 @@ before_script:
- "bundle exec rakep"
- "phantomjs --version"
after_script:
- "test $TEST_SUITE = \"ruby\" && travis-artifacts upload --target-path assets/$TRAVIS_BRANCH --path public/scripts:scripts --path public/styles:styles || true"
- "test $TEST_SUITE = \"ruby\" && test $TRAVIS_PULL_REQUEST = \"false\" && travis-artifacts upload --target-path assets/$TRAVIS_BRANCH --path public/scripts:scripts --path public/styles:styles || true"
notifications:
irc: "irc.freenode.org#travis"

View File

@ -1,5 +1,8 @@
Travis.reopen
SidebarController: Em.ArrayController.extend
needs: ['runningJobs']
jobsBinding: 'controllers.runningJobs'
init: ->
@_super.apply this, arguments
@tickables = []

View File

@ -91,3 +91,6 @@ require 'config/emoij'
_escape: (text) ->
text.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace />/g, '&gt;'
configKeys: (config) ->
return [] unless config
$.intersect($.keys(config), Travis.CONFIG_KEYS)

View File

@ -1,6 +1,6 @@
require 'travis/model'
@Travis.Branch = Travis.Model.extend Travis.Helpers,
@Travis.Branch = Travis.Model.extend
repoId: DS.attr('number', key: 'repository_id')
commitId: DS.attr('number')
state: DS.attr('string')

View File

@ -45,12 +45,21 @@ require 'travis/model'
@get('jobs').filter (data) -> data.get('allowFailure')
).property('jobs.@each.allowFailure')
rawConfigKeys: (->
keys = Travis.Helpers.configKeys(@get('config'))
@get('jobs').forEach (job) ->
Travis.Helpers.configKeys(job.get('config')).forEach (key) ->
keys.pushObject key unless keys.contains key
keys
).property('config', 'jobs.@each.config')
configKeys: (->
return [] unless config = @get('config')
keys = $.intersect($.keys(config), Travis.CONFIG_KEYS)
keys = @get('rawConfigKeys')
headers = (I18n.t(key) for key in ['build.job', 'build.duration', 'build.finished_at'])
$.map(headers.concat(keys), (key) -> return $.camelize(key))
).property('config')
).property('rawConfigKeys.length')
canCancel: (->
@get('state') == 'created' # TODO

View File

@ -61,14 +61,14 @@ require 'travis/model'
).property('log.workerName')
configValues: (->
config = @get('config')
buildConfig = @get('build.config')
if config && buildConfig
keys = $.intersect($.keys(buildConfig), Travis.CONFIG_KEYS)
config = @get('config')
keys = @get('build.rawConfigKeys')
if config && keys
keys.map (key) -> config[key]
else
[]
).property('config')
).property('config', 'build.rawConfigKeys.length')
canCancel: (->
@get('state') == 'created' || @get('state') == 'queued' # TODO

View File

@ -64,7 +64,7 @@ Travis.Log.Request = Em.Object.extend
endpoint = Travis.config.api_endpoint
staging = if endpoint.match(/-staging/) then '-staging' else ''
host = endpoint.replace(/^https?:\/\//, '').split('.').slice(-2).join('.')
"https://s3.amazonaws.com/archive#{staging}.#{host}#{path}/jobs/#{@id}/log.txt"
"https://s3.amazonaws.com/archive#{staging}.#{host}/jobs/#{@get('id')}/log.txt"
isJson: (xhr, body) ->
# Firefox can't see the Content-Type header on the xhr response due to the wrong

View File

@ -26,7 +26,7 @@
<dt>{{t builds.commit}}</dt>
<dd class="commit"><a {{bindAttr href="urlGithubCommit"}}>{{formatCommit build.commit}}</a></dd>
{{#if build.pullRequest}}
<dt>{{t builds.pullRequest}}</dt>
<dt>{{t builds.pull_request}}</dt>
<dd class="pull_request"><a {{bindAttr href="build.commit.compareUrl"}}>#{{build.pullRequestNumber}} {{build.pullRequestTitle}}</a></dd>
{{else}}
{{#if commit.compareUrl}}

View File

@ -1,5 +1,3 @@
<h4>Running Jobs ({{view.jobs.length}})</h4>
<ul class="groups">
{{#each group in view.groups}}
{{view view.GroupView groupBinding="group"}}

View File

@ -5,9 +5,11 @@
<ul class="jobs">
{{#each job in sortedJobs}}
<li class="job">
{{#linkTo "job" job.repoData job}}
#{{job.number}}
{{/linkTo}}
{{#if job.repoData.slug}}
{{#linkTo "job" job.repoData job}}
#{{job.number}}
{{/linkTo}}
{{/if}}
</li>
{{/each}}
</ul>

View File

@ -23,9 +23,14 @@
<div class="right">
<dt>{{t jobs.commit}}</dt>
<dd class="commit"><a {{bindAttr href="urlGithubCommit"}}>{{formatCommit commit}}</a></dd>
{{#if commit.compareUrl}}
<dt>{{t jobs.compare}}</dt>
<dd class="compare"><a {{bindAttr href="commit.compareUrl"}}>{{pathFrom commit.compareUrl}}</a></dd>
{{#if job.build.pullRequest}}
<dt>{{t builds.pull_request}}</dt>
<dd class="pull_request"><a {{bindAttr href="job.build.commit.compareUrl"}}>#{{job.build.pullRequestNumber}} {{job.build.pullRequestTitle}}</a></dd>
{{else}}
{{#if commit.compareUrl}}
<dt>{{t jobs.compare}}</dt>
<dd class="compare"><a {{bindAttr href="commit.compareUrl"}}>{{pathFrom commit.compareUrl}}</a></dd>
{{/if}}
{{/if}}
{{#if commit.authorName}}
<dt>{{t jobs.author}}</dt>

View File

@ -9,8 +9,19 @@
</div>
{{view view.DecksView}}
{{view view.WorkersView}}
{{view view.RunningJobsView}}
<ul class="tabs">
<li id="tab_jobs" {{bindAttr class="view.classJobs"}}>
<h5><a href="#" {{action activate "jobs" target="view"}}>{{t layouts.application.running}} ({{jobs.length}})</a></h5>
</li>
<li id="tab_workers" {{bindAttr class="view.classWorkers"}}>
<h5><a href="#" {{action activate "workers" target="view"}}>{{t layouts.application.workers}}</a></h5>
</li>
</ul>
<div class="pane">
{{outlet pane}}
</div>
{{view view.QueuesView}}
{{view view.LinksView}}

View File

@ -1,8 +1,5 @@
{{#view Travis.WorkersView}}
<h4>
{{t workers}}
<a id="toggle-workers" {{action toggleWorkers target="view"}}></a>
</h4>
<a id="toggle-workers" {{action toggleWorkers target="view"}}></a>
<ul id="workers">
{{#each group in controller.groups}}
{{#view Travis.WorkersListView}}

View File

@ -64,7 +64,6 @@ Travis.reopen
currentUserBinding: 'controller.currentUser'
closeMenu: ->
console.log 'closeMenu'
$('.menu').removeClass('display')
menu: ->
@ -129,7 +128,7 @@ Travis.reopen
canRequeueBuild: (->
@get('displayRequeueBuild') && @get('hasPermission')
).property('displayRequireBuild', 'hasPermissions')
).property('displayRequireBuild', 'hasPermission')
displayRequeueJob: (->
@get('isJobTab') && @get('job.isFinished')
@ -137,7 +136,7 @@ Travis.reopen
canRequeueJob: (->
@get('displayRequeueJob') && @get('hasPermission')
).property('displayRequeueJob', 'hasPermissions')
).property('displayRequeueJob', 'hasPermission')
showDownloadLog: (->
@get('jobIdForLog')

View File

@ -2,6 +2,29 @@
SidebarView: Travis.View.extend
templateName: 'layouts/sidebar'
didInsertElement: ->
@_super.apply this, arguments
@activate('jobs')
activate: (name) ->
console.log
return if @get('activeTab') == name
@set('activeTab', name)
@connectOutlet 'pane', Travis.SidebarView["#{name.capitalize()}View"].create(controller: @get('controller'))
classQueues: (->
'active' if @get('activeTab') == 'queues'
).property('activeTab')
classWorkers: (->
'active' if @get('activeTab') == 'workers'
).property('activeTab')
classJobs: (->
'active' if @get('activeTab') == 'jobs'
).property('activeTab')
DecksView: Em.View.extend
templateName: "sponsors/decks"
init: ->
@ -14,28 +37,12 @@
@_super.apply this, arguments
@set 'controller', @get('controller').container.lookup('controller:links')
WorkersView: Em.View.extend
templateName: 'workers/list'
init: ->
@_super.apply this, arguments
@set 'controller', @get('controller').container.lookup('controller:workers')
QueuesView: Em.View.extend
templateName: 'queues/list'
init: ->
@_super.apply this, arguments
@set 'controller', @get('controller').container.lookup('controller:queues')
RunningJobsView: Em.View.extend
templateName: 'jobs/running'
elementId: 'running-jobs'
init: ->
@_super.apply this, arguments
@set 'controller', @get('controller').container.lookup('controller:runningJobs')
groupsBinding: 'controller.sortedGroups'
jobsBinding: 'controller'
GroupView: Em.View.extend
templateName: 'jobs/running/group'
tagName: 'li'
@ -74,3 +81,20 @@
QueueItemView: Travis.View.extend
tagName: 'li'
Travis.SidebarView.reopenClass
WorkersView: Em.View.extend
templateName: 'workers/list'
init: ->
@_super.apply this, arguments
@set 'controller', @get('controller').container.lookup('controller:workers')
JobsView: Em.View.extend
templateName: 'jobs/running'
elementId: 'running-jobs'
init: ->
@_super.apply this, arguments
@set 'controller', @get('controller').container.lookup('controller:runningJobs')
groupsBinding: 'controller.sortedGroups'
jobsBinding: 'controller'

View File

@ -121,7 +121,10 @@ describe 'events', ->
describe 'an event adding a worker', ->
beforeEach ->
app ''
waitFor workersRendered
waitFor sidebarTabsRendered
runs ->
$('#right #tab_workers a').trigger('click')
waitFor workersRendered
it 'adds a worker to the workers list', ->
payload =
@ -155,7 +158,10 @@ describe 'events', ->
describe 'an event updating a worker', ->
beforeEach ->
app '/travis-ci/travis-core'
waitFor workersRendered
waitFor sidebarTabsRendered
runs ->
$('#right #tab_workers a').trigger('click')
waitFor workersRendered
it 'does not update repository if it\'s already in the store', ->
payload =

View File

@ -13,3 +13,5 @@
@workersRendered = notEmpty('.worker')
@logRendered = notEmpty('#log p')
@appRendered = -> $('.ember-view.application').length
@sidebarTabsRendered = notEmpty('#right #tab_workers a')

View File

@ -30,3 +30,17 @@ describe 'Travis.Build', ->
waits 50
runs ->
expect( record.get('incomplete') ).toBeFalsy()
describe 'configKeys', ->
it 'takes into account all the jobs when getting config keys', ->
buildConfig = { rvm: ['1.9.3', '2.0.0'] }
store.load Travis.Build, { id: '1', job_ids: ['1', '2', '3'], config: buildConfig }, { id: '1' }
store.load Travis.Job, { id: '1', config: { rvm: '1.9.3', env: 'FOO=foo' } }, { id: '1' }
store.load Travis.Job, { id: '2', config: { rvm: '2.0.0', gemfile: 'Gemfile.1' } }, { id: '2' }
store.load Travis.Job, { id: '3', config: { rvm: '1.9.3', jdk: 'OpenJDK' } }, { id: '3' }
build = store.find(Travis.Build, '1')
expect( build.get('rawConfigKeys') ).toEqual( ['rvm', 'env', 'gemfile', 'jdk' ] )
expect( build.get('configKeys') ).toEqual( [ 'Job', 'Duration', 'Finished', 'Rvm', 'Env', 'Gemfile', 'Jdk' ] )

View File

@ -8,6 +8,23 @@ describe 'Travis.Job', ->
afterEach ->
store.destroy()
describe 'configKeys', ->
it 'takes into account the keys of other jobs', ->
buildConfig = { rvm: ['1.9.3', '2.0.0'] }
store.load Travis.Build, { id: '1', job_ids: ['1', '2', '3'], config: buildConfig }, { id: '1' }
store.load Travis.Job, { id: '1', config: { rvm: '1.9.3', env: 'FOO=foo' }, build_id: '1' }, { id: '1' }
store.load Travis.Job, { id: '2', config: { rvm: '2.0.0', gemfile: 'Gemfile.1' }, build_id: '1' }, { id: '2' }
store.load Travis.Job, { id: '3', config: { rvm: '1.9.3', jdk: 'OpenJDK' }, build_id: '1' }, { id: '3' }
job1 = store.find(Travis.Job, '1')
job2 = store.find(Travis.Job, '2')
job3 = store.find(Travis.Job, '3')
expect( job1.get('configValues') ).toEqual( [ '1.9.3', 'FOO=foo', undefined, undefined ] )
expect( job2.get('configValues') ).toEqual( [ '2.0.0', undefined, 'Gemfile.1', undefined ] )
expect( job3.get('configValues') ).toEqual( [ '1.9.3', undefined, undefined, 'OpenJDK' ] )
describe 'incomplete attributes', ->
beforeEach ->
store.loadIncomplete Travis.Job, { id: 1, state: 'started' }

View File

@ -0,0 +1,6 @@
describe 'Travis.Log.Request', ->
it 'constructs s3 url for log', ->
Travis.config.api_endpoint = 'api.travis-ci.org'
request = Travis.Log.Request.create(id: 10)
s3Url = "https://s3.amazonaws.com/archive.travis-ci.org/jobs/10/log.txt"
expect( request.s3Url() ).toEqual(s3Url)

File diff suppressed because one or more lines are too long

View File

@ -11,6 +11,7 @@
.box
margin-top: 25px
margin-left: -3px
padding: 15px
border: 1px solid $color-border-normal
background-color: $color-bg-sidebar-box
@ -56,5 +57,6 @@
white-space: nowrap
text-overflow: ellipsis
display: inline-block
display: -moz-inline-stack
.group a
cursor: pointer

View File

@ -1,12 +1,51 @@
@import "_mixins/all"
#right
#queues
margin-top: 0
.tabs
margin-top: 28px
height: 25px
border-bottom-color: $color-border-light
li
display: inline-block
height: 24px
margin-right: 5px
background-color: $color-bg-right
border: 1px solid $color-bg-right
border-bottom-color: $color-border-light
white-space: nowrap
cursor: pointer
@include border-top-radius(4px)
font-size: 10px
&:hover
background-color: $color-bg-tab-hover
border-color: $color-border-light
border-bottom-color: $color-bg-tab-active
.active
background-color: $color-bg-tab-active
border-color: $color-border-light
border-bottom-color: $color-bg-tab-active
h5
margin: 0
font-size: $font-size-small
font-weight: normal
line-height: 26px
a
display: block
padding: 0 10px
.pane
position: relative
#toggle-workers
position: absolute
top: -30px
right: 5px
display: inline-block
float: right
width: 10px
height: 10px
cursor: pointer
@ -17,6 +56,9 @@
#workers li ul
display: none
#queues
margin-top: 0
#workers li,
#queues ul li
overflow: hidden

View File

@ -4,6 +4,7 @@
.sponsors
&.top
height: 140px
margin-left: -3px
li
overflow: hidden

View File

@ -61,3 +61,13 @@
#main
.tab
margin: 30px 0 0 12px
#right
.tabs
margin-left: -3px
.active
background-color: $color-bg-right
border-bottom-color: $color-bg-right
h5
font-weight: bold