This commit is contained in:
Sven Fuchs 2012-07-17 11:54:06 +02:00
parent 431deae0c6
commit 00cfe41cc5
17 changed files with 1471 additions and 1462 deletions

View File

@ -1,6 +1,5 @@
Travis.HomeController = Travis.Controller.extend Travis.HomeController = Travis.Controller.extend
name: 'home' name: 'home'
bindings: []
init: -> init: ->
@_super('top', 'repositories', 'repository', 'sidebar') @_super('top', 'repositories', 'repository', 'sidebar')

View File

@ -49,7 +49,6 @@ Travis.RepositoryController = Travis.Controller.extend
).property('params.id') ).property('params.id')
connectTab: (tab) -> connectTab: (tab) ->
unless tab == @get('tab')
@set('tab', tab) @set('tab', tab)
name = if tab == 'current' then 'build' else tab name = if tab == 'current' then 'build' else tab
@connectOutlet(outletName: 'pane', controller: this, viewClass: Travis["#{$.camelize(name)}View"]) @connectOutlet(outletName: 'pane', controller: this, viewClass: Travis["#{$.camelize(name)}View"])

View File

@ -1,6 +1,6 @@
<div id="repository" {{bindAttr class="view.class"}}>
{{#if view.repository.isLoaded}} {{#if view.repository.isLoaded}}
{{#with view.repository}} {{#with view.repository}}
<div id="repository">
<h3> <h3>
<a {{bindAttr href="view.urlGithub"}}>{{slug}}</a> <a {{bindAttr href="view.urlGithub"}}>{{slug}}</a>
</h3> </h3>
@ -14,15 +14,13 @@
</ul> </ul>
{{view Travis.TabsView}} {{view Travis.TabsView}}
</div> {{/with}}
{{else}}
<span>Loading</span>
{{/if}}
<div class="tab"> <div class="tab">
{{outlet pane}} {{outlet pane}}
</div> </div>
{{/with}}
{{else}}
<div id="repository" class="loading">
<span>Loading</span>
</div> </div>
{{/if}}

View File

@ -1,5 +1,5 @@
<h4>{{t workers}}</h4> <h4>{{t workers}}</h4>
<ul> <ul id="workers">
{{#each group in controller.groups}} {{#each group in controller.groups}}
<li class="group"> <li class="group">
<h5>{{group.firstObject.host}}</h5> <h5>{{group.firstObject.host}}</h5>

View File

@ -46,6 +46,10 @@
repositoryBinding: 'controller.repository' repositoryBinding: 'controller.repository'
class: (->
'loading' unless @getPath('repository.isLoaded')
).property('repository.isLoaded')
urlGithub: (-> urlGithub: (->
Travis.Urls.githubRepository(@getPath('repository.slug')) Travis.Urls.githubRepository(@getPath('repository.slug'))
).property('repository.slug'), ).property('repository.slug'),

View File

@ -93,6 +93,14 @@ for repository in repositories
responseTime: responseTime responseTime: responseTime
responseText: { builds: $.select(builds, (build) -> repository.build_ids.indexOf(build.id) != -1) } responseText: { builds: $.select(builds, (build) -> repository.build_ids.indexOf(build.id) != -1) }
$.mockjax
url: '/builds'
data: { repository_id: repository.id, event_type: 'push', orderBy: 'number DESC' }
responseTime: responseTime
responseText:
builds: (builds[id - 1] for id in repository.build_ids)
commits: (commits[builds[id - 1].commit_id - 1] for id in repository.build_ids)
for build in builds for build in builds
$.mockjax $.mockjax
url: '/builds/' + build.id url: '/builds/' + build.id
@ -102,14 +110,11 @@ for build in builds
commit: commits[build.commit_id - 1] commit: commits[build.commit_id - 1]
jobs: (jobs[id - 1] for id in build.job_ids) jobs: (jobs[id - 1] for id in build.job_ids)
for repository in repositories # $.mockjax
$.mockjax # url: '/jobs'
url: '/builds' # data: { ids: build.job_ids.join(',') }
data: { repository_id: repository.id, event_type: 'push', orderBy: 'number DESC' } # responseTime: responseTime
responseTime: responseTime # responseText: { jobs: $.select(jobs, (job) -> build.job_ids.indexOf(job.id) != -1) }
responseText:
builds: (builds[id - 1] for id in repository.build_ids)
commits: (commits[builds[id - 1].commit_id - 1] for id in repository.build_ids)
for job in jobs for job in jobs
$.mockjax $.mockjax
@ -119,6 +124,12 @@ for job in jobs
job: job, job: job,
commit: commits[job.commit_id - 1] commit: commits[job.commit_id - 1]
$.mockjax
url: '/jobs'
responseTime: responseTime
responseText:
jobs: $.select(jobs, (job) -> job.state == 'created')
for data in branches for data in branches
$.mockjax $.mockjax
url: '/branches' url: '/branches'
@ -138,12 +149,6 @@ $.mockjax
responseTime: responseTime responseTime: responseTime
responseText: { workers: workers } responseText: { workers: workers }
$.mockjax
url: '/jobs'
responseTime: responseTime
responseText:
jobs: $.select(jobs, (job) -> job.state == 'created')
$.mockjax $.mockjax
url: '/profile/hooks' url: '/profile/hooks'
responseTime: responseTime responseTime: responseTime

View File

@ -1,6 +1,7 @@
# 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'
# waitFor reposRendered
# waitFor buildRendered # waitFor buildRendered
# #
# it 'displays the expected stuff', -> # it 'displays the expected stuff', ->

View File

@ -78,23 +78,33 @@ describe 'events', ->
# row: 3 # row: 3
# item: { id: 10, number: '1.4', repo: 'travis-ci/travis-core', finishedAt: 'less than a minute ago', duration: '55 sec', rvm: 'jruby' } # item: { id: 10, number: '1.4', repo: 'travis-ci/travis-core', finishedAt: 'less than a minute ago', duration: '55 sec', rvm: 'jruby' }
describe 'an event adding a job', -> # it 'adds a job to the jobs queue', ->
# Em.run ->
# Travis.app.receive 'job:created',
# job:
# id: 10
# repository_id: 1
# number: '1.4'
# queue: 'common'
# listsQueuedJob
# name: 'common'
# row: 3
# item: { number: '1.4', repo: 'travis-ci/travis-core' }
describe 'an event adding a worker', ->
beforeEach -> beforeEach ->
app '' app ''
waitFor jobsRendered waitFor workersRendered
waitFor queuesRendered
it 'adds a job to the jobs queue', -> it 'adds a worker to the workers list', ->
Em.run -> Em.run ->
Travis.app.receive 'job:created', Travis.app.receive 'worker:added',
job: worker:
id: 10 id: 10
repository_id: 1
number: '1.4'
queue: 'common'
listsQueuedJob listsWorker
name: 'common' group: 'workers.travis-ci.org'
row: 3 row: 3
item: { number: '1.4', repo: 'travis-ci/travis-core' } item: { 'ruby-3' }

View File

@ -0,0 +1,11 @@
# describe 'the sidebar', ->
# beforeEach ->
# app '!/travis-ci/travis-core/jobs/1'
# waitFor jobRendered
# waitFor hasText('#tab_build', 'Build #1')
#
# it 'displays the expected stuff', ->
# listsQueues [
# { name: 'common', item: { number: '5.1', repo: 'travis-ci/travis-core' } }
# { name: 'common', item: { number: '5.2', repo: 'travis-ci/travis-core' } }
# ]

View File

@ -10,4 +10,5 @@
@jobRendered = notEmpty('#summary .number') @jobRendered = notEmpty('#summary .number')
@jobsRendered = notEmpty('#jobs .number') @jobsRendered = notEmpty('#jobs .number')
@queuesRendered = notEmpty('#queue_common li') @queuesRendered = notEmpty('#queue_common li')
@workersRendered = notEmpty('.worker')

View File

@ -44,24 +44,38 @@
listsItems('repo', items) listsItems('repo', items)
@listsRepo = (data) -> @listsRepo = (data) ->
repo = data.repo
row = $('#repositories li')[data.row - 1] row = $('#repositories li')[data.row - 1]
repo = data.item
expect($('a.current', row).attr('href')).toEqual "#!/#{repo.slug}" expect($('a.current', row).attr('href')).toEqual "#!/#{repo.slug}"
expect($('a.last_build', row).attr('href')).toEqual repo.build.url expect($('a.last_build', row).attr('href')).toEqual repo.build.url
expect($('.duration', row).text()).toEqual repo.build.duration expect($('.duration', row).text()).toEqual repo.build.duration
expect($('.finished_at', row).text()).toEqual repo.build.finishedAt expect($('.finished_at', row).text()).toEqual repo.build.finishedAt
@listsBuilds = (builds) ->
listsItems('build', builds)
@listsBuild = (data) ->
row = $('#builds tbody tr')[data.row - 1]
build = data.item
expect($('.number a', row).attr('href')).toEqual "#!/#{build.slug}/builds/#{build.id}"
expect($('.number a', row).text()).toEqual build.number
expect($('.message', row).text()).toEqual build.message
expect($('.duration', row).text()).toEqual build.duration
expect($('.finished_at', row).text()).toEqual build.finishedAt
expect($(row).attr('class')).toEqual build.color
@listsJobs = (data) -> @listsJobs = (data) ->
table = $(data.table) table = $(data.table)
headers = ($(element).text() for element in $("thead th", table)) headers = ($(element).text() for element in $("thead th", table))
expect(headers).toEqual(data.headers) expect(headers).toEqual(data.headers)
$.each data.jobs, (row, job) -> listsJob(table: data.table, row: row + 1, job: job) $.each data.jobs, (row, job) -> listsJob(table: data.table, row: row + 1, item: job)
@listsJob = (data) -> @listsJob = (data) ->
row = $('tbody tr', data.table)[data.row - 1] row = $('tbody tr', data.table)[data.row - 1]
job = data.job job = data.item
element = $(row) element = $(row)
expect(element.attr('class')).toEqual job.color expect(element.attr('class')).toEqual job.color
@ -81,20 +95,6 @@
element = $("td:nth-child(6)", row) element = $("td:nth-child(6)", row)
expect(element.text()).toEqual job.rvm expect(element.text()).toEqual job.rvm
@listsBuilds = (builds) ->
listsItems('build', jobs)
@listsBuild = (data) ->
row = $('#builds tbody tr')[data.row - 1]
build = data.item
expect($('.number a', row).attr('href')).toEqual "#!/#{build.slug}/builds/#{build.id}"
expect($('.number a', row).text()).toEqual build.number
expect($('.message', row).text()).toEqual build.message
expect($('.duration', row).text()).toEqual build.duration
expect($('.finished_at', row).text()).toEqual build.finishedAt
expect($(row).attr('class')).toEqual build.color
@listsQueuedJobs = (jobs) -> @listsQueuedJobs = (jobs) ->
listsItems('queuedJob', jobs) listsItems('queuedJob', jobs)
@ -106,8 +106,7 @@
expect(text).toContain "##{job.number}" expect(text).toContain "##{job.number}"
@listsItems = (type, items) -> @listsItems = (type, items) ->
console.log items $.each items, (row, item) =>
$.each items, (item, row) ->
this["lists#{$.camelize(type)}"](item: item, row: row + 1) this["lists#{$.camelize(type)}"](item: item, row: row + 1)

View File

@ -4007,6 +4007,7 @@ DS.RESTAdapter = DS.Adapter.extend({
data: { ids: ids }, data: { ids: ids },
success: function(json) { success: function(json) {
this.sideload(store, type, json, plural); this.sideload(store, type, json, plural);
console.log(type, json, plural)
store.loadMany(type, json[plural]); store.loadMany(type, json[plural]);
} }
}); });

View File

@ -77,6 +77,9 @@ pre::-webkit-scrollbar-thumb:horizontal
color: #aaa color: #aaa
background: inline-image('spinner.gif') no-repeat right 4px background: inline-image('spinner.gif') no-repeat right 4px
.loading
display: none
.emoji .emoji
vertical-align: middle vertical-align: middle
width: 20px width: 20px

File diff suppressed because one or more lines are too long

View File

@ -16,29 +16,24 @@
(function() { (function() {
describe('events', function() { describe('events', function() {
return describe('an event adding a job', function() { return describe('an event adding a worker', function() {
beforeEach(function() { beforeEach(function() {
app(''); app('');
waitFor(jobsRendered); return waitFor(workersRendered);
return waitFor(queuesRendered);
}); });
return it('adds a job to the jobs queue', function() { return it('adds a worker to the workers list', function() {
Em.run(function() { Em.run(function() {
return Travis.app.receive('job:created', { return Travis.app.receive('worker:added', {
job: { worker: {
id: 10, id: 10
repository_id: 1,
number: '1.4',
queue: 'common'
} }
}); });
}); });
return listsQueuedJob({ return listsWorker({
name: 'common', group: 'workers.travis-ci.org',
row: 3, row: 3,
item: { item: {
number: '1.4', 'ruby-3': 'ruby-3'
repo: 'travis-ci/travis-core'
} }
}); });
}); });
@ -55,6 +50,11 @@
}).call(this);
(function() {
}).call(this); }).call(this);
(function() { (function() {
var _Date; var _Date;
@ -117,6 +117,8 @@
this.queuesRendered = notEmpty('#queue_common li'); this.queuesRendered = notEmpty('#queue_common li');
this.workersRendered = notEmpty('.worker');
}).call(this); }).call(this);
(function() { (function() {
@ -180,14 +182,30 @@
this.listsRepo = function(data) { this.listsRepo = function(data) {
var repo, row; var repo, row;
repo = data.repo;
row = $('#repositories li')[data.row - 1]; row = $('#repositories li')[data.row - 1];
repo = data.item;
expect($('a.current', row).attr('href')).toEqual("#!/" + repo.slug); expect($('a.current', row).attr('href')).toEqual("#!/" + repo.slug);
expect($('a.last_build', row).attr('href')).toEqual(repo.build.url); expect($('a.last_build', row).attr('href')).toEqual(repo.build.url);
expect($('.duration', row).text()).toEqual(repo.build.duration); expect($('.duration', row).text()).toEqual(repo.build.duration);
return expect($('.finished_at', row).text()).toEqual(repo.build.finishedAt); return expect($('.finished_at', row).text()).toEqual(repo.build.finishedAt);
}; };
this.listsBuilds = function(builds) {
return listsItems('build', builds);
};
this.listsBuild = function(data) {
var build, row;
row = $('#builds tbody tr')[data.row - 1];
build = data.item;
expect($('.number a', row).attr('href')).toEqual("#!/" + build.slug + "/builds/" + build.id);
expect($('.number a', row).text()).toEqual(build.number);
expect($('.message', row).text()).toEqual(build.message);
expect($('.duration', row).text()).toEqual(build.duration);
expect($('.finished_at', row).text()).toEqual(build.finishedAt);
return expect($(row).attr('class')).toEqual(build.color);
};
this.listsJobs = function(data) { this.listsJobs = function(data) {
var element, headers, table; var element, headers, table;
table = $(data.table); table = $(data.table);
@ -206,7 +224,7 @@
return listsJob({ return listsJob({
table: data.table, table: data.table,
row: row + 1, row: row + 1,
job: job item: job
}); });
}); });
}; };
@ -214,7 +232,7 @@
this.listsJob = function(data) { this.listsJob = function(data) {
var element, job, row; var element, job, row;
row = $('tbody tr', data.table)[data.row - 1]; row = $('tbody tr', data.table)[data.row - 1];
job = data.job; job = data.item;
element = $(row); element = $(row);
expect(element.attr('class')).toEqual(job.color); expect(element.attr('class')).toEqual(job.color);
element = $("td.number", row); element = $("td.number", row);
@ -229,22 +247,6 @@
return expect(element.text()).toEqual(job.rvm); return expect(element.text()).toEqual(job.rvm);
}; };
this.listsBuilds = function(builds) {
return listsItems('build', jobs);
};
this.listsBuild = function(data) {
var build, row;
row = $('#builds tbody tr')[data.row - 1];
build = data.item;
expect($('.number a', row).attr('href')).toEqual("#!/" + build.slug + "/builds/" + build.id);
expect($('.number a', row).text()).toEqual(build.number);
expect($('.message', row).text()).toEqual(build.message);
expect($('.duration', row).text()).toEqual(build.duration);
expect($('.finished_at', row).text()).toEqual(build.finishedAt);
return expect($(row).attr('class')).toEqual(build.color);
};
this.listsQueuedJobs = function(jobs) { this.listsQueuedJobs = function(jobs) {
return listsItems('queuedJob', jobs); return listsItems('queuedJob', jobs);
}; };
@ -259,9 +261,9 @@
}; };
this.listsItems = function(type, items) { this.listsItems = function(type, items) {
console.log(items); var _this = this;
return $.each(items, function(item, row) { return $.each(items, function(row, item) {
return this["lists" + ($.camelize(type))]({ return _this["lists" + ($.camelize(type))]({
item: item, item: item,
row: row + 1 row: row + 1
}); });

File diff suppressed because it is too large Load Diff

View File

@ -106,15 +106,19 @@ pre::-webkit-scrollbar-thumb:horizontal {
color: #aaaaaa; color: #aaaaaa;
background: url('data:image/gif;base64,R0lGODlhEAAIAPMHAP///+vr66CgoN7e3rW1tYuLi/X19Wt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sKCJwLkH6F2Er0dRZJvWfZaYBUNrnAKoAkEdvF6cjrSNoyGe7QaT8QxIpISyI5UiACH5BAAKAP8ALAAAAAAQAAgAAAQvcIkpALoInL0F+Y41ZUdhHh4oCqRZoB8RIqPmwirN2mcqr61ebFYrnSQUC4b3igAAIfkEAAoA/wAsAAAAABAACAAABDAQyCmqACijQpYnQEMQDWZxSgqKpFmhajiWyEmkyjq7ApzLrdqr8wHSThOKBaMpRAAAIfkEAAoA/wAsAAAAABAACAAABDMQyEmBuGKxxBl4y/IADmEKzKAmwMItpEmg6sC6CVye6dq+MV7tBtzNNp1PaGQUVJ6YTAQAIfkEAAoA/wAsAAAAABAACAAABC8QyEmrBSknQJYnxiAGgCIqnKKCQUuaA0qoCuuWZ7oa7pvPO4PQgNFwPAvCZQmIAAAh+QQACgD/ACwAAAAAEAAIAAAEKRDISau1LGlmhg+A5wGJyAUoOKADaRqpyrremYZzWRs8D/QGQGZzKQIiACH5BAAKAP8ALAAAAAAQAAgAAAMhCLrc/iyMGcCcQNLAueVD1o3eAIpk90koZ7wvABvyDEEJADs=') no-repeat right 4px;
} }
/* line 80, /Volumes/Users/sven/Development/projects/travis/travis-ember/assets/stylesheets/application.sass */ /* line 80, /Volumes/Users/sven/Development/projects/travis/travis-ember/assets/stylesheets/application.sass */
.loading .loading {
display: none;
}
/* line 83, /Volumes/Users/sven/Development/projects/travis/travis-ember/assets/stylesheets/application.sass */
.emoji { .emoji {
vertical-align: middle; vertical-align: middle;
width: 20px; width: 20px;
height: 20px; height: 20px;
} }
/* line 85, /Volumes/Users/sven/Development/projects/travis/travis-ember/assets/stylesheets/application.sass */ /* line 88, /Volumes/Users/sven/Development/projects/travis/travis-ember/assets/stylesheets/application.sass */
.help { .help {
display: inline-block; display: inline-block;
height: 19px; height: 19px;
@ -125,7 +129,7 @@ pre::-webkit-scrollbar-thumb:horizontal {
cursor: pointer; cursor: pointer;
} }
/* line 94, /Volumes/Users/sven/Development/projects/travis/travis-ember/assets/stylesheets/application.sass */ /* line 97, /Volumes/Users/sven/Development/projects/travis/travis-ember/assets/stylesheets/application.sass */
.context_help_caption { .context_help_caption {
text-align: left; text-align: left;
font-size: 16px; font-size: 16px;
@ -134,27 +138,27 @@ pre::-webkit-scrollbar-thumb:horizontal {
border-bottom: 1px solid #cccccc; border-bottom: 1px solid #cccccc;
} }
/* line 101, /Volumes/Users/sven/Development/projects/travis/travis-ember/assets/stylesheets/application.sass */ /* line 104, /Volumes/Users/sven/Development/projects/travis/travis-ember/assets/stylesheets/application.sass */
.context_help { .context_help {
display: none; display: none;
} }
/* line 104, /Volumes/Users/sven/Development/projects/travis/travis-ember/assets/stylesheets/application.sass */ /* line 107, /Volumes/Users/sven/Development/projects/travis/travis-ember/assets/stylesheets/application.sass */
.context_help_body { .context_help_body {
font-size: 1em; font-size: 1em;
line-height: 1.429; line-height: 1.429;
margin: 1.429em 0; margin: 1.429em 0;
} }
/* line 110, /Volumes/Users/sven/Development/projects/travis/travis-ember/assets/stylesheets/application.sass */ /* line 113, /Volumes/Users/sven/Development/projects/travis/travis-ember/assets/stylesheets/application.sass */
#facebox .content { #facebox .content {
display: block !important; display: block !important;
} }
/* line 112, /Volumes/Users/sven/Development/projects/travis/travis-ember/assets/stylesheets/application.sass */ /* line 115, /Volumes/Users/sven/Development/projects/travis/travis-ember/assets/stylesheets/application.sass */
#facebox .close { #facebox .close {
display: none; display: none;
} }
/* line 114, /Volumes/Users/sven/Development/projects/travis/travis-ember/assets/stylesheets/application.sass */ /* line 117, /Volumes/Users/sven/Development/projects/travis/travis-ember/assets/stylesheets/application.sass */
#facebox pre::-webkit-scrollbar { #facebox pre::-webkit-scrollbar {
height: 0; height: 0;
width: 0; width: 0;