Fix queues lists

This commit is contained in:
Piotr Sarnacki 2013-02-19 22:01:58 +01:00
parent 4cdd4df515
commit 86670def14
5 changed files with 23 additions and 16 deletions

View File

@ -7,7 +7,16 @@ Travis.reopen
tick: ->
tickable.tick() for tickable in @tickables
QueuesController: Em.ArrayController.extend()
QueuesController: Em.ArrayController.extend
init: ->
@_super.apply this, arguments
queues = for queue in Travis.QUEUES
Travis.LimitedArray.create
content: Travis.Job.queued(queue.name), limit: 20
id: "queue_#{queue.name}"
name: queue.display
@set 'content', queues
WorkersController: Em.ArrayController.extend
groups: (->

View File

@ -452,10 +452,14 @@ Travis.RepoRoute = Ember.Route.extend
@render 'repo'
setupController: (controller, model) ->
# TODO: if repo is just a data hash with id and slug load it
# as incomplete record
model = Travis.Repo.find(model.id) if model && !model.get
controller.set('repo', model)
serialize: (repo) ->
[owner, name] = repo.get('slug').split('/')
slug = if repo.get then repo.get('slug') else repo.slug
[owner, name] = slug.split('/')
{ owner: owner, name: name }
deserialize: (params) ->

View File

@ -6,12 +6,12 @@
{{#each job in queue}}
{{#view Travis.QueueItemView jobBinding="job"}}
{{#if job.repoSlug}}
<a {{action showJob job.repoData job target="Travis.app.router" href=true}}>
{{#linkTo "job" job.repoData job}}
<span class="slug">
{{job.repoSlug}}
</span>
#{{job.number}}
</a>
{{/linkTo}}
{{/if}}
{{/view}}
{{else}}

View File

@ -17,9 +17,9 @@
<div class="status"></div>
{{#if worker.isWorking}}
{{#if worker.jobId}}
<a {{action showJob worker.repoData worker.jobId target="Travis.app.router" href=true}}>
{{#linkTo "job" worker.repoData worker.jobId}}
{{view.display}}
</a>
{{/linkTo}}
{{/if}}
{{else}}
{{view.display}}

View File

@ -37,21 +37,15 @@
QueuesView: Em.View.extend
templateName: 'queues/list'
controller: Em.ArrayController.create()
init: ->
@_super.apply this, arguments
@set 'controller', @get('controller').container.lookup('controller:queues')
showAll: (event) ->
queue = event.context
queue.showAll()
didInsertElement: ->
queues = for queue in Travis.QUEUES
Travis.LimitedArray.create
content: Travis.Job.queued(queue.name), limit: 20
id: "queue_#{queue.name}"
name: queue.display
@set 'controller.content', queues
@_super.apply this, arguments
RunningJobsView: Em.View.extend
templateName: 'jobs/running'
elementId: 'running-jobs'