Use /jobs/:id/log.txt endpoint for fetching logs
This commit is contained in:
parent
e9092418a7
commit
5fbf153ed9
|
@ -1,10 +1,15 @@
|
||||||
require 'travis/model'
|
require 'travis/model'
|
||||||
|
|
||||||
@Travis.Artifact = Travis.Model.extend
|
@Travis.Artifact = Em.Object.extend
|
||||||
version: 1 # used to refresh log on requeue
|
version: 1 # used to refresh log on requeue
|
||||||
body: DS.attr('string')
|
body: null
|
||||||
|
isLoaded: false
|
||||||
|
|
||||||
init: ->
|
init: ->
|
||||||
@_super.apply this, arguments
|
@_super.apply this, arguments
|
||||||
|
|
||||||
|
@fetchBody()
|
||||||
|
|
||||||
@set 'queue', Ember.A([])
|
@set 'queue', Ember.A([])
|
||||||
@set 'parts', Ember.ArrayProxy.create(content: [])
|
@set 'parts', Ember.ArrayProxy.create(content: [])
|
||||||
|
|
||||||
|
@ -15,6 +20,14 @@ require 'travis/model'
|
||||||
@set('body', '')
|
@set('body', '')
|
||||||
@incrementProperty('version')
|
@incrementProperty('version')
|
||||||
|
|
||||||
|
fetchBody: ->
|
||||||
|
self = this
|
||||||
|
Travis.ajax.ajax "/jobs/#{@get('job.id')}/log.txt", 'GET',
|
||||||
|
dataType: 'text'
|
||||||
|
success: (data) ->
|
||||||
|
self.set 'body', data
|
||||||
|
self.set 'isLoaded', true
|
||||||
|
|
||||||
append: (body) ->
|
append: (body) ->
|
||||||
if @get('isInitialized')
|
if @get('isInitialized')
|
||||||
@get('parts').pushObject body
|
@get('parts').pushObject body
|
||||||
|
|
|
@ -17,7 +17,9 @@ require 'travis/model'
|
||||||
repo: DS.belongsTo('Travis.Repo', key: 'repository_id')
|
repo: DS.belongsTo('Travis.Repo', key: 'repository_id')
|
||||||
build: DS.belongsTo('Travis.Build', key: 'build_id')
|
build: DS.belongsTo('Travis.Build', key: 'build_id')
|
||||||
commit: DS.belongsTo('Travis.Commit', key: 'commit_id')
|
commit: DS.belongsTo('Travis.Commit', key: 'commit_id')
|
||||||
log: DS.belongsTo('Travis.Artifact', key: 'log_id')
|
log: ( ->
|
||||||
|
Travis.Artifact.create(job: this)
|
||||||
|
).property()
|
||||||
|
|
||||||
repoSlug: (->
|
repoSlug: (->
|
||||||
@get('repositorySlug')
|
@get('repositorySlug')
|
||||||
|
|
|
@ -71,6 +71,7 @@ Travis.Store = DS.Store.extend
|
||||||
!!@typeMapFor(type).idToCid[id]
|
!!@typeMapFor(type).idToCid[id]
|
||||||
|
|
||||||
receive: (event, data) ->
|
receive: (event, data) ->
|
||||||
|
console.log event, data
|
||||||
[name, type] = event.split(':')
|
[name, type] = event.split(':')
|
||||||
|
|
||||||
mappings = @adapter.get('mappings')
|
mappings = @adapter.get('mappings')
|
||||||
|
|
|
@ -4,9 +4,7 @@
|
||||||
{{! this #with + #if is needed because I want to rerender 'pre' when log changes to properly clean it up,
|
{{! this #with + #if is needed because I want to rerender 'pre' when log changes to properly clean it up,
|
||||||
this should probably be refactored to use container view}}
|
this should probably be refactored to use container view}}
|
||||||
{{#with view.job.log}}
|
{{#with view.job.log}}
|
||||||
{{#if id}}
|
{{view Travis.PreView logBinding="view.context.log" logUrlBinding="view.logUrl"}}
|
||||||
{{view Travis.PreView logBinding="view.context.log" logUrlBinding="view.logUrl"}}
|
|
||||||
{{/if}}
|
|
||||||
{{/with}}
|
{{/with}}
|
||||||
|
|
||||||
{{#if sponsor.name}}
|
{{#if sponsor.name}}
|
||||||
|
|
|
@ -21,7 +21,7 @@ jQuery.support.cors = true
|
||||||
|
|
||||||
options.url = "#{endpoint}#{url}"
|
options.url = "#{endpoint}#{url}"
|
||||||
options.type = method
|
options.type = method
|
||||||
options.dataType = 'json'
|
options.dataType = options.dataType || 'json'
|
||||||
options.contentType = 'application/json; charset=utf-8'
|
options.contentType = 'application/json; charset=utf-8'
|
||||||
options.context = this
|
options.context = this
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user