More ember-cli compat changes
This commit is contained in:
parent
e00d5d5d5c
commit
f94ff75a13
|
@ -1,5 +1,8 @@
|
||||||
Adapter = DS.ActiveModelAdapter.extend
|
Adapter = DS.ActiveModelAdapter.extend
|
||||||
host: Travis.config.api_endpoint
|
host: (->
|
||||||
|
Travis.config.api_endpoint
|
||||||
|
).property()
|
||||||
|
|
||||||
ajaxOptions: (url, type, options) ->
|
ajaxOptions: (url, type, options) ->
|
||||||
hash = @_super(url, type, options)
|
hash = @_super(url, type, options)
|
||||||
|
|
||||||
|
|
|
@ -1,126 +1,126 @@
|
||||||
unless window.TravisApplication
|
App = Ember.Application.extend(Ember.Evented,
|
||||||
window.TravisApplication = Em.Application.extend(Ember.Evented,
|
LOG_TRANSITIONS: true
|
||||||
LOG_TRANSITIONS: true,
|
LOG_TRANSITIONS_INTERNAL: true
|
||||||
|
LOG_ACTIVE_GENERATION: true
|
||||||
|
LOG_MODULE_RESOLVER: true
|
||||||
|
LOG_VIEW_LOOKUPS: true
|
||||||
|
#LOG_RESOLVER: true
|
||||||
|
|
||||||
setup: ->
|
setup: ->
|
||||||
@pusher = new Travis.Pusher(key: Travis.config.pusher_key, host: Travis.config.pusher_host) if Travis.config.pusher_key
|
@pusher = new Travis.Pusher(key: Travis.config.pusher_key, host: Travis.config.pusher_host) if Travis.config.pusher_key
|
||||||
@tailing = new Travis.Tailing($(window), '#tail', '#log')
|
@tailing = new Travis.Tailing($(window), '#tail', '#log')
|
||||||
@toTop = new Travis.ToTop($(window), '.to-top', '#log-container')
|
@toTop = new Travis.ToTop($(window), '.to-top', '#log-container')
|
||||||
|
|
||||||
@on 'user:signed_in', (user) ->
|
@on 'user:signed_in', (user) ->
|
||||||
Travis.onUserUpdate(user)
|
Travis.onUserUpdate(user)
|
||||||
|
|
||||||
@on 'user:synced', (user) ->
|
@on 'user:synced', (user) ->
|
||||||
Travis.onUserUpdate(user)
|
Travis.onUserUpdate(user)
|
||||||
|
|
||||||
reset: ->
|
lookup: ->
|
||||||
@_super.apply(this, arguments)
|
@__container__.lookup.apply @__container__, arguments
|
||||||
@get('modelClasses').forEach (klass) ->
|
|
||||||
klass.resetData()
|
|
||||||
@setup()
|
|
||||||
|
|
||||||
lookup: ->
|
flash: (options) ->
|
||||||
@__container__.lookup.apply @__container__, arguments
|
Travis.lookup('controller:flash').loadFlashes([options])
|
||||||
|
|
||||||
flash: (options) ->
|
receive: (event, data) ->
|
||||||
Travis.lookup('controller:flash').loadFlashes([options])
|
[name, type] = event.split(':')
|
||||||
|
|
||||||
receive: (event, data) ->
|
store = @__container__.lookup('store:main')
|
||||||
[name, type] = event.split(':')
|
|
||||||
|
|
||||||
store = @__container__.lookup('store:main')
|
if name == 'job' && data.job?.commit
|
||||||
|
store.pushPayload(commits: [data.job.commit])
|
||||||
|
|
||||||
if name == 'job' && data.job?.commit
|
if name == 'build' && data.build?.commit
|
||||||
store.pushPayload(commits: [data.job.commit])
|
# TODO: commit should be a sideload record on build, not mixed with it
|
||||||
|
build = data.build
|
||||||
|
commit = {
|
||||||
|
id: build.commit_id
|
||||||
|
author_email: build.author_email
|
||||||
|
author_name: build.author_name
|
||||||
|
branch: build.branch
|
||||||
|
committed_at: build.committed_at
|
||||||
|
committer_email: build.committer_email
|
||||||
|
committer_name: build.committer_name
|
||||||
|
compare_url: build.compare_url
|
||||||
|
message: build.message
|
||||||
|
sha: build.commit
|
||||||
|
}
|
||||||
|
delete(data.build.commit)
|
||||||
|
|
||||||
if name == 'build' && data.build?.commit
|
store.pushPayload(commit: [commit])
|
||||||
# TODO: commit should be a sideload record on build, not mixed with it
|
|
||||||
build = data.build
|
|
||||||
commit = {
|
|
||||||
id: build.commit_id
|
|
||||||
author_email: build.author_email
|
|
||||||
author_name: build.author_name
|
|
||||||
branch: build.branch
|
|
||||||
committed_at: build.committed_at
|
|
||||||
committer_email: build.committer_email
|
|
||||||
committer_name: build.committer_name
|
|
||||||
compare_url: build.compare_url
|
|
||||||
message: build.message
|
|
||||||
sha: build.commit
|
|
||||||
}
|
|
||||||
delete(data.build.commit)
|
|
||||||
|
|
||||||
store.pushPayload(commit: [commit])
|
if event == 'job:log'
|
||||||
|
console.log 'store: received job:log event', data if Log.DEBUG
|
||||||
|
data = data.job
|
||||||
|
job = store.recordForId('job', data.id)
|
||||||
|
job.appendLog(number: parseInt(data.number), content: data._log, final: data.final)
|
||||||
|
else if data[name]
|
||||||
|
@_loadOne(store, name, data)
|
||||||
|
else
|
||||||
|
throw "can't load data for #{name}" unless type
|
||||||
|
|
||||||
if event == 'job:log'
|
_loadOne: (store, type, json) ->
|
||||||
console.log 'store: received job:log event', data if Log.DEBUG
|
payload = {}
|
||||||
data = data.job
|
payload[type.pluralize()] = [json[type]]
|
||||||
job = store.recordForId('job', data.id)
|
store.pushPayload(payload)
|
||||||
job.appendLog(number: parseInt(data.number), content: data._log, final: data.final)
|
|
||||||
else if data[name]
|
# we get other types of records only in a few situations and
|
||||||
@_loadOne(store, name, data)
|
# it's not always needed to update data, so I'm specyfing which
|
||||||
|
# things I want to update here:
|
||||||
|
if type == 'build' && (json.repository || json.repo)
|
||||||
|
data = json.repository || json.repo
|
||||||
|
store.pushPayload(repos: [data])
|
||||||
|
|
||||||
|
toggleSidebar: ->
|
||||||
|
$('body').toggleClass('maximized')
|
||||||
|
# TODO gotta force redraws here :/
|
||||||
|
element = $('<span></span>')
|
||||||
|
$('#top .profile').append(element)
|
||||||
|
Em.run.later (-> element.remove()), 10
|
||||||
|
element = $('<span></span>')
|
||||||
|
$('#repo').append(element)
|
||||||
|
Em.run.later (-> element.remove()), 10
|
||||||
|
|
||||||
|
ready: ->
|
||||||
|
@slider = new Travis.Slider(@storage)
|
||||||
|
location.href = location.href.replace('#!/', '') if location.hash.slice(0, 2) == '#!'
|
||||||
|
|
||||||
|
currentDate: ->
|
||||||
|
new Date()
|
||||||
|
|
||||||
|
onUserUpdate: (user) ->
|
||||||
|
if Travis.config.pro
|
||||||
|
@identifyCustomer(user)
|
||||||
|
@subscribePusher(user)
|
||||||
|
@setupCharm(user)
|
||||||
|
|
||||||
|
subscribePusher: (user) ->
|
||||||
|
channels = user.channels
|
||||||
|
channels = channels.map (channel) ->
|
||||||
|
if channel.match /^private-/
|
||||||
|
channel
|
||||||
else
|
else
|
||||||
throw "can't load data for #{name}" unless type
|
"private-#{channel}"
|
||||||
|
Travis.pusher.subscribeAll(channels)
|
||||||
|
|
||||||
_loadOne: (store, type, json) ->
|
setupCharm: (user) ->
|
||||||
payload = {}
|
$.extend window.__CHARM,
|
||||||
payload[type.pluralize()] = [json[type]]
|
customer: user.login,
|
||||||
store.pushPayload(payload)
|
customer_id: user.id,
|
||||||
|
email: user.email
|
||||||
|
|
||||||
# we get other types of records only in a few situations and
|
displayCharm: ->
|
||||||
# it's not always needed to update data, so I'm specyfing which
|
__CHARM.show()
|
||||||
# things I want to update here:
|
|
||||||
if type == 'build' && (json.repository || json.repo)
|
|
||||||
data = json.repository || json.repo
|
|
||||||
store.pushPayload(repos: [data])
|
|
||||||
|
|
||||||
toggleSidebar: ->
|
identifyCustomer: (user) ->
|
||||||
$('body').toggleClass('maximized')
|
if _cio && _cio.identify
|
||||||
# TODO gotta force redraws here :/
|
_cio.identify
|
||||||
element = $('<span></span>')
|
id: user.id
|
||||||
$('#top .profile').append(element)
|
|
||||||
Em.run.later (-> element.remove()), 10
|
|
||||||
element = $('<span></span>')
|
|
||||||
$('#repo').append(element)
|
|
||||||
Em.run.later (-> element.remove()), 10
|
|
||||||
|
|
||||||
ready: ->
|
|
||||||
@slider = new Travis.Slider(@storage)
|
|
||||||
location.href = location.href.replace('#!/', '') if location.hash.slice(0, 2) == '#!'
|
|
||||||
|
|
||||||
currentDate: ->
|
|
||||||
new Date()
|
|
||||||
|
|
||||||
onUserUpdate: (user) ->
|
|
||||||
if Travis.config.pro
|
|
||||||
@identifyCustomer(user)
|
|
||||||
@subscribePusher(user)
|
|
||||||
@setupCharm(user)
|
|
||||||
|
|
||||||
subscribePusher: (user) ->
|
|
||||||
channels = user.channels
|
|
||||||
channels = channels.map (channel) ->
|
|
||||||
if channel.match /^private-/
|
|
||||||
channel
|
|
||||||
else
|
|
||||||
"private-#{channel}"
|
|
||||||
Travis.pusher.subscribeAll(channels)
|
|
||||||
|
|
||||||
setupCharm: (user) ->
|
|
||||||
$.extend window.__CHARM,
|
|
||||||
customer: user.login,
|
|
||||||
customer_id: user.id,
|
|
||||||
email: user.email
|
email: user.email
|
||||||
|
name: user.name
|
||||||
|
created_at: (Date.parse(user.created_at) / 1000) || null
|
||||||
|
login: user.login
|
||||||
|
)
|
||||||
|
|
||||||
displayCharm: ->
|
window.App = App unless window.App
|
||||||
__CHARM.show()
|
|
||||||
|
|
||||||
identifyCustomer: (user) ->
|
|
||||||
if _cio && _cio.identify
|
|
||||||
_cio.identify
|
|
||||||
id: user.id
|
|
||||||
email: user.email
|
|
||||||
name: user.name
|
|
||||||
created_at: (Date.parse(user.created_at) / 1000) || null
|
|
||||||
login: user.login
|
|
||||||
)
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
Travis.AccountController = Ember.ObjectController.extend
|
Controller = Ember.ObjectController.extend
|
||||||
allHooks: []
|
allHooks: []
|
||||||
needs: ['currentUser']
|
needs: ['currentUser']
|
||||||
userBinding: 'controllers.currentUser'
|
userBinding: 'controllers.currentUser'
|
||||||
|
@ -38,9 +38,11 @@ Travis.AccountController = Ember.ObjectController.extend
|
||||||
).property('allHooks.length', 'allHooks')
|
).property('allHooks.length', 'allHooks')
|
||||||
|
|
||||||
showPrivateReposHint: (->
|
showPrivateReposHint: (->
|
||||||
Travis.config.show_repos_hint == 'private'
|
@config.show_repos_hint == 'private'
|
||||||
) .property()
|
) .property()
|
||||||
|
|
||||||
showPublicReposHint: (->
|
showPublicReposHint: (->
|
||||||
Travis.config.show_repos_hint == 'public'
|
@config.show_repos_hint == 'public'
|
||||||
) .property()
|
) .property()
|
||||||
|
|
||||||
|
Travis.AccountController = Controller
|
||||||
|
|
|
@ -1,2 +1,4 @@
|
||||||
Travis.AccountsController = Ember.ArrayController.extend
|
Controller = Ember.ArrayController.extend
|
||||||
tab: 'accounts'
|
tab: 'accounts'
|
||||||
|
|
||||||
|
Travis.AccountsController = Controller
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
Controller = Em.Controller.extend
|
Controller = Ember.Controller.extend
|
||||||
needs: ['currentUser', 'repos']
|
needs: ['currentUser', 'repos']
|
||||||
userBinding: 'controllers.currentUser'
|
userBinding: 'controllers.currentUser'
|
||||||
|
|
||||||
|
|
|
@ -1 +1,3 @@
|
||||||
Travis.AuthController = Ember.Controller.extend()
|
Controller = Ember.Controller.extend()
|
||||||
|
|
||||||
|
Travis.AuthController = Controller
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
require 'helpers/urls'
|
|
||||||
|
|
||||||
gravatarImage = Travis.Urls.gravatarImage
|
gravatarImage = Travis.Urls.gravatarImage
|
||||||
|
|
||||||
Controller = Ember.Controller.extend Travis.GithubUrlProperties,
|
Controller = Ember.Controller.extend Travis.GithubUrlProperties,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
Travis.BuildsController = Em.ArrayController.extend
|
Controller = Ember.ArrayController.extend
|
||||||
isPullRequestsList: false
|
isPullRequestsList: false
|
||||||
|
|
||||||
sortAscending: false
|
sortAscending: false
|
||||||
|
@ -26,3 +26,5 @@ Travis.BuildsController = Em.ArrayController.extend
|
||||||
options.event_type = type.replace(/s$/, '') # poor man's singularize
|
options.event_type = type.replace(/s$/, '') # poor man's singularize
|
||||||
|
|
||||||
@store.find('build', options)
|
@store.find('build', options)
|
||||||
|
|
||||||
|
Travis.BuildsController = Controller
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
colorForState = Travis.Helpers.colorForState
|
colorForState = Travis.Helpers.colorForState
|
||||||
|
GithubUrlProperties = Travis.GithubUrlProperties
|
||||||
|
|
||||||
Controller = Em.ObjectController.extend(Travis.GithubUrlProperties,
|
Controller = Ember.ObjectController.extend(GithubUrlProperties,
|
||||||
needs: ['builds']
|
needs: ['builds']
|
||||||
isPullRequestsListBinding: 'controllers.builds.isPullRequestsList'
|
isPullRequestsListBinding: 'controllers.builds.isPullRequestsList'
|
||||||
buildBinding: 'content'
|
buildBinding: 'content'
|
||||||
|
|
24
assets/scripts/app/controllers/caches-by-branch.coffee
Normal file
24
assets/scripts/app/controllers/caches-by-branch.coffee
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
Ajax = Travis.ajax
|
||||||
|
|
||||||
|
Controller = Ember.ObjectController.extend
|
||||||
|
isDeleting: false
|
||||||
|
needs: ['repo', 'caches']
|
||||||
|
repo: Ember.computed.alias('controllers.repo.repo')
|
||||||
|
|
||||||
|
actions:
|
||||||
|
delete: ->
|
||||||
|
return if @get('isDeleting')
|
||||||
|
|
||||||
|
if confirm('Are you sure?')
|
||||||
|
@set('isDeleting', true)
|
||||||
|
|
||||||
|
data = { branch: @get('branch') }
|
||||||
|
|
||||||
|
deletingDone = => @set('isDeleting', false)
|
||||||
|
|
||||||
|
repo = @get('repo')
|
||||||
|
Ajax("/repos/#{repo.get('id')}/caches", "DELETE", data: data).then(deletingDone, deletingDone).then =>
|
||||||
|
model = @get('model')
|
||||||
|
@get('controllers.caches').removeObject(model)
|
||||||
|
|
||||||
|
Travis.CachesByBranchController = Controller
|
26
assets/scripts/app/controllers/caches-item.coffee
Normal file
26
assets/scripts/app/controllers/caches-item.coffee
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
Ajax = Travis.ajax
|
||||||
|
|
||||||
|
Controller = Ember.ObjectController.extend
|
||||||
|
isDeleting: false
|
||||||
|
needs: ['repo', 'caches']
|
||||||
|
repo: Ember.computed.alias('controllers.repo.repo')
|
||||||
|
|
||||||
|
actions:
|
||||||
|
delete: ->
|
||||||
|
return if @get('isDeleting')
|
||||||
|
|
||||||
|
if confirm('Are you sure?')
|
||||||
|
@set('isDeleting', true)
|
||||||
|
|
||||||
|
data = { branch: @get('branch'), match: @get('slug') }
|
||||||
|
|
||||||
|
deletingDone = => @set('isDeleting', false)
|
||||||
|
|
||||||
|
repo = @get('repo')
|
||||||
|
Ajax("/repos/#{repo.get('id')}/caches", "DELETE", data: data).then(deletingDone, deletingDone).then =>
|
||||||
|
model = @get('model')
|
||||||
|
@get('parent.caches').removeObject(model)
|
||||||
|
if @get('parent.caches.length') == 0
|
||||||
|
@get('controllers.caches').removeObject(@get('parent'))
|
||||||
|
|
||||||
|
Travis.CacheItemController = Controller
|
|
@ -1,4 +1,4 @@
|
||||||
Travis.CachesController = Ember.ArrayController.extend
|
Controller = Ember.ArrayController.extend
|
||||||
isDeleting: false
|
isDeleting: false
|
||||||
needs: ['repo']
|
needs: ['repo']
|
||||||
repo: Ember.computed.alias('controllers.repo.repo')
|
repo: Ember.computed.alias('controllers.repo.repo')
|
||||||
|
@ -16,46 +16,4 @@ Travis.CachesController = Ember.ArrayController.extend
|
||||||
Travis.ajax.ajax("/repos/#{repo.get('id')}/caches", "DELETE").then(deletingDone, deletingDone).then =>
|
Travis.ajax.ajax("/repos/#{repo.get('id')}/caches", "DELETE").then(deletingDone, deletingDone).then =>
|
||||||
@clear()
|
@clear()
|
||||||
|
|
||||||
Travis.CachesByBranchController = Ember.ObjectController.extend
|
Travis.CachesController = Controller
|
||||||
isDeleting: false
|
|
||||||
needs: ['repo', 'caches']
|
|
||||||
repo: Ember.computed.alias('controllers.repo.repo')
|
|
||||||
|
|
||||||
actions:
|
|
||||||
delete: ->
|
|
||||||
return if @get('isDeleting')
|
|
||||||
|
|
||||||
if confirm('Are you sure?')
|
|
||||||
@set('isDeleting', true)
|
|
||||||
|
|
||||||
data = { branch: @get('branch') }
|
|
||||||
|
|
||||||
deletingDone = => @set('isDeleting', false)
|
|
||||||
|
|
||||||
repo = @get('repo')
|
|
||||||
Travis.ajax.ajax("/repos/#{repo.get('id')}/caches", "DELETE", data: data).then(deletingDone, deletingDone).then =>
|
|
||||||
model = @get('model')
|
|
||||||
@get('controllers.caches').removeObject(model)
|
|
||||||
|
|
||||||
Travis.CacheItemController = Ember.ObjectController.extend
|
|
||||||
isDeleting: false
|
|
||||||
needs: ['repo', 'caches']
|
|
||||||
repo: Ember.computed.alias('controllers.repo.repo')
|
|
||||||
|
|
||||||
actions:
|
|
||||||
delete: ->
|
|
||||||
return if @get('isDeleting')
|
|
||||||
|
|
||||||
if confirm('Are you sure?')
|
|
||||||
@set('isDeleting', true)
|
|
||||||
|
|
||||||
data = { branch: @get('branch'), match: @get('slug') }
|
|
||||||
|
|
||||||
deletingDone = => @set('isDeleting', false)
|
|
||||||
|
|
||||||
repo = @get('repo')
|
|
||||||
Travis.ajax.ajax("/repos/#{repo.get('id')}/caches", "DELETE", data: data).then(deletingDone, deletingDone).then =>
|
|
||||||
model = @get('model')
|
|
||||||
@get('parent.caches').removeObject(model)
|
|
||||||
if @get('parent.caches.length') == 0
|
|
||||||
@get('controllers.caches').removeObject(@get('parent'))
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
Travis.CurrentUserController = Em.ObjectController.extend
|
Controller = Ember.ObjectController.extend
|
||||||
sync: ->
|
sync: ->
|
||||||
@get('model').sync()
|
@get('model').sync()
|
||||||
|
|
||||||
|
@ -9,3 +9,5 @@ Travis.CurrentUserController = Em.ObjectController.extend
|
||||||
Ember.run.scheduleOnce 'routerTransitions', this, ->
|
Ember.run.scheduleOnce 'routerTransitions', this, ->
|
||||||
@container.lookup('router:main').send('renderFirstSync')
|
@container.lookup('router:main').send('renderFirstSync')
|
||||||
).observes('isSyncing', 'auth.currentUser')
|
).observes('isSyncing', 'auth.currentUser')
|
||||||
|
|
||||||
|
Travis.CurrentUserController = Controller
|
||||||
|
|
|
@ -3,7 +3,7 @@ require 'travis/validations'
|
||||||
Validations = Travis.Validations
|
Validations = Travis.Validations
|
||||||
EnvVar = Travis.EnvVar
|
EnvVar = Travis.EnvVar
|
||||||
|
|
||||||
Travis.EnvVarsNewController = Ember.Controller.extend Validations,
|
Controller = Ember.Controller.extend Validations,
|
||||||
needs: ['repo']
|
needs: ['repo']
|
||||||
repo: Ember.computed.alias('controllers.repo.repo')
|
repo: Ember.computed.alias('controllers.repo.repo')
|
||||||
|
|
||||||
|
@ -42,3 +42,5 @@ Travis.EnvVarsNewController = Ember.Controller.extend Validations,
|
||||||
self.transitionToRoute('env_vars')
|
self.transitionToRoute('env_vars')
|
||||||
, =>
|
, =>
|
||||||
@set('isSaving', false)
|
@set('isSaving', false)
|
||||||
|
|
||||||
|
Travis.EnvVarsNewController = Controller
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
require 'travis/validations'
|
require 'travis/validations'
|
||||||
|
|
||||||
Travis.EnvVarController = Ember.ObjectController.extend Travis.Validations,
|
Validations = Travis.Validations
|
||||||
|
|
||||||
|
Controller = Ember.ObjectController.extend Validations,
|
||||||
isEditing: false
|
isEditing: false
|
||||||
isDeleting: false
|
isDeleting: false
|
||||||
|
|
||||||
|
@ -43,3 +45,5 @@ Travis.EnvVarController = Ember.ObjectController.extend Travis.Validations,
|
||||||
# TODO: handle errors
|
# TODO: handle errors
|
||||||
env_var.save().then =>
|
env_var.save().then =>
|
||||||
@set('isEditing', false)
|
@set('isEditing', false)
|
||||||
|
|
||||||
|
Travis.EnvVarController = Controller
|
||||||
|
|
|
@ -1,2 +1,4 @@
|
||||||
Travis.EnvVarsController = Ember.ArrayController.extend
|
Controller = Ember.ArrayController.extend
|
||||||
vars: Ember.computed.filterBy('model', 'isNew', false)
|
vars: Ember.computed.filterBy('model', 'isNew', false)
|
||||||
|
|
||||||
|
Travis.EnvVarsController = Controller
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
Controller = Em.Controller.extend
|
Controller = Ember.Controller.extend
|
||||||
needs: ['currentUser']
|
needs: ['currentUser']
|
||||||
user: Ember.computed.alias('controllers.currentUser')
|
user: Ember.computed.alias('controllers.currentUser')
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
Travis.FlashController = Ember.ArrayController.extend
|
LimitedArray = Travis.LimitedArray
|
||||||
|
Broadcast = Travis.Broadcast
|
||||||
|
|
||||||
|
Controller = Ember.ArrayController.extend
|
||||||
needs: ['currentUser']
|
needs: ['currentUser']
|
||||||
currentUserBinding: 'controllers.currentUser'
|
currentUserBinding: 'controllers.currentUser'
|
||||||
|
|
||||||
init: ->
|
init: ->
|
||||||
@_super.apply this, arguments
|
@_super.apply this, arguments
|
||||||
@set('flashes', Travis.LimitedArray.create(limit: 2, content: []))
|
@set('flashes', LimitedArray.create(limit: 2, content: []))
|
||||||
|
|
||||||
model: (->
|
model: (->
|
||||||
broadcasts = @get('unseenBroadcasts')
|
broadcasts = @get('unseenBroadcasts')
|
||||||
|
@ -31,7 +34,7 @@ Travis.FlashController = Ember.ArrayController.extend
|
||||||
Ember.run.later(this, (-> @get('flashes.content').removeObject(msg)), 15000)
|
Ember.run.later(this, (-> @get('flashes.content').removeObject(msg)), 15000)
|
||||||
|
|
||||||
close: (msg) ->
|
close: (msg) ->
|
||||||
if msg instanceof Travis.Broadcast
|
if msg instanceof Broadcast
|
||||||
msg.setSeen()
|
msg.setSeen()
|
||||||
@notifyPropertyChange('unseenBroadcasts')
|
@notifyPropertyChange('unseenBroadcasts')
|
||||||
else
|
else
|
||||||
|
@ -40,3 +43,5 @@ Travis.FlashController = Ember.ArrayController.extend
|
||||||
actions:
|
actions:
|
||||||
close: (msg) ->
|
close: (msg) ->
|
||||||
@close(msg)
|
@close(msg)
|
||||||
|
|
||||||
|
Travis.FlashController = Controller
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
Controller = Em.Controller.extend()
|
Controller = Ember.Controller.extend()
|
||||||
|
|
||||||
Travis.MainErrorController = Controller
|
Travis.MainErrorController = Controller
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
Travis.ProfileController = Ember.Controller.extend
|
Controller = Ember.Controller.extend
|
||||||
name: 'profile'
|
name: 'profile'
|
||||||
|
|
||||||
needs: ['currentUser', 'accounts', 'account']
|
needs: ['currentUser', 'accounts', 'account']
|
||||||
|
@ -22,3 +22,5 @@ Travis.ProfileController = Ember.Controller.extend
|
||||||
id = if @get('account.type') == 'user' then 'user' else @get('account.login')
|
id = if @get('account.type') == 'user' then 'user' else @get('account.login')
|
||||||
"#{@get('config').billing_endpoint}/subscriptions/#{id}"
|
"#{@get('config').billing_endpoint}/subscriptions/#{id}"
|
||||||
).property('account.login', 'account.type')
|
).property('account.login', 'account.type')
|
||||||
|
|
||||||
|
Travis.ProfileController = Controller
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
require 'models/job'
|
Controller = Ember.ArrayController.extend
|
||||||
Job = Travis.Job
|
|
||||||
|
|
||||||
Controller = Em.ArrayController.extend
|
|
||||||
content: (->
|
content: (->
|
||||||
@store.filter 'job', {}, (job) ->
|
@store.filter 'job', {}, (job) ->
|
||||||
['created', 'queued'].indexOf(job.get('state')) != -1
|
['created', 'queued'].indexOf(job.get('state')) != -1
|
||||||
|
|
|
@ -14,7 +14,7 @@ Controller = Ember.Controller.extend
|
||||||
init: ->
|
init: ->
|
||||||
@_super.apply this, arguments
|
@_super.apply this, arguments
|
||||||
if !Ember.testing
|
if !Ember.testing
|
||||||
Visibility.every Travis.INTERVALS.updateTimes, @updateTimes.bind(this)
|
Visibility.every @config.intervals.updateTimes, @updateTimes.bind(this)
|
||||||
|
|
||||||
updateTimes: ->
|
updateTimes: ->
|
||||||
Ember.run this, ->
|
Ember.run this, ->
|
||||||
|
|
|
@ -30,7 +30,7 @@ Controller = Ember.ArrayController.extend
|
||||||
init: ->
|
init: ->
|
||||||
@_super.apply this, arguments
|
@_super.apply this, arguments
|
||||||
if !Ember.testing
|
if !Ember.testing
|
||||||
Visibility.every Travis.INTERVALS.updateTimes, @updateTimes.bind(this)
|
Visibility.every @config.intervals.updateTimes, @updateTimes.bind(this)
|
||||||
|
|
||||||
recentRepos: (->
|
recentRepos: (->
|
||||||
Ember.ArrayProxy.extend(
|
Ember.ArrayProxy.extend(
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
Travis.RequestsController = Ember.ArrayController.extend
|
Controller = Ember.ArrayController.extend
|
||||||
needs: ['repo']
|
needs: ['repo']
|
||||||
repo: Ember.computed.alias('controllers.repo.repo')
|
repo: Ember.computed.alias('controllers.repo.repo')
|
||||||
|
|
||||||
|
@ -6,3 +6,5 @@ Travis.RequestsController = Ember.ArrayController.extend
|
||||||
slug = @get('repo.slug')
|
slug = @get('repo.slug')
|
||||||
"https://lint.travis-ci.org/#{slug}"
|
"https://lint.travis-ci.org/#{slug}"
|
||||||
).property('repo.slug')
|
).property('repo.slug')
|
||||||
|
|
||||||
|
Travis.RequestsController = Controller
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
require 'models/job'
|
Controller = Ember.ArrayController.extend
|
||||||
Job = Travis.Job
|
|
||||||
|
|
||||||
Controller = Em.ArrayController.extend
|
|
||||||
content: (->
|
content: (->
|
||||||
@store.filter 'job', { state: 'started' }, (job) ->
|
@store.filter 'job', { state: 'started' }, (job) ->
|
||||||
['started', 'received'].indexOf(job.get('state')) != -1
|
['started', 'received'].indexOf(job.get('state')) != -1
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
Travis.SettingsIndexController = Em.ObjectController.extend
|
Controller = Ember.ObjectController.extend
|
||||||
settings: Ember.computed.alias('model.settings')
|
settings: Ember.computed.alias('model.settings')
|
||||||
|
|
||||||
settingsChanged: (->
|
settingsChanged: (->
|
||||||
|
@ -16,3 +16,5 @@ Travis.SettingsIndexController = Em.ObjectController.extend
|
||||||
save: ->
|
save: ->
|
||||||
@get('model').saveSettings(@get('settings')).then null, ->
|
@get('model').saveSettings(@get('settings')).then null, ->
|
||||||
Travis.flash(error: 'There was an error while saving settings. Please try again.')
|
Travis.flash(error: 'There was an error while saving settings. Please try again.')
|
||||||
|
|
||||||
|
Travis.SettingsIndexController = Controller
|
|
@ -1,4 +1,4 @@
|
||||||
Controller = Em.ArrayController.extend
|
Controller = Ember.ArrayController.extend
|
||||||
init: ->
|
init: ->
|
||||||
@_super.apply this, arguments
|
@_super.apply this, arguments
|
||||||
@tickables = []
|
@tickables = []
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
require 'travis/validations'
|
require 'travis/validations'
|
||||||
|
|
||||||
Travis.SshKeyController = Ember.ObjectController.extend Travis.Validations,
|
Validations = Travis.Validations
|
||||||
|
|
||||||
|
Controller = Ember.ObjectController.extend Validations,
|
||||||
isEditing: false
|
isEditing: false
|
||||||
isSaving: false
|
isSaving: false
|
||||||
isDeleting: false
|
isDeleting: false
|
||||||
|
@ -57,3 +59,5 @@ Travis.SshKeyController = Ember.ObjectController.extend Travis.Validations,
|
||||||
|
|
||||||
edit: ->
|
edit: ->
|
||||||
@set('isEditing', true)
|
@set('isEditing', true)
|
||||||
|
|
||||||
|
Travis.SshKeyController = Controller
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
Controller = Em.Controller.extend
|
Controller = Ember.Controller.extend
|
||||||
needs: ['currentUser']
|
needs: ['currentUser']
|
||||||
userBinding: 'controllers.currentUser'
|
userBinding: 'controllers.currentUser'
|
||||||
|
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
Travis.GithubUrlProperties = Ember.Mixin.create
|
|
||||||
urlGithubCommit: (->
|
|
||||||
Travis.Urls.githubCommit(@get('repo.slug'), @get('commit.sha'))
|
|
||||||
).property('repo.slug', 'commit.sha')
|
|
||||||
|
|
||||||
urlGithubPullRequest: (->
|
|
||||||
Travis.Urls.githubPullRequest(@get('repo.slug'), @get('build.pullRequestNumber'))
|
|
||||||
).property('repo.slug', 'build.pullRequestNumber')
|
|
|
@ -1,5 +1,3 @@
|
||||||
notEmpty = Ember.computed.notEmpty
|
|
||||||
|
|
||||||
ErrorsView = Ember.View.extend
|
ErrorsView = Ember.View.extend
|
||||||
tagName: 'span'
|
tagName: 'span'
|
||||||
template: Ember.Handlebars.compile("{{#each view.errors}}{{message}}{{/each}}")
|
template: Ember.Handlebars.compile("{{#each view.errors}}{{message}}{{/each}}")
|
||||||
|
@ -12,7 +10,7 @@ ErrorsView = Ember.View.extend
|
||||||
codes: (->
|
codes: (->
|
||||||
@get('errors').mapBy('code')
|
@get('errors').mapBy('code')
|
||||||
).property('@errors')
|
).property('@errors')
|
||||||
show: notEmpty('errors.[]')
|
show: Ember.computed.notEmpty('errors.[]')
|
||||||
|
|
||||||
fn = (name, options) ->
|
fn = (name, options) ->
|
||||||
errors = @get('errors').for(name)
|
errors = @get('errors').for(name)
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
notEmpty = Ember.computed.notEmpty
|
|
||||||
|
|
||||||
FormFieldRowView = Ember.View.extend
|
FormFieldRowView = Ember.View.extend
|
||||||
invalid: notEmpty('errors.[]')
|
invalid: Ember.computed.notEmpty('errors.[]')
|
||||||
classNameBindings: ['invalid']
|
classNameBindings: ['invalid']
|
||||||
classNames: 'field'
|
classNames: 'field'
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,45 @@
|
||||||
|
loadConfig = ->
|
||||||
|
pages_endpoint = $('meta[rel="travis.pages_endpoint"]').attr('href')
|
||||||
|
billing_endpoint = $('meta[rel="travis.billing_endpoint"]').attr('href')
|
||||||
|
customer_io_site_id = $('meta[name="travis.customer_io_site_id"]').attr('value')
|
||||||
|
setupCustomerio(customer_io_site_id) if customer_io_site_id
|
||||||
|
|
||||||
|
enterprise = $('meta[name="travis.enterprise"]').attr('value') == 'true'
|
||||||
|
|
||||||
|
# for now I set pro to true also for enterprise, but it should be changed
|
||||||
|
# to allow more granular config later
|
||||||
|
pro = $('meta[name="travis.pro"]').attr('value') == 'true' || enterprise
|
||||||
|
|
||||||
|
return {
|
||||||
|
syncingPageRedirectionTime: 5000
|
||||||
|
api_endpoint: $('meta[rel="travis.api_endpoint"]').attr('href')
|
||||||
|
source_endpoint: $('meta[rel="travis.source_endpoint"]').attr('href')
|
||||||
|
pusher_key: $('meta[name="travis.pusher_key"]').attr('value')
|
||||||
|
pusher_host: $('meta[name="travis.pusher_host"]').attr('value')
|
||||||
|
ga_code: $('meta[name="travis.ga_code"]').attr('value')
|
||||||
|
code_climate: $('meta[name="travis.code_climate"]').attr('value')
|
||||||
|
ssh_key_enabled: $('meta[name="travis.ssh_key_enabled"]').attr('value') == 'true'
|
||||||
|
code_climate_url: $('meta[name="travis.code_climate_url"]').attr('value')
|
||||||
|
caches_enabled: $('meta[name="travis.caches_enabled"]').attr('value') == 'true'
|
||||||
|
show_repos_hint: 'private'
|
||||||
|
avatar_default_url: 'https://travis-ci.org/images/ui/default-avatar.png'
|
||||||
|
pusher_log_fallback: $('meta[name="travis.pusher_log_fallback"]').attr('value') == 'true'
|
||||||
|
pro: pro
|
||||||
|
enterprise: enterprise
|
||||||
|
sidebar_support_box: pro && !enterprise
|
||||||
|
|
||||||
|
pages_endpoint: pages_endpoint || billing_endpoint
|
||||||
|
billing_endpoint: billing_endpoint
|
||||||
|
|
||||||
|
url_legal: "#{billing_endpoint}/pages/legal"
|
||||||
|
url_imprint: "#{billing_endpoint}/pages/imprint"
|
||||||
|
url_security: "#{billing_endpoint}/pages/security"
|
||||||
|
url_terms: "#{billing_endpoint}/pages/terms"
|
||||||
|
customer_io_site_id: customer_io_site_id
|
||||||
|
|
||||||
|
intervals: { times: -1, updateTimes: 1000 }
|
||||||
|
}
|
||||||
|
|
||||||
initialize = (container, application) ->
|
initialize = (container, application) ->
|
||||||
application.register 'config:main', application.config, { instantiate: false }
|
application.register 'config:main', application.config, { instantiate: false }
|
||||||
|
|
||||||
|
@ -10,4 +52,8 @@ ConfigInitializer =
|
||||||
initialize: initialize
|
initialize: initialize
|
||||||
|
|
||||||
Ember.onLoad 'Ember.Application', (Application) ->
|
Ember.onLoad 'Ember.Application', (Application) ->
|
||||||
|
Application.config loadConfig()
|
||||||
|
|
||||||
|
Application.ajax.pro = Application.config.pro
|
||||||
|
|
||||||
Application.initializer ConfigInitializer
|
Application.initializer ConfigInitializer
|
||||||
|
|
13
assets/scripts/app/mixins/github-url-properties.coffee
Normal file
13
assets/scripts/app/mixins/github-url-properties.coffee
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
githubCommit = Travis.Urls.githubCommit
|
||||||
|
githubPullRequest = Travis.Urls.githubPullRequest
|
||||||
|
|
||||||
|
mixin = Ember.Mixin.create
|
||||||
|
urlGithubCommit: (->
|
||||||
|
githubCommit(@get('repo.slug'), @get('commit.sha'))
|
||||||
|
).property('repo.slug', 'commit.sha')
|
||||||
|
|
||||||
|
urlGithubPullRequest: (->
|
||||||
|
githubPullRequest(@get('repo.slug'), @get('build.pullRequestNumber'))
|
||||||
|
).property('repo.slug', 'build.pullRequestNumber')
|
||||||
|
|
||||||
|
Travis.GithubUrlProperties = mixin
|
|
@ -1,5 +1,4 @@
|
||||||
require 'travis/model'
|
require 'travis/model'
|
||||||
require 'models/extensions'
|
|
||||||
require 'utils/duration-calculations'
|
require 'utils/duration-calculations'
|
||||||
require 'travis/ajax'
|
require 'travis/ajax'
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
require 'travis/model'
|
require 'travis/model'
|
||||||
require 'models/extensions'
|
|
||||||
require 'models/log'
|
require 'models/log'
|
||||||
require 'travis/ajax'
|
require 'travis/ajax'
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
require 'travis/expandable-record-array'
|
require 'travis/expandable-record-array'
|
||||||
require 'travis/model'
|
require 'travis/model'
|
||||||
require 'helpers/helpers'
|
|
||||||
|
|
||||||
Model = Travis.Model
|
Model = Travis.Model
|
||||||
ExpandableRecordArray = Travis.ExpandableRecordArray
|
ExpandableRecordArray = Travis.ExpandableRecordArray
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
require 'travis/location'
|
require 'travis/location'
|
||||||
require 'routes/application'
|
require 'routes/application'
|
||||||
|
|
||||||
Ember.Router.reopen
|
Router = Ember.Router.extend
|
||||||
|
location: 'history'
|
||||||
|
|
||||||
handleURL: (url) ->
|
handleURL: (url) ->
|
||||||
url = url.replace(/#.*?$/, '')
|
url = url.replace(/#.*?$/, '')
|
||||||
@_super(url)
|
@_super(url)
|
||||||
|
|
||||||
Travis.Router.reopen
|
|
||||||
location: 'history'
|
|
||||||
didTransition: ->
|
didTransition: ->
|
||||||
@_super.apply @, arguments
|
@_super.apply @, arguments
|
||||||
|
|
||||||
if Travis.config.ga_code
|
if Travis.config.ga_code
|
||||||
_gaq.push ['_trackPageview', location.pathname]
|
_gaq.push ['_trackPageview', location.pathname]
|
||||||
|
|
||||||
Travis.Router.map ->
|
Router.map ->
|
||||||
@resource 'dashboard', ->
|
@resource 'dashboard', ->
|
||||||
@route 'repositories', path: '/'
|
@route 'repositories', path: '/'
|
||||||
|
|
||||||
|
@ -32,14 +32,14 @@ Travis.Router.map ->
|
||||||
@resource 'pullRequests', path: '/pull_requests'
|
@resource 'pullRequests', path: '/pull_requests'
|
||||||
@resource 'branches', path: '/branches'
|
@resource 'branches', path: '/branches'
|
||||||
@resource 'requests', path: '/requests'
|
@resource 'requests', path: '/requests'
|
||||||
@resource 'caches', path: '/caches' if Travis.config.caches_enabled
|
@resource 'caches', path: '/caches'
|
||||||
@resource 'request', path: '/requests/:request_id'
|
@resource 'request', path: '/requests/:request_id'
|
||||||
|
|
||||||
@resource 'settings', ->
|
@resource 'settings', ->
|
||||||
@route 'index', path: '/'
|
@route 'index', path: '/'
|
||||||
@resource 'env_vars', ->
|
@resource 'env_vars', ->
|
||||||
@route 'new'
|
@route 'new'
|
||||||
@resource 'ssh_key' if Travis.config.ssh_key_enabled
|
@resource 'ssh_key'
|
||||||
|
|
||||||
@route 'first_sync'
|
@route 'first_sync'
|
||||||
@route 'insufficient_oauth_permissions'
|
@route 'insufficient_oauth_permissions'
|
||||||
|
@ -52,3 +52,4 @@ Travis.Router.map ->
|
||||||
|
|
||||||
@route 'notFound', path: "/*path"
|
@route 'notFound', path: "/*path"
|
||||||
|
|
||||||
|
Travis.Router = Router
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
require 'routes/route'
|
require 'routes/route'
|
||||||
require 'models/account'
|
|
||||||
|
|
||||||
Account = Travis.Account
|
|
||||||
TravisRoute = Travis.Route
|
TravisRoute = Travis.Route
|
||||||
|
|
||||||
Route = TravisRoute.extend
|
Route = TravisRoute.extend
|
||||||
|
|
|
@ -20,7 +20,7 @@ Route = SimpleLayoutRoute.extend
|
||||||
if !controller.get('isSyncing')
|
if !controller.get('isSyncing')
|
||||||
self = this
|
self = this
|
||||||
Ember.run.later this, ->
|
Ember.run.later this, ->
|
||||||
Repo.fetch(member: @get('controller.user.login')).then( (repos) ->
|
@store.find('repo', member: @get('controller.user.login')).then( (repos) ->
|
||||||
if repos.get('length')
|
if repos.get('length')
|
||||||
self.transitionTo('main')
|
self.transitionTo('main')
|
||||||
else
|
else
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
require 'routes/route'
|
require 'routes/route'
|
||||||
require 'pusher'
|
|
||||||
|
|
||||||
TravisRoute = Travis.Route
|
TravisRoute = Travis.Route
|
||||||
channels = Travis.Pusher.CHANNELS
|
channels = Travis.Pusher.CHANNELS
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
require 'routes/route'
|
require 'routes/route'
|
||||||
require 'models/request'
|
require 'models/request'
|
||||||
|
|
||||||
Request = Travis.Request
|
|
||||||
TravisRoute = Travis.Route
|
TravisRoute = Travis.Route
|
||||||
|
|
||||||
Route = TravisRoute.extend
|
Route = TravisRoute.extend
|
||||||
|
@ -10,6 +9,6 @@ Route = TravisRoute.extend
|
||||||
@controllerFor('repo').activate('request')
|
@controllerFor('repo').activate('request')
|
||||||
|
|
||||||
model: (params) ->
|
model: (params) ->
|
||||||
Request.fetch params.request_id
|
@store.find 'request', params.request_id
|
||||||
|
|
||||||
Travis.RequestRoute = Route
|
Travis.RequestRoute = Route
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
require 'routes/route'
|
require 'routes/route'
|
||||||
require 'models/request'
|
|
||||||
|
|
||||||
TravisRoute = Travis.Route
|
TravisRoute = Travis.Route
|
||||||
Request = Travis.Request
|
|
||||||
|
|
||||||
Route = TravisRoute.extend
|
Route = TravisRoute.extend
|
||||||
needsAuth: true
|
needsAuth: true
|
||||||
|
@ -12,6 +10,6 @@ Route = TravisRoute.extend
|
||||||
@controllerFor('repo').activate('requests')
|
@controllerFor('repo').activate('requests')
|
||||||
|
|
||||||
model: ->
|
model: ->
|
||||||
Request.fetch repository_id: @modelFor('repo').get('id')
|
@store.find 'request', repository_id: @modelFor('repo').get('id')
|
||||||
|
|
||||||
Travis.RequestsRoute = Route
|
Travis.RequestsRoute = Route
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
@Travis.Slider = (storage) ->
|
|
||||||
@minimize() if storage.getItem('travis.maximized') == 'true'
|
|
||||||
this
|
|
||||||
|
|
||||||
$.extend Travis.Slider.prototype,
|
|
||||||
persist: ->
|
|
||||||
Travis.storage.setItem('travis.maximized', @isMinimized())
|
|
||||||
|
|
||||||
isMinimized: ->
|
|
||||||
return $('body').hasClass('maximized');
|
|
||||||
|
|
||||||
minimize: ->
|
|
||||||
$('body').addClass('maximized')
|
|
||||||
|
|
||||||
toggle: ->
|
|
||||||
$('body').toggleClass('maximized')
|
|
||||||
@persist()
|
|
||||||
# TODO gotta force redraws here :/
|
|
||||||
element = $('<span></span>')
|
|
||||||
$('#top .profile').append(element)
|
|
||||||
Em.run.later (-> element.remove()), 10
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
Travis.Store = DS.Store.extend
|
Store = DS.Store.extend
|
||||||
defaultAdapter: 'application'
|
defaultAdapter: 'application'
|
||||||
adapter: 'application'
|
adapter: 'application'
|
||||||
|
|
||||||
|
Travis.Store = Store
|
||||||
|
|
|
@ -1,30 +0,0 @@
|
||||||
@Travis.FixtureAdapter = DS.Adapter.extend
|
|
||||||
find: (store, type, id) ->
|
|
||||||
fixtures = type.FIXTURES
|
|
||||||
Ember.assert "Unable to find fixtures for model type " + type.toString(), !!fixtures
|
|
||||||
return if fixtures.hasLoaded
|
|
||||||
setTimeout (->
|
|
||||||
store.loadMany type, fixtures
|
|
||||||
fixtures.hasLoaded = true
|
|
||||||
), 300
|
|
||||||
|
|
||||||
findMany: ->
|
|
||||||
@find.apply this, arguments
|
|
||||||
|
|
||||||
findAll: (store, type) ->
|
|
||||||
fixtures = type.FIXTURES
|
|
||||||
Ember.assert "Unable to find fixtures for model type " + type.toString(), !!fixtures
|
|
||||||
ids = fixtures.map (item, index, self) ->
|
|
||||||
item.id
|
|
||||||
store.loadMany type, ids, fixtures
|
|
||||||
|
|
||||||
findQuery: (store, type, params, array) ->
|
|
||||||
fixtures = type.FIXTURES
|
|
||||||
Ember.assert "Unable to find fixtures for model type " + type.toString(), !!fixtures
|
|
||||||
hashes = for fixture in fixtures
|
|
||||||
matches = for key, value of params
|
|
||||||
key == 'orderBy' || fixture[key] == value
|
|
||||||
if matches.reduce((a, b) -> a && b) then fixture else null
|
|
||||||
array.load(hashes.compact())
|
|
||||||
|
|
||||||
|
|
|
@ -1,150 +0,0 @@
|
||||||
require 'travis/ajax'
|
|
||||||
require 'models'
|
|
||||||
|
|
||||||
DS.JSONTransforms['object'] = {
|
|
||||||
deserialize: (serialized) -> serialized
|
|
||||||
serialize: (deserialized) -> deserialized
|
|
||||||
}
|
|
||||||
|
|
||||||
Travis.Serializer = DS.RESTSerializer.extend
|
|
||||||
# The next 3 methods specify the behavior of adding records to dirty sets
|
|
||||||
# (ie. which records will be treated as dirty on the next commit). We don't
|
|
||||||
# allow to change most of the records on the client, so for anything except
|
|
||||||
# the User, we ignore dirtyiness.
|
|
||||||
dirtyRecordsForAttributeChange: (dirtySet, record) ->
|
|
||||||
if record.constructor == Travis.User
|
|
||||||
@_super.apply this, arguments
|
|
||||||
|
|
||||||
dirtyRecordsForBelongsToChange: (dirtySet, record) ->
|
|
||||||
if record.constructor == Travis.User
|
|
||||||
@_super.apply this, arguments
|
|
||||||
|
|
||||||
dirtyRecordsForHasManyChange: (dirtySet, record) ->
|
|
||||||
if record.constructor == Travis.User
|
|
||||||
@_super.apply this, arguments
|
|
||||||
|
|
||||||
merge: (record, serialized) ->
|
|
||||||
data = record.get('data')
|
|
||||||
|
|
||||||
# TODO: write test that ensures that we go to materializingData
|
|
||||||
# only if we can
|
|
||||||
state = record.get('stateManager.currentState.path')
|
|
||||||
unless state == "rootState.loaded.materializing"
|
|
||||||
record.send('materializingData')
|
|
||||||
|
|
||||||
record.eachAttribute( (name, attribute) ->
|
|
||||||
value = @extractAttribute(record.constructor, serialized, name)
|
|
||||||
if value != undefined
|
|
||||||
value = @deserializeValue(value, attribute.type)
|
|
||||||
if value != data.attributes[name]
|
|
||||||
record.materializeAttribute(name, value)
|
|
||||||
record.notifyPropertyChange(name)
|
|
||||||
, this)
|
|
||||||
|
|
||||||
record.eachRelationship( (name, relationship) ->
|
|
||||||
if relationship.kind == 'belongsTo'
|
|
||||||
key = @_keyForBelongsTo(record.constructor, relationship.key)
|
|
||||||
value = @extractBelongsTo(record.constructor, serialized, key)
|
|
||||||
|
|
||||||
if value != undefined && data.belongsTo[name] != value
|
|
||||||
record.materializeBelongsTo name, value
|
|
||||||
record.notifyPropertyChange(name)
|
|
||||||
else if relationship.kind == 'hasMany'
|
|
||||||
key = @_keyForHasMany(record.constructor, relationship.key)
|
|
||||||
value = @extractHasMany(record.constructor, serialized, key)
|
|
||||||
|
|
||||||
if value != undefined
|
|
||||||
record.materializeHasMany name, value
|
|
||||||
record.notifyPropertyChange(name)
|
|
||||||
, this)
|
|
||||||
|
|
||||||
record.notifyPropertyChange('data')
|
|
||||||
|
|
||||||
Travis.RestAdapter = DS.RESTAdapter.extend
|
|
||||||
serializer: Travis.Serializer
|
|
||||||
mappings:
|
|
||||||
broadcasts: Travis.Broadcast
|
|
||||||
repositories: Travis.Repo
|
|
||||||
repository: Travis.Repo
|
|
||||||
repos: Travis.Repo
|
|
||||||
repo: Travis.Repo
|
|
||||||
builds: Travis.Build
|
|
||||||
build: Travis.Build
|
|
||||||
commits: Travis.Commit
|
|
||||||
commit: Travis.Commit
|
|
||||||
jobs: Travis.Job
|
|
||||||
job: Travis.Job
|
|
||||||
account: Travis.Account
|
|
||||||
accounts: Travis.Account
|
|
||||||
worker: Travis.Worker
|
|
||||||
workers: Travis.Worker
|
|
||||||
annotation: Travis.Annotation
|
|
||||||
annotations: Travis.Annotation
|
|
||||||
|
|
||||||
plurals:
|
|
||||||
repositories: 'repositories',
|
|
||||||
repository: 'repositories',
|
|
||||||
repo: 'repos',
|
|
||||||
repos: 'repos',
|
|
||||||
build: 'builds'
|
|
||||||
branch: 'branches'
|
|
||||||
job: 'jobs'
|
|
||||||
worker: 'workers'
|
|
||||||
profile: 'profile'
|
|
||||||
annotation: 'annotations'
|
|
||||||
|
|
||||||
ajax: ->
|
|
||||||
Travis.ajax.ajax.apply(this, arguments)
|
|
||||||
|
|
||||||
sideload: (store, type, json, root) ->
|
|
||||||
if json && json.result
|
|
||||||
return
|
|
||||||
else
|
|
||||||
@_super.apply this, arguments
|
|
||||||
|
|
||||||
merge: (store, record, serialized) ->
|
|
||||||
@get('serializer').merge(record, serialized)
|
|
||||||
|
|
||||||
didFindRecord: (store, type, payload, id) ->
|
|
||||||
if (type == Travis.Build || type == Travis.Job) && payload.commit?
|
|
||||||
payload.commits = payload.commit
|
|
||||||
delete payload.commit
|
|
||||||
|
|
||||||
@_super.apply this, arguments
|
|
||||||
|
|
||||||
didSaveRecord: (store, type, record, payload) ->
|
|
||||||
# API sometimes return { result: true } response
|
|
||||||
# which does not play nice with ember-data. For now
|
|
||||||
# let's just change payload to have serialized record
|
|
||||||
# included, but ideally it should be fixed in the API
|
|
||||||
# to be consistent across all the endpoints.
|
|
||||||
if payload?.result == true
|
|
||||||
payload = {}
|
|
||||||
payload[type.singularName()] = record.serialize()
|
|
||||||
|
|
||||||
@_super(store, type, record, payload)
|
|
||||||
|
|
||||||
Travis.RestAdapter.map 'Travis.Commit', {}
|
|
||||||
|
|
||||||
Travis.RestAdapter.map 'Travis.Build', {
|
|
||||||
repoId: { key: 'repository_id' }
|
|
||||||
repo: { key: 'repository_id' }
|
|
||||||
_duration: { key: 'duration' }
|
|
||||||
jobs: { key: 'job_ids' }
|
|
||||||
_config: { key: 'config' }
|
|
||||||
}
|
|
||||||
|
|
||||||
Travis.RestAdapter.map 'Travis.Repo', {
|
|
||||||
_lastBuildDuration: { key: 'last_build_duration' }
|
|
||||||
}
|
|
||||||
|
|
||||||
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', {
|
|
||||||
_name: { key: 'name' }
|
|
||||||
}
|
|
|
@ -1,5 +1,3 @@
|
||||||
require 'helpers/helpers'
|
|
||||||
|
|
||||||
durationFrom = Travis.Helpers.durationFrom
|
durationFrom = Travis.Helpers.durationFrom
|
||||||
|
|
||||||
Travis.DurationCalculations = Ember.Mixin.create
|
Travis.DurationCalculations = Ember.Mixin.create
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
require 'config/emoij'
|
require 'config/emoij'
|
||||||
require 'helpers/urls'
|
|
||||||
|
|
||||||
config_keys_map = Travis.CONFIG_KEYS_MAP
|
config_keys_map = Travis.CONFIG_KEYS_MAP
|
||||||
config = Travis.config
|
config = Travis.config
|
||||||
|
|
25
assets/scripts/app/utils/keys-map.coffee
Normal file
25
assets/scripts/app/utils/keys-map.coffee
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
keys = {
|
||||||
|
go: 'Go'
|
||||||
|
rvm: 'Ruby'
|
||||||
|
gemfile: 'Gemfile'
|
||||||
|
env: 'ENV'
|
||||||
|
jdk: 'JDK'
|
||||||
|
otp_release: 'OTP Release'
|
||||||
|
php: 'PHP'
|
||||||
|
node_js: 'Node.js'
|
||||||
|
perl: 'Perl'
|
||||||
|
python: 'Python'
|
||||||
|
scala: 'Scala'
|
||||||
|
compiler: 'Compiler'
|
||||||
|
ghc: 'GHC'
|
||||||
|
os: 'OS'
|
||||||
|
ruby: 'Ruby'
|
||||||
|
xcode_sdk: 'Xcode SDK'
|
||||||
|
xcode_scheme:'Xcode Scheme'
|
||||||
|
d: 'D'
|
||||||
|
julia: 'Julia'
|
||||||
|
csharp: 'C#'
|
||||||
|
dart: 'Dart'
|
||||||
|
}
|
||||||
|
|
||||||
|
Travis.CONFIG_KEYS_MAP = keys
|
|
@ -1,4 +1,4 @@
|
||||||
Travis.LimitedArray = Em.ArrayProxy.extend
|
LimitedArray = Ember.ArrayProxy.extend
|
||||||
limit: 10
|
limit: 10
|
||||||
isLoadedBinding: 'content.isLoaded'
|
isLoadedBinding: 'content.isLoaded'
|
||||||
arrangedContent: Ember.computed.limit('content', 'limit')
|
arrangedContent: Ember.computed.limit('content', 'limit')
|
||||||
|
@ -21,3 +21,5 @@ Travis.LimitedArray = Em.ArrayProxy.extend
|
||||||
|
|
||||||
showAll: ->
|
showAll: ->
|
||||||
@set 'limit', Infinity
|
@set 'limit', Infinity
|
||||||
|
|
||||||
|
Travis.LimitedArray = LimitedArray
|
22
assets/scripts/app/utils/slider.coffee
Normal file
22
assets/scripts/app/utils/slider.coffee
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
Slider = (storage) ->
|
||||||
|
@minimize() if storage.getItem('travis.maximized') == 'true'
|
||||||
|
this
|
||||||
|
|
||||||
|
Slider.prototype.persist = ->
|
||||||
|
Travis.storage.setItem('travis.maximized', @isMinimized())
|
||||||
|
|
||||||
|
Slider.prototype.isMinimized = ->
|
||||||
|
return $('body').hasClass('maximized');
|
||||||
|
|
||||||
|
Slider.prototype.minimize = ->
|
||||||
|
$('body').addClass('maximized')
|
||||||
|
|
||||||
|
Slider.prototype.toggle = ->
|
||||||
|
$('body').toggleClass('maximized')
|
||||||
|
@persist()
|
||||||
|
# TODO gotta force redraws here :/
|
||||||
|
element = $('<span></span>')
|
||||||
|
$('#top .profile').append(element)
|
||||||
|
Em.run.later (-> element.remove()), 10
|
||||||
|
|
||||||
|
Travis.Slider = Slider
|
|
@ -1,5 +1,3 @@
|
||||||
get = Ember.get
|
|
||||||
|
|
||||||
Error = Ember.Object.extend
|
Error = Ember.Object.extend
|
||||||
message: (->
|
message: (->
|
||||||
switch code = @get('code')
|
switch code = @get('code')
|
||||||
|
@ -43,13 +41,13 @@ Validator = Ember.Object.extend
|
||||||
|
|
||||||
isValid: (target) ->
|
isValid: (target) ->
|
||||||
name = @get('name')
|
name = @get('name')
|
||||||
@get('validator').call(target, get(target, name))
|
@get('validator').call(target, Ember.get(target, name))
|
||||||
|
|
||||||
validate: (target) ->
|
validate: (target) ->
|
||||||
unless @isValid(target)
|
unless @isValid(target)
|
||||||
@setError(target)
|
@setError(target)
|
||||||
|
|
||||||
Travis.Validations = Ember.Mixin.create
|
Validations = Ember.Mixin.create
|
||||||
init: ->
|
init: ->
|
||||||
@_super.apply this, arguments
|
@_super.apply this, arguments
|
||||||
|
|
||||||
|
@ -89,3 +87,5 @@ Travis.Validations = Ember.Mixin.create
|
||||||
addErrorsFromResponse: (errors) ->
|
addErrorsFromResponse: (errors) ->
|
||||||
for error in errors
|
for error in errors
|
||||||
@get('errors').add(error.field, error.code)
|
@get('errors').add(error.field, error.code)
|
||||||
|
|
||||||
|
Travis.Validations = Validations
|
|
@ -1,5 +1,3 @@
|
||||||
require 'helpers/helpers'
|
|
||||||
|
|
||||||
colorForState = Travis.Helpers.colorForState
|
colorForState = Travis.Helpers.colorForState
|
||||||
|
|
||||||
View = Travis.View.extend
|
View = Travis.View.extend
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
require 'helpers/helpers'
|
|
||||||
|
|
||||||
colorForState = Travis.Helpers.colorForState
|
colorForState = Travis.Helpers.colorForState
|
||||||
githubCommit = Travis.Urls.githubCommit
|
githubCommit = Travis.Urls.githubCommit
|
||||||
gravatarImage = Travis.Urls.gravatarImage
|
gravatarImage = Travis.Urls.gravatarImage
|
||||||
|
|
|
@ -6,89 +6,10 @@ require 'app'
|
||||||
window.ENV ||= {}
|
window.ENV ||= {}
|
||||||
window.ENV.RAISE_ON_DEPRECATION = true
|
window.ENV.RAISE_ON_DEPRECATION = true
|
||||||
|
|
||||||
window.Travis = TravisApplication.create(
|
window.Travis = App.create()
|
||||||
LOG_ACTIVE_GENERATION: true,
|
|
||||||
LOG_MODULE_RESOLVER: true,
|
|
||||||
LOG_TRANSITIONS: true,
|
|
||||||
LOG_TRANSITIONS_INTERNAL: true,
|
|
||||||
LOG_VIEW_LOOKUPS: true
|
|
||||||
)
|
|
||||||
|
|
||||||
Travis.deferReadiness()
|
Travis.deferReadiness()
|
||||||
|
|
||||||
pages_endpoint = $('meta[rel="travis.pages_endpoint"]').attr('href')
|
|
||||||
billing_endpoint = $('meta[rel="travis.billing_endpoint"]').attr('href')
|
|
||||||
customer_io_site_id = $('meta[name="travis.customer_io_site_id"]').attr('value')
|
|
||||||
setupCustomerio(customer_io_site_id) if customer_io_site_id
|
|
||||||
|
|
||||||
enterprise = $('meta[name="travis.enterprise"]').attr('value') == 'true'
|
|
||||||
|
|
||||||
# for now I set pro to true also for enterprise, but it should be changed
|
|
||||||
# to allow more granular config later
|
|
||||||
pro = $('meta[name="travis.pro"]').attr('value') == 'true' || enterprise
|
|
||||||
|
|
||||||
$.extend Travis,
|
|
||||||
run: ->
|
|
||||||
Travis.advanceReadiness() # bc, remove once merged to master
|
|
||||||
|
|
||||||
config:
|
|
||||||
syncingPageRedirectionTime: 5000
|
|
||||||
api_endpoint: $('meta[rel="travis.api_endpoint"]').attr('href')
|
|
||||||
source_endpoint: $('meta[rel="travis.source_endpoint"]').attr('href')
|
|
||||||
pusher_key: $('meta[name="travis.pusher_key"]').attr('value')
|
|
||||||
pusher_host: $('meta[name="travis.pusher_host"]').attr('value')
|
|
||||||
ga_code: $('meta[name="travis.ga_code"]').attr('value')
|
|
||||||
code_climate: $('meta[name="travis.code_climate"]').attr('value')
|
|
||||||
ssh_key_enabled: $('meta[name="travis.ssh_key_enabled"]').attr('value') == 'true'
|
|
||||||
code_climate_url: $('meta[name="travis.code_climate_url"]').attr('value')
|
|
||||||
caches_enabled: $('meta[name="travis.caches_enabled"]').attr('value') == 'true'
|
|
||||||
show_repos_hint: 'private'
|
|
||||||
avatar_default_url: 'https://travis-ci.org/images/ui/default-avatar.png'
|
|
||||||
pusher_log_fallback: $('meta[name="travis.pusher_log_fallback"]').attr('value') == 'true'
|
|
||||||
pro: pro
|
|
||||||
enterprise: enterprise
|
|
||||||
sidebar_support_box: pro && !enterprise
|
|
||||||
|
|
||||||
pages_endpoint: pages_endpoint || billing_endpoint
|
|
||||||
billing_endpoint: billing_endpoint
|
|
||||||
|
|
||||||
url_legal: "#{billing_endpoint}/pages/legal"
|
|
||||||
url_imprint: "#{billing_endpoint}/pages/imprint"
|
|
||||||
url_security: "#{billing_endpoint}/pages/security"
|
|
||||||
url_terms: "#{billing_endpoint}/pages/terms"
|
|
||||||
customer_io_site_id: customer_io_site_id
|
|
||||||
|
|
||||||
CONFIG_KEYS_MAP: {
|
|
||||||
go: 'Go'
|
|
||||||
rvm: 'Ruby'
|
|
||||||
gemfile: 'Gemfile'
|
|
||||||
env: 'ENV'
|
|
||||||
jdk: 'JDK'
|
|
||||||
otp_release: 'OTP Release'
|
|
||||||
php: 'PHP'
|
|
||||||
node_js: 'Node.js'
|
|
||||||
perl: 'Perl'
|
|
||||||
python: 'Python'
|
|
||||||
scala: 'Scala'
|
|
||||||
compiler: 'Compiler'
|
|
||||||
ghc: 'GHC'
|
|
||||||
os: 'OS'
|
|
||||||
ruby: 'Ruby'
|
|
||||||
xcode_sdk: 'Xcode SDK'
|
|
||||||
xcode_scheme:'Xcode Scheme'
|
|
||||||
d: 'D'
|
|
||||||
julia: 'Julia'
|
|
||||||
csharp: 'C#'
|
|
||||||
dart: 'Dart'
|
|
||||||
}
|
|
||||||
|
|
||||||
QUEUES: [
|
|
||||||
{ name: 'linux', display: 'Linux' }
|
|
||||||
{ name: 'mac_osx', display: 'Mac and OSX' }
|
|
||||||
]
|
|
||||||
|
|
||||||
INTERVALS: { times: -1, updateTimes: 1000 }
|
|
||||||
|
|
||||||
Ember.LinkView.reopen
|
Ember.LinkView.reopen
|
||||||
loadingClass: 'loading_link'
|
loadingClass: 'loading_link'
|
||||||
|
|
||||||
|
@ -101,8 +22,15 @@ if charm_key = $('meta[name="travis.charm_key"]').attr('value')
|
||||||
|
|
||||||
require 'travis/ajax'
|
require 'travis/ajax'
|
||||||
|
|
||||||
Travis.ajax.pro = Travis.config.pro
|
require 'utils/urls'
|
||||||
|
require 'utils/helpers'
|
||||||
|
require 'utils/status-image-formats'
|
||||||
|
require 'utils/pusher'
|
||||||
|
require 'utils/slider'
|
||||||
|
require 'utils/tailing'
|
||||||
|
require 'mixins/github-url-properties'
|
||||||
|
|
||||||
|
require 'utils/keys-map'
|
||||||
require 'adapters/application'
|
require 'adapters/application'
|
||||||
require 'serializers/application'
|
require 'serializers/application'
|
||||||
require 'serializers/repo'
|
require 'serializers/repo'
|
||||||
|
@ -168,11 +96,13 @@ require 'controllers/job'
|
||||||
require 'controllers/profile'
|
require 'controllers/profile'
|
||||||
require 'controllers/repos'
|
require 'controllers/repos'
|
||||||
require 'controllers/repo'
|
require 'controllers/repo'
|
||||||
require 'controllers/settings'
|
require 'controllers/settings/index'
|
||||||
require 'controllers/current-user'
|
require 'controllers/current-user'
|
||||||
require 'controllers/request'
|
require 'controllers/request'
|
||||||
require 'controllers/requests'
|
require 'controllers/requests'
|
||||||
require 'controllers/caches'
|
require 'controllers/caches'
|
||||||
|
require 'controllers/caches-item'
|
||||||
|
require 'controllers/caches-by-branch'
|
||||||
require 'controllers/env-var'
|
require 'controllers/env-var'
|
||||||
require 'controllers/env-vars'
|
require 'controllers/env-vars'
|
||||||
require 'controllers/env-var-new'
|
require 'controllers/env-var-new'
|
||||||
|
@ -187,11 +117,6 @@ require 'controllers/queue'
|
||||||
require 'controllers/running-jobs'
|
require 'controllers/running-jobs'
|
||||||
require 'controllers/dashboard/repositories'
|
require 'controllers/dashboard/repositories'
|
||||||
|
|
||||||
require 'utils/helpers'
|
|
||||||
require 'utils/urls'
|
|
||||||
require 'helpers/status-image-formats'
|
|
||||||
require 'helpers/github-url-properties'
|
|
||||||
|
|
||||||
Travis.Handlebars = {}
|
Travis.Handlebars = {}
|
||||||
|
|
||||||
require 'helpers/label'
|
require 'helpers/label'
|
||||||
|
@ -241,7 +166,6 @@ Ember.LinkView.reopen
|
||||||
_trackEvent: (event) ->
|
_trackEvent: (event) ->
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
|
|
||||||
require 'models/extensions'
|
|
||||||
require 'models/account'
|
require 'models/account'
|
||||||
require 'models/broadcast'
|
require 'models/broadcast'
|
||||||
require 'models/branch'
|
require 'models/branch'
|
||||||
|
@ -258,11 +182,6 @@ require 'models/user'
|
||||||
require 'models/env-var'
|
require 'models/env-var'
|
||||||
require 'models/ssh-key'
|
require 'models/ssh-key'
|
||||||
|
|
||||||
require 'utlils/pusher'
|
|
||||||
require 'slider'
|
|
||||||
require 'tailing'
|
|
||||||
require 'templates'
|
|
||||||
|
|
||||||
require 'ext/ember/namespace'
|
require 'ext/ember/namespace'
|
||||||
require 'views/view'
|
require 'views/view'
|
||||||
require 'views/accounts'
|
require 'views/accounts'
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
<script src="/scripts/app.js"></script>
|
<script src="/scripts/app.js"></script>
|
||||||
<script>
|
<script>
|
||||||
minispade.require('travis')
|
minispade.require('travis')
|
||||||
Travis.run()
|
Travis.advanceReadiness()
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body id="home"></body>
|
<body id="home"></body>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user