From 1b8ec432dcb063a484d0d0b316fd602afff08c63 Mon Sep 17 00:00:00 2001 From: Henrik Hodne Date: Wed, 10 Jul 2013 17:49:47 -0700 Subject: [PATCH 01/10] Initial annotation support --- assets/scripts/app/models.coffee | 1 + assets/scripts/app/models/annotation.coffee | 10 ++++++++++ assets/scripts/app/models/job.coffee | 2 ++ assets/scripts/app/store/rest_adapter.coffee | 4 ++++ 4 files changed, 17 insertions(+) create mode 100644 assets/scripts/app/models/annotation.coffee diff --git a/assets/scripts/app/models.coffee b/assets/scripts/app/models.coffee index 0b9b4c74..6526b5b1 100644 --- a/assets/scripts/app/models.coffee +++ b/assets/scripts/app/models.coffee @@ -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' diff --git a/assets/scripts/app/models/annotation.coffee b/assets/scripts/app/models/annotation.coffee new file mode 100644 index 00000000..1f776765 --- /dev/null +++ b/assets/scripts/app/models/annotation.coffee @@ -0,0 +1,10 @@ +require 'travis/model' + +@Travis.Annotation = Travis.Model.extend + jobId: DS.attr('number') + description: DS.attr('string') + url: DS.attr('string') + image: DS.attr('object') + providerName: DS.attr('string') + + job: DS.belongsTo('Travis.Job') diff --git a/assets/scripts/app/models/job.coffee b/assets/scripts/app/models/job.coffee index b8c02d26..7378915b 100644 --- a/assets/scripts/app/models/job.coffee +++ b/assets/scripts/app/models/job.coffee @@ -18,6 +18,8 @@ require 'travis/model' build: DS.belongsTo('Travis.Build') commit: DS.belongsTo('Travis.Commit') + annotations: DS.hasMany('Travis.Annotation') + # this is a fake relationship just to get rid # of ember data's bug: https://github.com/emberjs/data/issues/758 # TODO: remove when this issue is fixed diff --git a/assets/scripts/app/store/rest_adapter.coffee b/assets/scripts/app/store/rest_adapter.coffee index af3f092f..939ebaff 100644 --- a/assets/scripts/app/store/rest_adapter.coffee +++ b/assets/scripts/app/store/rest_adapter.coffee @@ -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', { From 5ce80932539f7326562fef8aa290560d3433c95f Mon Sep 17 00:00:00 2001 From: Henrik Hodne Date: Wed, 10 Jul 2013 18:52:07 -0700 Subject: [PATCH 02/10] Show annotations on the job page --- assets/scripts/app/controllers/job.coffee | 1 + assets/scripts/app/templates/jobs/show.hbs | 6 ++++++ assets/scripts/app/views/job.coffee | 1 + assets/styles/main/annotations.sass | 16 ++++++++++++++++ 4 files changed, 24 insertions(+) create mode 100644 assets/styles/main/annotations.sass diff --git a/assets/scripts/app/controllers/job.coffee b/assets/scripts/app/controllers/job.coffee index 3f94343c..262081fd 100644 --- a/assets/scripts/app/controllers/job.coffee +++ b/assets/scripts/app/controllers/job.coffee @@ -5,6 +5,7 @@ Travis.JobController = Em.Controller.extend repoBinding: 'controllers.repo.repo' commitBinding: 'job.commit' lineNumberBinding: 'controllers.repo.lineNumber' + annotationsBinding: 'job.annotations' currentItemBinding: 'job' diff --git a/assets/scripts/app/templates/jobs/show.hbs b/assets/scripts/app/templates/jobs/show.hbs index a3c62f4d..ff06f46b 100644 --- a/assets/scripts/app/templates/jobs/show.hbs +++ b/assets/scripts/app/templates/jobs/show.hbs @@ -48,6 +48,12 @@
{{formatConfig job.config}}
+
+ {{#each annotation in view.annotations}} +
{{annotation.providerName}}: {{annotation.description}}
+ {{/each}} +
+ {{view Travis.LogView jobBinding="job"}} {{else}} diff --git a/assets/scripts/app/views/job.coffee b/assets/scripts/app/views/job.coffee index 9027ebf7..81ab5ed6 100644 --- a/assets/scripts/app/views/job.coffee +++ b/assets/scripts/app/views/job.coffee @@ -19,6 +19,7 @@ Travis.reopen repoBinding: 'controller.repo' jobBinding: 'controller.job' commitBinding: 'job.commit' + annotationsBinding: 'job.annotations' currentItemBinding: 'job' diff --git a/assets/styles/main/annotations.sass b/assets/styles/main/annotations.sass new file mode 100644 index 00000000..35b8c562 --- /dev/null +++ b/assets/styles/main/annotations.sass @@ -0,0 +1,16 @@ +@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 + + .annotation + float: left + min-height: 25px + margin: 0 + From 5ec9199677bd2accfed1e8beb01e44b916169470 Mon Sep 17 00:00:00 2001 From: Henrik Hodne Date: Thu, 11 Jul 2013 11:19:06 -0700 Subject: [PATCH 03/10] Show annotations in build view --- assets/scripts/app/templates/builds/show.hbs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/assets/scripts/app/templates/builds/show.hbs b/assets/scripts/app/templates/builds/show.hbs index 29458ed3..71d35158 100644 --- a/assets/scripts/app/templates/builds/show.hbs +++ b/assets/scripts/app/templates/builds/show.hbs @@ -53,6 +53,14 @@ {{/unless}} + {{#unless build.isMatrix}} +
+ {{#each annotation in build.jobs.firstObject.annotations}} +
{{annotation.providerName}}: {{annotation.description}}
+ {{/each}} +
+ {{/unless}} + {{#if build.isMatrix}} {{view Travis.JobsView jobsBinding="build.requiredJobs" required="true"}} {{view Travis.JobsView jobsBinding="build.allowedFailureJobs"}} From c912634dd0c89891a3aee5fc83b2c32946cc9d08 Mon Sep 17 00:00:00 2001 From: Henrik Hodne Date: Thu, 11 Jul 2013 11:24:55 -0700 Subject: [PATCH 04/10] Handle annotation Pusher payloads --- assets/scripts/app/pusher.coffee | 2 ++ 1 file changed, 2 insertions(+) diff --git a/assets/scripts/app/pusher.coffee b/assets/scripts/app/pusher.coffee index f5276d44..473982e9 100644 --- a/assets/scripts/app/pusher.coffee +++ b/assets/scripts/app/pusher.coffee @@ -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) From 31cb6ce98ac4eb23d187a2b22b5fb403e975a895 Mon Sep 17 00:00:00 2001 From: Henrik Hodne Date: Thu, 11 Jul 2013 11:45:23 -0700 Subject: [PATCH 05/10] Extract annotations view --- assets/scripts/app/templates/annotations/list.hbs | 8 ++++++++ assets/scripts/app/templates/builds/show.hbs | 6 +----- assets/scripts/app/templates/jobs/show.hbs | 6 +----- assets/scripts/app/views.coffee | 1 + assets/scripts/app/views/annotation.coffee | 4 ++++ 5 files changed, 15 insertions(+), 10 deletions(-) create mode 100644 assets/scripts/app/templates/annotations/list.hbs create mode 100644 assets/scripts/app/views/annotation.coffee diff --git a/assets/scripts/app/templates/annotations/list.hbs b/assets/scripts/app/templates/annotations/list.hbs new file mode 100644 index 00000000..c7b844a3 --- /dev/null +++ b/assets/scripts/app/templates/annotations/list.hbs @@ -0,0 +1,8 @@ +
+ {{#each annotation in view.annotations}} +
+ {{annotation.providerName}}: + {{annotation.description}} +
+ {{/each}} +
diff --git a/assets/scripts/app/templates/builds/show.hbs b/assets/scripts/app/templates/builds/show.hbs index 71d35158..ee75d356 100644 --- a/assets/scripts/app/templates/builds/show.hbs +++ b/assets/scripts/app/templates/builds/show.hbs @@ -54,11 +54,7 @@ {{#unless build.isMatrix}} -
- {{#each annotation in build.jobs.firstObject.annotations}} -
{{annotation.providerName}}: {{annotation.description}}
- {{/each}} -
+ {{view Travis.AnnotationsView annotationsBinding="build.jobs.firstObject.annotations"}} {{/unless}} {{#if build.isMatrix}} diff --git a/assets/scripts/app/templates/jobs/show.hbs b/assets/scripts/app/templates/jobs/show.hbs index ff06f46b..efc8e887 100644 --- a/assets/scripts/app/templates/jobs/show.hbs +++ b/assets/scripts/app/templates/jobs/show.hbs @@ -48,11 +48,7 @@
{{formatConfig job.config}}
-
- {{#each annotation in view.annotations}} -
{{annotation.providerName}}: {{annotation.description}}
- {{/each}} -
+ {{view Travis.AnnotationsView annotationsBinding="view.annotations"}} {{view Travis.LogView jobBinding="job"}} diff --git a/assets/scripts/app/views.coffee b/assets/scripts/app/views.coffee index a6e32a0d..e04d9e37 100644 --- a/assets/scripts/app/views.coffee +++ b/assets/scripts/app/views.coffee @@ -25,6 +25,7 @@ Travis.GettingStartedView = Travis.View.extend templateName: 'no_owned_repos' require 'views/accounts' +require 'views/annotation' require 'views/application' require 'views/build' require 'views/events' diff --git a/assets/scripts/app/views/annotation.coffee b/assets/scripts/app/views/annotation.coffee new file mode 100644 index 00000000..712f10a0 --- /dev/null +++ b/assets/scripts/app/views/annotation.coffee @@ -0,0 +1,4 @@ +Travis.reopen + AnnotationsView: Travis.View.extend + templateName: 'annotations/list' + From 6b1df07621ab79991a0b07e73cd725eed6ff5625 Mon Sep 17 00:00:00 2001 From: Henrik Hodne Date: Thu, 11 Jul 2013 12:20:49 -0700 Subject: [PATCH 06/10] Show images for annotations that have them. --- assets/scripts/app/templates/annotations/list.hbs | 8 +++++++- assets/styles/main/annotations.sass | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/assets/scripts/app/templates/annotations/list.hbs b/assets/scripts/app/templates/annotations/list.hbs index c7b844a3..5019f616 100644 --- a/assets/scripts/app/templates/annotations/list.hbs +++ b/assets/scripts/app/templates/annotations/list.hbs @@ -1,7 +1,13 @@
{{#each annotation in view.annotations}} {{/each}} diff --git a/assets/styles/main/annotations.sass b/assets/styles/main/annotations.sass index 35b8c562..f5db4109 100644 --- a/assets/styles/main/annotations.sass +++ b/assets/styles/main/annotations.sass @@ -9,6 +9,9 @@ a text-decoration: underline + img + border: none + .annotation float: left min-height: 25px From 715b1a2d3634dc3384af30bec88cbdd68e6ed9f2 Mon Sep 17 00:00:00 2001 From: Hiro Asari Date: Fri, 24 Jan 2014 10:32:11 -0500 Subject: [PATCH 07/10] Drop image and add status for Annotation --- assets/scripts/app/models/annotation.coffee | 2 +- assets/scripts/app/templates/annotations/list.hbs | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/assets/scripts/app/models/annotation.coffee b/assets/scripts/app/models/annotation.coffee index df299b5e..471ad76e 100644 --- a/assets/scripts/app/models/annotation.coffee +++ b/assets/scripts/app/models/annotation.coffee @@ -4,7 +4,7 @@ require 'travis/model' jobId: Ember.attr('number') description: Ember.attr('string') url: Ember.attr('string') - image: Ember.attr('object') + status: Ember.attr('string') providerName: Ember.attr('string') job: Ember.belongsTo('Travis.Job') diff --git a/assets/scripts/app/templates/annotations/list.hbs b/assets/scripts/app/templates/annotations/list.hbs index 5019f616..54d9bf96 100644 --- a/assets/scripts/app/templates/annotations/list.hbs +++ b/assets/scripts/app/templates/annotations/list.hbs @@ -2,11 +2,7 @@ {{#each annotation in view.annotations}} From 364fb119c9795ca8055e4e3ea4959d4f5d83ab85 Mon Sep 17 00:00:00 2001 From: Hiro Asari Date: Fri, 24 Jan 2014 10:32:42 -0500 Subject: [PATCH 08/10] Add newline --- assets/scripts/app/views/annotations.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/scripts/app/views/annotations.coffee b/assets/scripts/app/views/annotations.coffee index 480a92b6..556ee80f 100644 --- a/assets/scripts/app/views/annotations.coffee +++ b/assets/scripts/app/views/annotations.coffee @@ -1,2 +1,2 @@ Travis.reopen - AnnotationsView: Travis.View.extend \ No newline at end of file + AnnotationsView: Travis.View.extend From 62fd40f51edbeb9b5bb7b7981b33bff606b52002 Mon Sep 17 00:00:00 2001 From: Hiro Asari Date: Sat, 25 Jan 2014 17:14:35 -0500 Subject: [PATCH 09/10] Tell TravisApplication about the Annotation model --- assets/scripts/app/app.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/scripts/app/app.coffee b/assets/scripts/app/app.coffee index 4e16be6f..1de6886e 100644 --- a/assets/scripts/app/app.coffee +++ b/assets/scripts/app/app.coffee @@ -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: -> From 634fca454e01d96131064d78a3246ed5dd743891 Mon Sep 17 00:00:00 2001 From: Hiro Asari Date: Sat, 25 Jan 2014 17:29:56 -0500 Subject: [PATCH 10/10] Use bind-attr instead of the deprecated bindAttr --- assets/scripts/app/templates/annotations/list.hbs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/scripts/app/templates/annotations/list.hbs b/assets/scripts/app/templates/annotations/list.hbs index 54d9bf96..d80843b5 100644 --- a/assets/scripts/app/templates/annotations/list.hbs +++ b/assets/scripts/app/templates/annotations/list.hbs @@ -1,7 +1,7 @@
{{#each annotation in view.annotations}}