Merge branch 'master' of github.com:travis-ci/travis-web
Conflicts: assets/scripts/lib/travis/model.coffee public/scripts/app.js public/scripts/min/app.js public/version
This commit is contained in:
commit
ed94cb7329
|
@ -8,6 +8,22 @@ Travis.Store = DS.Store.extend
|
||||||
revision: 4
|
revision: 4
|
||||||
adapter: Travis.RestAdapter.create()
|
adapter: Travis.RestAdapter.create()
|
||||||
|
|
||||||
|
load: (type, id, hash) ->
|
||||||
|
result = @_super.apply this, arguments
|
||||||
|
|
||||||
|
if result && result.clientId
|
||||||
|
# I assume that everything that goes through load is complete record
|
||||||
|
# representation, incomplete hashes from pusher go through merge()
|
||||||
|
record = @findByClientId type, result.clientId
|
||||||
|
record.set 'incomplete', false
|
||||||
|
record.set 'complete', true
|
||||||
|
# setting both incomplete and complete may be weird, but it's easier to
|
||||||
|
# work with both values. I need to check if record has already been completed
|
||||||
|
# and in order to do that, without having 'complete', I would need to check
|
||||||
|
# for incomplete == false, which looks worse
|
||||||
|
|
||||||
|
result
|
||||||
|
|
||||||
merge: (type, id, hash) ->
|
merge: (type, id, hash) ->
|
||||||
if hash == undefined
|
if hash == undefined
|
||||||
hash = id
|
hash = id
|
||||||
|
@ -29,11 +45,7 @@ Travis.Store = DS.Store.extend
|
||||||
if record = recordCache[clientId]
|
if record = recordCache[clientId]
|
||||||
record.send('didChangeData')
|
record.send('didChangeData')
|
||||||
else
|
else
|
||||||
# that's nasty, but will do for now
|
clientId = @pushHash(hash, id, type)
|
||||||
# if event is triggered for a record
|
|
||||||
# that's not yet available, just use find
|
|
||||||
# to make a request to fetch it
|
|
||||||
clientId = @find(type, id).get('clientId')
|
|
||||||
|
|
||||||
if clientId
|
if clientId
|
||||||
DATA_PROXY.savedData = hash
|
DATA_PROXY.savedData = hash
|
||||||
|
@ -59,9 +71,23 @@ Travis.Store = DS.Store.extend
|
||||||
|
|
||||||
_loadOne: (store, type, json) ->
|
_loadOne: (store, type, json) ->
|
||||||
root = type.singularName()
|
root = type.singularName()
|
||||||
@adapter.sideload(store, type, json, root)
|
# we get other types of records only on build, it comes with repository
|
||||||
@merge(type, json[root])
|
# attached. I don't want to use store.sideload here as it will not use merge,
|
||||||
@_updateAssociations(type, root, json[root])
|
# if we need sideload becasue we have side records with other events it needs to
|
||||||
|
# be revised
|
||||||
|
if type == Travis.Build && json.repository
|
||||||
|
result = @_loadIncomplete(Travis.Repo, 'repository', json.repository)
|
||||||
|
@_loadIncomplete(type, root, json[root])
|
||||||
|
|
||||||
|
_loadIncomplete: (type, root, hash) ->
|
||||||
|
result = @merge(type, hash)
|
||||||
|
|
||||||
|
if result && result.clientId
|
||||||
|
record = @findByClientId(type, result.clientId)
|
||||||
|
unless record.get('complete')
|
||||||
|
record.set 'incomplete', true
|
||||||
|
|
||||||
|
@_updateAssociations(type, root, hash)
|
||||||
|
|
||||||
_loadMany: (store, type, json) ->
|
_loadMany: (store, type, json) ->
|
||||||
root = type.pluralName()
|
root = type.pluralName()
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{{#with view}}
|
{{#with view}}
|
||||||
{{#if job.isLoaded}}
|
{{#if job.isComplete}}
|
||||||
<div {{bindAttr class="view.color"}}>
|
<div {{bindAttr class="view.color"}}>
|
||||||
<dl id="summary">
|
<dl id="summary">
|
||||||
<div class="left">
|
<div class="left">
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
{{#if view.isEmpty}}
|
{{#if view.isEmpty}}
|
||||||
{{view Travis.ReposEmptyView}}
|
{{view Travis.ReposEmptyView}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{#if view.repo.isLoaded}}
|
{{#if view.repo.isComplete}}
|
||||||
{{#with view.repo}}
|
{{#with view.repo}}
|
||||||
<h3>
|
<h3>
|
||||||
<a {{bindAttr href="view.urlGithub"}}>{{slug}}</a>
|
<a {{bindAttr href="view.urlGithub"}}>{{slug}}</a>
|
||||||
|
|
|
@ -55,8 +55,8 @@
|
||||||
currentItemBinding: 'build'
|
currentItemBinding: 'build'
|
||||||
|
|
||||||
loading: (->
|
loading: (->
|
||||||
!@get('build.isLoaded')
|
!@get('build.isComplete')
|
||||||
).property('build.isLoaded')
|
).property('build.isComplete')
|
||||||
|
|
||||||
color: (->
|
color: (->
|
||||||
Travis.Helpers.colorForResult(@get('build.result'))
|
Travis.Helpers.colorForResult(@get('build.result'))
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
repoBinding: 'controller.repo'
|
repoBinding: 'controller.repo'
|
||||||
|
|
||||||
class: (->
|
class: (->
|
||||||
'loading' if !@get('repo.isLoaded') && !@get('isEmpty')
|
'loading' if !@get('repo.isComplete') && !@get('isEmpty')
|
||||||
).property('repo.isLoaded')
|
).property('repo.isComplete')
|
||||||
|
|
||||||
isEmpty: (->
|
isEmpty: (->
|
||||||
@get('repos.length') == 0
|
@get('repos.length') == 0
|
||||||
|
|
|
@ -3,14 +3,30 @@
|
||||||
id: DS.attr('number')
|
id: DS.attr('number')
|
||||||
|
|
||||||
refresh: ->
|
refresh: ->
|
||||||
id = @get('id')
|
if id = @get('id')
|
||||||
Travis.app.store.adapter.find(Travis.app.store, @constructor, id) if id
|
store = @get('store')
|
||||||
|
store.adapter.find store, @constructor, id
|
||||||
|
|
||||||
update: (attrs) ->
|
update: (attrs) ->
|
||||||
$.each attrs, (key, value) =>
|
$.each attrs, (key, value) =>
|
||||||
@set(key, value) unless key is 'id'
|
@set(key, value) unless key is 'id'
|
||||||
this
|
this
|
||||||
|
|
||||||
|
isComplete: (->
|
||||||
|
if @get 'incomplete'
|
||||||
|
@loadTheRest()
|
||||||
|
false
|
||||||
|
else
|
||||||
|
@set 'isCompleting', false
|
||||||
|
@get 'isLoaded'
|
||||||
|
).property('incomplete', 'isLoaded')
|
||||||
|
|
||||||
|
loadTheRest: ->
|
||||||
|
return if @get('isCompleting')
|
||||||
|
@set 'isCompleting', true
|
||||||
|
|
||||||
|
@refresh()
|
||||||
|
|
||||||
select: ->
|
select: ->
|
||||||
@constructor.select(@get('id'))
|
@constructor.select(@get('id'))
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1 +1 @@
|
||||||
6e2bd916
|
e60df424
|
Loading…
Reference in New Issue
Block a user