Merge pull request #190 from travis-ci/hh-annotations
Annotation support (#1220)
This commit is contained in:
commit
e00b938f4d
|
@ -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: ->
|
||||
|
|
0
assets/scripts/app/controllers/annotations.coffee
Normal file
0
assets/scripts/app/controllers/annotations.coffee
Normal 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'
|
||||
|
||||
|
|
|
@ -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'
|
||||
|
|
10
assets/scripts/app/models/annotation.coffee
Normal file
10
assets/scripts/app/models/annotation.coffee
Normal 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')
|
|
@ -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: ( ->
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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', {
|
||||
|
|
10
assets/scripts/app/templates/annotations/list.hbs
Normal file
10
assets/scripts/app/templates/annotations/list.hbs
Normal 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>
|
|
@ -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"}}
|
||||
|
|
|
@ -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}}
|
||||
|
|
|
@ -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'
|
||||
|
|
4
assets/scripts/app/views/annotation.coffee
Normal file
4
assets/scripts/app/views/annotation.coffee
Normal file
|
@ -0,0 +1,4 @@
|
|||
Travis.reopen
|
||||
AnnotationsView: Travis.View.extend
|
||||
templateName: 'annotations/list'
|
||||
|
2
assets/scripts/app/views/annotations.coffee
Normal file
2
assets/scripts/app/views/annotations.coffee
Normal file
|
@ -0,0 +1,2 @@
|
|||
Travis.reopen
|
||||
AnnotationsView: Travis.View.extend
|
|
@ -19,6 +19,7 @@ Travis.reopen
|
|||
repoBinding: 'controller.repo'
|
||||
jobBinding: 'controller.job'
|
||||
commitBinding: 'job.commit'
|
||||
annotationsBinding: 'job.annotations'
|
||||
|
||||
currentItemBinding: 'job'
|
||||
|
||||
|
|
19
assets/styles/main/annotations.sass
Normal file
19
assets/styles/main/annotations.sass
Normal 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
|
||||
|
Loading…
Reference in New Issue
Block a user