Fix job view
This commit is contained in:
parent
a3f8e0ff7d
commit
075e714fc3
|
@ -17,6 +17,7 @@ require 'controllers/build'
|
|||
require 'controllers/builds'
|
||||
require 'controllers/flash'
|
||||
require 'controllers/home'
|
||||
require 'controllers/job'
|
||||
require 'controllers/profile'
|
||||
require 'controllers/repos'
|
||||
require 'controllers/repo'
|
||||
|
|
6
assets/scripts/app/controllers/job.coffee
Normal file
6
assets/scripts/app/controllers/job.coffee
Normal file
|
@ -0,0 +1,6 @@
|
|||
Travis.JobController = Em.Controller.extend
|
||||
needs: ['repo']
|
||||
|
||||
jobBinding: 'controllers.repo.job'
|
||||
repoBinding: 'controllers.repo.repo'
|
||||
commitBinding: 'job.commit'
|
|
@ -382,10 +382,10 @@ Travis.Router.map ->
|
|||
@resource 'repo', path: '/:owner/:name', ->
|
||||
@route 'index', path: '/'
|
||||
@resource 'build', path: '/builds/:build_id'
|
||||
@resource 'job', path: '/jobs/:job_id'
|
||||
|
||||
Travis.IndexCurrentRoute = Ember.Route.extend
|
||||
renderTemplate: ->
|
||||
@render 'repo'
|
||||
@render 'build', outlet: 'pane', into: 'repo'
|
||||
|
||||
setupController: ->
|
||||
|
@ -394,15 +394,8 @@ Travis.IndexCurrentRoute = Ember.Route.extend
|
|||
Travis.BuildRoute = Ember.Route.extend
|
||||
renderTemplate: (->)
|
||||
|
||||
|
||||
deserialize: (params) ->
|
||||
Travis.Build.find(params.build_id)
|
||||
|
||||
serialize: (model, params) ->
|
||||
id = if model.get
|
||||
model.get('id')
|
||||
else
|
||||
model
|
||||
id = if model.get then model.get('id') else model
|
||||
|
||||
{ build_id: id }
|
||||
|
||||
|
@ -410,8 +403,25 @@ Travis.BuildRoute = Ember.Route.extend
|
|||
model = Travis.Build.find(model) if model && !model.get
|
||||
|
||||
repo = @container.lookup('controller:repo')
|
||||
repo.activate('build')
|
||||
repo.set('build', model)
|
||||
repo.activate('build')
|
||||
|
||||
Travis.JobRoute = Ember.Route.extend
|
||||
renderTemplate: ->
|
||||
@render 'job', outlet: 'pane', into: 'repo'
|
||||
|
||||
serialize: (model, params) ->
|
||||
id = if model.get then model.get('id') else model
|
||||
|
||||
{ job_id: id }
|
||||
|
||||
setupController: (controller, model) ->
|
||||
model = Travis.Job.find(model) if model && !model.get
|
||||
|
||||
repo = @container.lookup('controller:repo')
|
||||
console.log model.toString()
|
||||
repo.set('job', model)
|
||||
repo.activate('job')
|
||||
|
||||
Travis.RepoIndexRoute = Ember.Route.extend
|
||||
setupController: (controller, model) ->
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
<td class="number">
|
||||
<span class="status"></span>
|
||||
{{#if job.id}}
|
||||
<a {{action showJob repo job href=true}}>{{number}}</a>
|
||||
{{#linkTo job repo job}}{{number}}{{/linkTo}}
|
||||
{{/if}}
|
||||
</td>
|
||||
<td class="duration" {{bindAttr title="startedAt"}}>
|
||||
|
|
|
@ -1,51 +1,49 @@
|
|||
{{#with view}}
|
||||
{{#if job.isLoaded}}
|
||||
<div {{bindAttr class="view.color"}}>
|
||||
<dl id="summary">
|
||||
<div class="left">
|
||||
<dt>Job</dt>
|
||||
<dd class="number">
|
||||
<span class="status"></span>
|
||||
{{#if job.id}}
|
||||
<a {{action showJob repo job href=true}}>{{job.number}}</a>
|
||||
{{/if}}
|
||||
</dd>
|
||||
<dt>{{t jobs.state}}</dt>
|
||||
<dd class="state">{{capitalize job.state}}</dd>
|
||||
<dt class="finished_at_label">{{t jobs.finished_at}}</dt>
|
||||
<dd class="finished_at timeago" {{bindAttr title="finishedAt"}}>{{formatTime job.finishedAt}}</dd>
|
||||
<dt>{{t jobs.duration}}</dt>
|
||||
<dd class="duration" {{bindAttr title="startedAt"}}>{{formatDuration job.duration}}</dd>
|
||||
</div>
|
||||
|
||||
<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.isLoaded}}
|
||||
<div {{bindAttr class="view.color"}}>
|
||||
<dl id="summary">
|
||||
<div class="left">
|
||||
<dt>Job</dt>
|
||||
<dd class="number">
|
||||
<span class="status"></span>
|
||||
{{#if job.id}}
|
||||
{{#linkTo job repo job}}{{job.number}}{{/linkTo}}
|
||||
{{/if}}
|
||||
{{#if commit.authorName}}
|
||||
<dt>{{t jobs.author}}</dt>
|
||||
<dd class="author"><a {{bindAttr href="urlAuthor"}}>{{commit.authorName}}</a></dd>
|
||||
{{/if}}
|
||||
{{#if commit.committerName}}
|
||||
<dt>{{t jobs.committer}}</dt>
|
||||
<dd class="committer"><a {{bindAttr href="urlCommitter"}}>{{commit.committerName}}</a></dd>
|
||||
{{/if}}
|
||||
</div>
|
||||
</dd>
|
||||
<dt>{{t jobs.state}}</dt>
|
||||
<dd class="state">{{capitalize job.state}}</dd>
|
||||
<dt class="finished_at_label">{{t jobs.finished_at}}</dt>
|
||||
<dd class="finished_at timeago" {{bindAttr title="finishedAt"}}>{{formatTime job.finishedAt}}</dd>
|
||||
<dt>{{t jobs.duration}}</dt>
|
||||
<dd class="duration" {{bindAttr title="startedAt"}}>{{formatDuration job.duration}}</dd>
|
||||
</div>
|
||||
|
||||
<dt>{{t jobs.message}}</dt>
|
||||
<dd class="message">{{formatMessage commit.message}}</dd>
|
||||
<dt>{{t jobs.config}}</dt>
|
||||
<dd class="config">{{formatConfig job.config}}</dd>
|
||||
</dl>
|
||||
<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}}
|
||||
{{#if commit.authorName}}
|
||||
<dt>{{t jobs.author}}</dt>
|
||||
<dd class="author"><a {{bindAttr href="urlAuthor"}}>{{commit.authorName}}</a></dd>
|
||||
{{/if}}
|
||||
{{#if commit.committerName}}
|
||||
<dt>{{t jobs.committer}}</dt>
|
||||
<dd class="committer"><a {{bindAttr href="urlCommitter"}}>{{commit.committerName}}</a></dd>
|
||||
{{/if}}
|
||||
</div>
|
||||
|
||||
{{view Travis.LogView contextBinding="job"}}}
|
||||
</div>
|
||||
{{else}}
|
||||
<div id="job" class="loading">
|
||||
<span>Loading</span>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{/with}}
|
||||
<dt>{{t jobs.message}}</dt>
|
||||
<dd class="message">{{formatMessage commit.message}}</dd>
|
||||
<dt>{{t jobs.config}}</dt>
|
||||
<dd class="config">{{formatConfig job.config}}</dd>
|
||||
</dl>
|
||||
|
||||
{{view Travis.LogView contextBinding="job"}}}
|
||||
</div>
|
||||
{{else}}
|
||||
<div id="job" class="loading">
|
||||
<span>Loading</span>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
|
|
@ -116,7 +116,7 @@
|
|||
else
|
||||
'showJob'
|
||||
|
||||
Travis.app.get('router').urlForEvent(event, repo, item)
|
||||
#Travis.get('router').urlForEvent(event, repo, item)
|
||||
).property('job.repo', 'parentView.currentItem')
|
||||
|
||||
PreView: Em.View.extend
|
||||
|
|
Loading…
Reference in New Issue
Block a user