Merge pull request #190 from travis-ci/hh-annotations

Annotation support (#1220)
This commit is contained in:
Hiro Asari 2014-01-27 08:41:52 -08:00
commit e00b938f4d
16 changed files with 64 additions and 1 deletions

View File

@ -23,7 +23,7 @@ unless window.TravisApplication
).property()
modelClasses: (->
[Travis.User, Travis.Build, Travis.Job, Travis.Repo, Travis.Commit, Travis.Worker, Travis.Account, Travis.Broadcast, Travis.Hook]
[Travis.User, Travis.Build, Travis.Job, Travis.Repo, Travis.Commit, Travis.Worker, Travis.Account, Travis.Broadcast, Travis.Hook, Travis.Annotation]
).property()
setup: ->

View File

@ -4,6 +4,7 @@ Travis.JobController = Em.Controller.extend
jobBinding: 'controllers.repo.job'
repoBinding: 'controllers.repo.repo'
commitBinding: 'job.commit'
annotationsBinding: 'job.annotations'
currentUserBinding: 'controllers.repo.currentUser'
tabBinding: 'controllers.repo.tab'

View File

@ -8,6 +8,7 @@ require 'models/event'
require 'models/hook'
require 'models/job'
require 'models/log'
require 'models/annotation'
require 'models/repo'
require 'models/user'
require 'models/worker'

View File

@ -0,0 +1,10 @@
require 'travis/model'
@Travis.Annotation = Travis.Model.extend
jobId: Ember.attr('number')
description: Ember.attr('string')
url: Ember.attr('string')
status: Ember.attr('string')
providerName: Ember.attr('string')
job: Ember.belongsTo('Travis.Job')

View File

@ -18,6 +18,8 @@ require 'travis/model'
build: Ember.belongsTo('Travis.Build')
commit: Ember.belongsTo('Travis.Commit')
annotations: Ember.hasMany('Travis.Annotation')
_config: Ember.attr('object', key: 'config')
log: ( ->

View File

@ -83,6 +83,8 @@ $.extend Travis.Pusher.prototype,
{ job: data }
when 'worker:added', 'worker:updated', 'worker:removed'
{ worker: data }
when 'annotation:created', 'annotation:updated'
{ annotation: data }
warn: (type, warning) ->
console.warn(warning) unless @ignoreWarning(warning)

View File

@ -78,6 +78,8 @@ Travis.RestAdapter = DS.RESTAdapter.extend
accounts: Travis.Account
worker: Travis.Worker
workers: Travis.Worker
annotation: Travis.Annotation
annotations: Travis.Annotation
plurals:
repositories: 'repositories',
@ -89,6 +91,7 @@ Travis.RestAdapter = DS.RESTAdapter.extend
job: 'jobs'
worker: 'workers'
profile: 'profile'
annotation: 'annotations'
ajax: ->
Travis.ajax.ajax.apply(this, arguments)
@ -139,6 +142,7 @@ Travis.RestAdapter.map 'Travis.Job', {
repoId: { key: 'repository_id' }
repo: { key: 'repository_id' }
_config: { key: 'config' }
annotations: { key: 'annotation_ids' }
}
Travis.RestAdapter.map 'Travis.User', {

View File

@ -0,0 +1,10 @@
<div id="annotations">
{{#each annotation in view.annotations}}
<div class="annotation">
<a {{bind-attr href="annotation.url"}}>
{{annotation.status}} {{annotation.providerName}}
</a>:
{{annotation.description}}
</div>
{{/each}}
</div>

View File

@ -49,6 +49,10 @@
<dd class="message">{{formatMessage build.commit.message repoBinding=build.repo}}</dd>
</dl>
{{#unless build.isMatrix}}
{{view Travis.AnnotationsView annotationsBinding="build.jobs.firstObject.annotations"}}
{{/unless}}
{{#if build.isMatrix}}
{{view Travis.JobsView jobsBinding="build.requiredJobs" required="true"}}
{{view Travis.JobsView jobsBinding="build.allowedFailureJobs"}}

View File

@ -46,6 +46,8 @@
<dd class="message">{{formatMessage job.commit.message repoBinding=job.repo}}</dd>
</dl>
{{view Travis.AnnotationsView annotationsBinding="view.annotations"}}
{{view Travis.LogView jobBinding="job"}}
</div>
{{else}}

View File

@ -46,6 +46,7 @@ Travis.FirstSyncView = Travis.View.extend
, Travis.config.syncingPageRedirectionTime
require 'views/accounts'
require 'views/annotation'
require 'views/application'
require 'views/build'
require 'views/events'

View File

@ -0,0 +1,4 @@
Travis.reopen
AnnotationsView: Travis.View.extend
templateName: 'annotations/list'

View File

@ -0,0 +1,2 @@
Travis.reopen
AnnotationsView: Travis.View.extend

View File

@ -19,6 +19,7 @@ Travis.reopen
repoBinding: 'controller.repo'
jobBinding: 'controller.job'
commitBinding: 'job.commit'
annotationsBinding: 'job.annotations'
currentItemBinding: 'job'

View File

@ -0,0 +1,19 @@
@import "_mixins/all"
#annotations
margin: 0 0 0 12px
padding: 12px 0 0 0
border-top: 1px solid $gray-dark-3
@include clearfix
a
text-decoration: underline
img
border: none
.annotation
float: left
min-height: 25px
margin: 0