More ember-cli compat in views
This commit is contained in:
parent
3f3781459d
commit
5fd821d59e
|
@ -1,6 +1,8 @@
|
||||||
Travis.ObjectTransform = DS.Transform.extend
|
Transform = DS.Transform.extend
|
||||||
deserialize: (serialized) ->
|
deserialize: (serialized) ->
|
||||||
serialized
|
serialized
|
||||||
|
|
||||||
serialize: (deserialized) ->
|
serialize: (deserialized) ->
|
||||||
deserialized
|
deserialized
|
||||||
|
|
||||||
|
Travis.ObjectTransform = Transform
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class Travis.LinesSelector
|
class LinesSelector
|
||||||
Location:
|
Location:
|
||||||
getHash: ->
|
getHash: ->
|
||||||
window.location.hash
|
window.location.hash
|
||||||
|
@ -71,3 +71,5 @@ class Travis.LinesSelector
|
||||||
first = match[1]
|
first = match[1]
|
||||||
last = match[3] || match[1]
|
last = match[3] || match[1]
|
||||||
{first: first, last: last}
|
{first: first, last: last}
|
||||||
|
|
||||||
|
Travis.LinesSelector = LinesSelector
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
Travis.LogChunks = Em.ArrayProxy.extend
|
LogChunks = Ember.ArrayProxy.extend
|
||||||
timeout: 30000
|
timeout: 30000
|
||||||
|
|
||||||
init: ->
|
init: ->
|
||||||
|
@ -80,3 +80,5 @@ Travis.LogChunks = Em.ArrayProxy.extend
|
||||||
Ember.run.once this, ->
|
Ember.run.once this, ->
|
||||||
@tryFinalizing()
|
@tryFinalizing()
|
||||||
@resetTimeout()
|
@resetTimeout()
|
||||||
|
|
||||||
|
Travis.LogChunks = LogChunks
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class Travis.LogFolder
|
class LogFolder
|
||||||
constructor: (@element) ->
|
constructor: (@element) ->
|
||||||
@element.on 'click', '.fold', (event) =>
|
@element.on 'click', '.fold', (event) =>
|
||||||
folder = @getFolderFromLine $(event.target)
|
folder = @getFolderFromLine $(event.target)
|
||||||
|
@ -22,3 +22,5 @@ class Travis.LogFolder
|
||||||
|
|
||||||
getFolderFromLine: (line) ->
|
getFolderFromLine: (line) ->
|
||||||
line.parent('.fold')
|
line.parent('.fold')
|
||||||
|
|
||||||
|
Travis.LogFolder = LogFolder
|
||||||
|
|
1075
assets/scripts/app/vendor/log.js
vendored
Normal file
1075
assets/scripts/app/vendor/log.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
11
assets/scripts/app/views/accounts-info.coffee
Normal file
11
assets/scripts/app/views/accounts-info.coffee
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
BasicView = Travis.BasicView
|
||||||
|
|
||||||
|
View = BasicView.extend
|
||||||
|
templateName: 'profile/tabs/user'
|
||||||
|
userBinding: 'controller.user'
|
||||||
|
|
||||||
|
gravatarUrl: (->
|
||||||
|
"#{location.protocol}//www.gravatar.com/avatar/#{@get('user.gravatarId')}?s=200&d=mm"
|
||||||
|
).property('user.gravatarId')
|
||||||
|
|
||||||
|
AccountsInfoView = View
|
30
assets/scripts/app/views/accounts-list.coffee
Normal file
30
assets/scripts/app/views/accounts-list.coffee
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
accountUrl = Travis.Urls.account
|
||||||
|
|
||||||
|
View = Ember.CollectionView.extend
|
||||||
|
elementId: 'accounts'
|
||||||
|
accountBinding: 'content'
|
||||||
|
tagName: 'ul'
|
||||||
|
|
||||||
|
emptyView: Ember.View.extend
|
||||||
|
template: Ember.Handlebars.compile('<div class="loading"><span>Loading</span></div>')
|
||||||
|
|
||||||
|
itemViewClass: Ember.View.extend
|
||||||
|
accountBinding: 'content'
|
||||||
|
typeBinding: 'content.type'
|
||||||
|
selectedBinding: 'account.selected'
|
||||||
|
|
||||||
|
classNames: ['account']
|
||||||
|
classNameBindings: ['type', 'selected']
|
||||||
|
|
||||||
|
name: (->
|
||||||
|
@get('content.name') || @get('content.login')
|
||||||
|
).property('content.login', 'content.name')
|
||||||
|
|
||||||
|
urlAccount: (->
|
||||||
|
accountUrl(@get('account.login'))
|
||||||
|
).property('account.login')
|
||||||
|
|
||||||
|
click: ->
|
||||||
|
@get('controller').transitionToRoute("account", @get('account.login'))
|
||||||
|
|
||||||
|
AccountsListView = View
|
|
@ -1,34 +0,0 @@
|
||||||
@Travis.reopen
|
|
||||||
ProfileAccountsView: Travis.BasicView.extend
|
|
||||||
tabBinding: 'controller.tab'
|
|
||||||
templateName: 'profile/accounts'
|
|
||||||
classAccounts: (->
|
|
||||||
'active' if @get('tab') == 'accounts'
|
|
||||||
).property('tab')
|
|
||||||
|
|
||||||
AccountsListView: Em.CollectionView.extend
|
|
||||||
elementId: 'accounts'
|
|
||||||
accountBinding: 'content'
|
|
||||||
tagName: 'ul'
|
|
||||||
|
|
||||||
emptyView: Ember.View.extend
|
|
||||||
template: Ember.Handlebars.compile('<div class="loading"><span>Loading</span></div>')
|
|
||||||
|
|
||||||
itemViewClass: Travis.BasicView.extend
|
|
||||||
accountBinding: 'content'
|
|
||||||
typeBinding: 'content.type'
|
|
||||||
selectedBinding: 'account.selected'
|
|
||||||
|
|
||||||
classNames: ['account']
|
|
||||||
classNameBindings: ['type', 'selected']
|
|
||||||
|
|
||||||
name: (->
|
|
||||||
@get('content.name') || @get('content.login')
|
|
||||||
).property('content.login', 'content.name')
|
|
||||||
|
|
||||||
urlAccount: (->
|
|
||||||
Travis.Urls.account(@get('account.login'))
|
|
||||||
).property('account.login')
|
|
||||||
|
|
||||||
click: ->
|
|
||||||
@get('controller').transitionToRoute("account", @get('account.login'))
|
|
|
@ -1,4 +1,6 @@
|
||||||
Travis.reopen
|
BasicView = Travis.BasicView
|
||||||
AnnotationsView: Travis.BasicView.extend
|
|
||||||
|
View = BasicView.extend
|
||||||
templateName: 'annotations/list'
|
templateName: 'annotations/list'
|
||||||
|
|
||||||
|
Travis.AnnotationsView = View
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
Travis.reopen
|
View = Ember.View.extend()
|
||||||
AnnotationsView: Travis.BasicView.extend
|
|
||||||
|
Travis.AnnotationsView = View
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
Travis.reopen
|
BasicView = Travis.BasicView
|
||||||
ApplicationView: Travis.BasicView.extend
|
|
||||||
|
View = BasicView.extend
|
||||||
classNames: ['application']
|
classNames: ['application']
|
||||||
click: (event) ->
|
click: (event) ->
|
||||||
# TODO: this solves the case of closing menus and popups,
|
# TODO: this solves the case of closing menus and popups,
|
||||||
|
@ -15,3 +16,4 @@ Travis.reopen
|
||||||
if ! targetAndParents.hasClass('menu') && !targetAndParents.is('#tools > a')
|
if ! targetAndParents.hasClass('menu') && !targetAndParents.is('#tools > a')
|
||||||
$('.menu').removeClass('display')
|
$('.menu').removeClass('display')
|
||||||
|
|
||||||
|
ApplicationView = View
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
colorForState = Travis.Helpers.colorForState
|
colorForState = Travis.Helpers.colorForState
|
||||||
|
BasicView = Travis.BasicView
|
||||||
|
|
||||||
View = Travis.BasicView.extend
|
View = BasicView.extend
|
||||||
classNameBindings: ['color', 'loading']
|
classNameBindings: ['color', 'loading']
|
||||||
buildBinding: 'controller.build'
|
buildBinding: 'controller.build'
|
||||||
loadingBinding: 'controller.loading'
|
loadingBinding: 'controller.loading'
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
require 'views/basic'
|
require 'views/basic'
|
||||||
|
|
||||||
TravisView = Travis.BasicView
|
View = Ember.View.extend
|
||||||
|
|
||||||
View = TravisView.extend
|
|
||||||
layoutName: 'layouts/dashboard'
|
layoutName: 'layouts/dashboard'
|
||||||
classNames: ['dashboard']
|
classNames: ['dashboard']
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
View = Travis.BasicView.extend
|
BasicView = Travis.BasicView
|
||||||
|
|
||||||
|
View = BasicView.extend
|
||||||
layoutName: 'layouts/simple'
|
layoutName: 'layouts/simple'
|
||||||
|
|
||||||
Travis.FirstSyncView = View
|
Travis.FirstSyncView = View
|
||||||
|
|
15
assets/scripts/app/views/flash-item.coffee
Normal file
15
assets/scripts/app/views/flash-item.coffee
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
BasicView = Travis.BasicView
|
||||||
|
|
||||||
|
View = BasicView.extend
|
||||||
|
tagName: 'li'
|
||||||
|
classNameBindings: ['type']
|
||||||
|
|
||||||
|
type: (->
|
||||||
|
@get('flash.type') || 'broadcast'
|
||||||
|
).property('flash.type')
|
||||||
|
|
||||||
|
actions:
|
||||||
|
close: ->
|
||||||
|
@get('controller').close(@get('flash'))
|
||||||
|
|
||||||
|
FlashItemView = View
|
|
@ -1,17 +1,8 @@
|
||||||
@Travis.reopen
|
BasicView = Travis.BasicView
|
||||||
FlashView: Travis.BasicView.extend
|
|
||||||
|
View = BasicView.extend
|
||||||
classNames: ['flash']
|
classNames: ['flash']
|
||||||
tagName: 'ul'
|
tagName: 'ul'
|
||||||
templateName: 'layouts/flash'
|
templateName: 'layouts/flash'
|
||||||
|
|
||||||
FlashItemView: Travis.BasicView.extend
|
Travis.FlashView = View
|
||||||
tagName: 'li'
|
|
||||||
classNameBindings: ['type']
|
|
||||||
|
|
||||||
type: (->
|
|
||||||
@get('flash.type') || 'broadcast'
|
|
||||||
).property('flash.type')
|
|
||||||
|
|
||||||
actions:
|
|
||||||
close: ->
|
|
||||||
@get('controller').close(@get('flash'))
|
|
||||||
|
|
12
assets/scripts/app/views/hooks.coffee
Normal file
12
assets/scripts/app/views/hooks.coffee
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
BasicView = Travis.BasicView
|
||||||
|
githubAdminUrl = Travis.Urls.githubAdmin
|
||||||
|
|
||||||
|
View = BasicView.extend
|
||||||
|
templateName: 'profile/tabs/hooks'
|
||||||
|
userBinding: 'controller.user'
|
||||||
|
|
||||||
|
urlGithubAdmin: (->
|
||||||
|
githubAdminUrl(@get('hook.slug'))
|
||||||
|
).property('hook.slug')
|
||||||
|
|
||||||
|
HooksView = View
|
|
@ -1,11 +1,14 @@
|
||||||
View = Travis.BasicView.extend
|
colorForState = Travis.Helpers.colorForState
|
||||||
|
BasicView = Travis.BasicView
|
||||||
|
|
||||||
|
View = BasicView.extend
|
||||||
tagName: 'tr'
|
tagName: 'tr'
|
||||||
classNameBindings: ['color']
|
classNameBindings: ['color']
|
||||||
repoBinding: 'context.repo'
|
repoBinding: 'context.repo'
|
||||||
jobBinding: 'context'
|
jobBinding: 'context'
|
||||||
|
|
||||||
color: (->
|
color: (->
|
||||||
Travis.Helpers.colorForState(@get('job.state'))
|
colorForState(@get('job.state'))
|
||||||
).property('job.state')
|
).property('job.state')
|
||||||
|
|
||||||
Travis.JobsItemView = View
|
Travis.JobsItemView = View
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
@Travis.reopen
|
|
||||||
ReposView: Travis.BasicView.extend
|
|
||||||
templateName: 'repos/list'
|
|
||||||
tabBinding: 'controller.tab'
|
|
||||||
|
|
||||||
classRecent: (->
|
|
||||||
'active' if @get('tab') == 'recent'
|
|
||||||
).property('tab')
|
|
||||||
|
|
||||||
classOwned: (->
|
|
||||||
classes = []
|
|
||||||
classes.push('active') if @get('tab') == 'owned'
|
|
||||||
classes.push('display') if @get('controller.currentUser')
|
|
||||||
classes.join(' ')
|
|
||||||
).property('tab', 'controller.currentUser')
|
|
||||||
|
|
||||||
classSearch: (->
|
|
||||||
'active' if @get('tab') == 'search'
|
|
||||||
).property('tab')
|
|
||||||
|
|
|
@ -1,14 +1,10 @@
|
||||||
require 'log'
|
BasicView = Travis.BasicView
|
||||||
require 'utils/lines-selector'
|
|
||||||
require 'utils/log-folder'
|
|
||||||
|
|
||||||
Log.DEBUG = false
|
Log.DEBUG = false
|
||||||
Log.LIMIT = 10000
|
Log.LIMIT = 10000
|
||||||
|
|
||||||
config = ENV.config
|
config = ENV.config
|
||||||
|
|
||||||
Travis.reopen
|
View = BasicView.extend
|
||||||
LogView: Travis.BasicView.extend
|
|
||||||
templateName: 'jobs/log'
|
templateName: 'jobs/log'
|
||||||
logBinding: 'job.log'
|
logBinding: 'job.log'
|
||||||
|
|
||||||
|
@ -36,118 +32,4 @@ Travis.reopen
|
||||||
job.get('log').fetch()
|
job.get('log').fetch()
|
||||||
job.subscribe()
|
job.subscribe()
|
||||||
|
|
||||||
PreView: Em.View.extend
|
Travis.LogView = View
|
||||||
templateName: 'jobs/pre'
|
|
||||||
|
|
||||||
logWillChange: (->
|
|
||||||
console.log 'log view: log will change' if Log.DEBUG
|
|
||||||
@teardownLog()
|
|
||||||
).observesBefore('log')
|
|
||||||
|
|
||||||
didInsertElement: ->
|
|
||||||
console.log 'log view: did insert' if Log.DEBUG
|
|
||||||
@_super.apply this, arguments
|
|
||||||
@createEngine()
|
|
||||||
|
|
||||||
willDestroyElement: ->
|
|
||||||
console.log 'log view: will destroy' if Log.DEBUG
|
|
||||||
@teardownLog()
|
|
||||||
|
|
||||||
versionDidChange: (->
|
|
||||||
@rerender() if @get('_state') == 'inDOM'
|
|
||||||
).observes('log.version')
|
|
||||||
|
|
||||||
logDidChange: (->
|
|
||||||
console.log 'log view: log did change: rerender' if Log.DEBUG
|
|
||||||
|
|
||||||
if @get('log')
|
|
||||||
@createEngine()
|
|
||||||
@rerender() if @get('_state') == 'inDOM'
|
|
||||||
).observes('log')
|
|
||||||
|
|
||||||
teardownLog: ->
|
|
||||||
if log = @get('log')
|
|
||||||
parts = log.get('parts')
|
|
||||||
parts.removeArrayObserver(@, didChange: 'partsDidChange', willChange: 'noop')
|
|
||||||
parts.destroy()
|
|
||||||
log.notifyPropertyChange('parts')
|
|
||||||
@lineSelector?.willDestroy()
|
|
||||||
|
|
||||||
createEngine: ->
|
|
||||||
if @get('log')
|
|
||||||
console.log 'log view: create engine' if Log.DEBUG
|
|
||||||
@scroll = new Log.Scroll beforeScroll: =>
|
|
||||||
@unfoldHighlight()
|
|
||||||
@engine = Log.create(limit: Log.LIMIT, listeners: [@scroll])
|
|
||||||
@logFolder = new Travis.LogFolder(@$().find('#log'))
|
|
||||||
@lineSelector = new Travis.LinesSelector(@$().find('#log'), @scroll, @logFolder)
|
|
||||||
@observeParts()
|
|
||||||
|
|
||||||
unfoldHighlight: ->
|
|
||||||
@lineSelector.unfoldLines()
|
|
||||||
|
|
||||||
observeParts: ->
|
|
||||||
if log = @get('log')
|
|
||||||
parts = log.get('parts')
|
|
||||||
parts.addArrayObserver(@, didChange: 'partsDidChange', willChange: 'noop')
|
|
||||||
parts = parts.slice(0)
|
|
||||||
@partsDidChange(parts, 0, null, parts.length)
|
|
||||||
|
|
||||||
partsDidChange: (parts, start, _, added) ->
|
|
||||||
console.log 'log view: parts did change' if Log.DEBUG
|
|
||||||
for part, i in parts.slice(start, start + added)
|
|
||||||
# console.log "limit in log view: #{@get('limited')}"
|
|
||||||
break if @get('limited')
|
|
||||||
@engine.set(part.number, part.content)
|
|
||||||
@propertyDidChange('limited')
|
|
||||||
|
|
||||||
limited: (->
|
|
||||||
@engine?.limit?.limited
|
|
||||||
).property()
|
|
||||||
|
|
||||||
plainTextLogUrl: (->
|
|
||||||
if id = @get('log.job.id')
|
|
||||||
url = Travis.Urls.plainTextLog(id)
|
|
||||||
if config.pro
|
|
||||||
url += "&access_token=#{@get('job.log.token')}"
|
|
||||||
url
|
|
||||||
).property('job.log.id', 'job.log.token')
|
|
||||||
|
|
||||||
actions:
|
|
||||||
toTop: () ->
|
|
||||||
$(window).scrollTop(0)
|
|
||||||
|
|
||||||
toggleTailing: ->
|
|
||||||
Travis.tailing.toggle()
|
|
||||||
@engine.autoCloseFold = !Travis.tailing.isActive()
|
|
||||||
event.preventDefault()
|
|
||||||
|
|
||||||
noop: -> # TODO required?
|
|
||||||
|
|
||||||
Log.Scroll = (options) ->
|
|
||||||
options ||= {}
|
|
||||||
@beforeScroll = options.beforeScroll
|
|
||||||
this
|
|
||||||
Log.Scroll.prototype = $.extend new Log.Listener,
|
|
||||||
insert: (log, data, pos) ->
|
|
||||||
@tryScroll() if @numbers
|
|
||||||
true
|
|
||||||
|
|
||||||
tryScroll: ->
|
|
||||||
if element = $("#log p:visible.highlight:first")
|
|
||||||
if @beforeScroll
|
|
||||||
@beforeScroll()
|
|
||||||
$('#main').scrollTop(0)
|
|
||||||
$('html, body').scrollTop(element.offset()?.top - (window.innerHeight / 3)) # weird, html works in chrome, body in firefox
|
|
||||||
|
|
||||||
# Log.Logger = ->
|
|
||||||
# Log.Logger.prototype = $.extend new Log.Listener,
|
|
||||||
# receive: (log, num, string) ->
|
|
||||||
# @log("rcv #{num} #{JSON.stringify(string)}")
|
|
||||||
# true
|
|
||||||
# insert: (log, element, pos) ->
|
|
||||||
# @log("ins #{element.id}, #{if pos.before then 'before' else 'after'}: #{pos.before || pos.after || '?'}, #{JSON.stringify(element)}")
|
|
||||||
# remove: (log, element) ->
|
|
||||||
# @log("rem #{element.id}")
|
|
||||||
# log: (line) ->
|
|
||||||
# console.log(line)
|
|
||||||
|
|
113
assets/scripts/app/views/pre.coffee
Normal file
113
assets/scripts/app/views/pre.coffee
Normal file
|
@ -0,0 +1,113 @@
|
||||||
|
require 'utils/lines-selector'
|
||||||
|
require 'utils/log-folder'
|
||||||
|
|
||||||
|
config = ENV.config
|
||||||
|
plainTextLogUrl = Travis.Urls.plainTextLog
|
||||||
|
LogFolder = Travis.LogFolder
|
||||||
|
LinesSelector = Travis.LinesSelector
|
||||||
|
|
||||||
|
Log.Scroll = (options) ->
|
||||||
|
options ||= {}
|
||||||
|
@beforeScroll = options.beforeScroll
|
||||||
|
this
|
||||||
|
Log.Scroll.prototype = $.extend new Log.Listener,
|
||||||
|
insert: (log, data, pos) ->
|
||||||
|
@tryScroll() if @numbers
|
||||||
|
true
|
||||||
|
|
||||||
|
tryScroll: ->
|
||||||
|
if element = $("#log p:visible.highlight:first")
|
||||||
|
if @beforeScroll
|
||||||
|
@beforeScroll()
|
||||||
|
$('#main').scrollTop(0)
|
||||||
|
$('html, body').scrollTop(element.offset()?.top - (window.innerHeight / 3)) # weird, html works in chrome, body in firefox
|
||||||
|
|
||||||
|
View = Ember.View.extend
|
||||||
|
templateName: 'jobs/pre'
|
||||||
|
|
||||||
|
logWillChange: (->
|
||||||
|
console.log 'log view: log will change' if Log.DEBUG
|
||||||
|
@teardownLog()
|
||||||
|
).observesBefore('log')
|
||||||
|
|
||||||
|
didInsertElement: ->
|
||||||
|
console.log 'log view: did insert' if Log.DEBUG
|
||||||
|
@_super.apply this, arguments
|
||||||
|
@createEngine()
|
||||||
|
|
||||||
|
willDestroyElement: ->
|
||||||
|
console.log 'log view: will destroy' if Log.DEBUG
|
||||||
|
@teardownLog()
|
||||||
|
|
||||||
|
versionDidChange: (->
|
||||||
|
@rerender() if @get('_state') == 'inDOM'
|
||||||
|
).observes('log.version')
|
||||||
|
|
||||||
|
logDidChange: (->
|
||||||
|
console.log 'log view: log did change: rerender' if Log.DEBUG
|
||||||
|
|
||||||
|
if @get('log')
|
||||||
|
@createEngine()
|
||||||
|
@rerender() if @get('_state') == 'inDOM'
|
||||||
|
).observes('log')
|
||||||
|
|
||||||
|
teardownLog: ->
|
||||||
|
if log = @get('log')
|
||||||
|
parts = log.get('parts')
|
||||||
|
parts.removeArrayObserver(@, didChange: 'partsDidChange', willChange: 'noop')
|
||||||
|
parts.destroy()
|
||||||
|
log.notifyPropertyChange('parts')
|
||||||
|
@lineSelector?.willDestroy()
|
||||||
|
|
||||||
|
createEngine: ->
|
||||||
|
if @get('log')
|
||||||
|
console.log 'log view: create engine' if Log.DEBUG
|
||||||
|
@scroll = new Log.Scroll beforeScroll: =>
|
||||||
|
@unfoldHighlight()
|
||||||
|
@engine = Log.create(limit: Log.LIMIT, listeners: [@scroll])
|
||||||
|
@logFolder = new LogFolder(@$().find('#log'))
|
||||||
|
@lineSelector = new LinesSelector(@$().find('#log'), @scroll, @logFolder)
|
||||||
|
@observeParts()
|
||||||
|
|
||||||
|
unfoldHighlight: ->
|
||||||
|
@lineSelector.unfoldLines()
|
||||||
|
|
||||||
|
observeParts: ->
|
||||||
|
if log = @get('log')
|
||||||
|
parts = log.get('parts')
|
||||||
|
parts.addArrayObserver(@, didChange: 'partsDidChange', willChange: 'noop')
|
||||||
|
parts = parts.slice(0)
|
||||||
|
@partsDidChange(parts, 0, null, parts.length)
|
||||||
|
|
||||||
|
partsDidChange: (parts, start, _, added) ->
|
||||||
|
console.log 'log view: parts did change' if Log.DEBUG
|
||||||
|
for part, i in parts.slice(start, start + added)
|
||||||
|
# console.log "limit in log view: #{@get('limited')}"
|
||||||
|
break if @get('limited')
|
||||||
|
@engine.set(part.number, part.content)
|
||||||
|
@propertyDidChange('limited')
|
||||||
|
|
||||||
|
limited: (->
|
||||||
|
@engine?.limit?.limited
|
||||||
|
).property()
|
||||||
|
|
||||||
|
plainTextLogUrl: (->
|
||||||
|
if id = @get('log.job.id')
|
||||||
|
url = plainTextLogUrl(id)
|
||||||
|
if config.pro
|
||||||
|
url += "&access_token=#{@get('job.log.token')}"
|
||||||
|
url
|
||||||
|
).property('job.log.id', 'job.log.token')
|
||||||
|
|
||||||
|
actions:
|
||||||
|
toTop: () ->
|
||||||
|
$(window).scrollTop(0)
|
||||||
|
|
||||||
|
toggleTailing: ->
|
||||||
|
Travis.tailing.toggle()
|
||||||
|
@engine.autoCloseFold = !Travis.tailing.isActive()
|
||||||
|
event.preventDefault()
|
||||||
|
|
||||||
|
noop: -> # TODO required?
|
||||||
|
|
||||||
|
Travis.PreView = View
|
11
assets/scripts/app/views/profile-accounts.coffee
Normal file
11
assets/scripts/app/views/profile-accounts.coffee
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
BasicView = Travis.BasicView
|
||||||
|
|
||||||
|
View = BasicView.extend
|
||||||
|
tabBinding: 'controller.tab'
|
||||||
|
templateName: 'profile/accounts'
|
||||||
|
classAccounts: (->
|
||||||
|
'active' if @get('tab') == 'accounts'
|
||||||
|
).property('tab')
|
||||||
|
|
||||||
|
|
||||||
|
ProfileAccountsView = View
|
22
assets/scripts/app/views/profile-tabs.coffee
Normal file
22
assets/scripts/app/views/profile-tabs.coffee
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
BasicView = Travis.BasicView
|
||||||
|
|
||||||
|
View = BasicView.extend
|
||||||
|
templateName: 'profile/tabs'
|
||||||
|
tabBinding: 'controller.tab'
|
||||||
|
|
||||||
|
activate: ->
|
||||||
|
@get('controller').activate(event.target.name)
|
||||||
|
|
||||||
|
classHooks: (->
|
||||||
|
'active' if @get('tab') == 'hooks'
|
||||||
|
).property('tab')
|
||||||
|
|
||||||
|
classUser: (->
|
||||||
|
'active' if @get('tab') == 'user'
|
||||||
|
).property('tab')
|
||||||
|
|
||||||
|
displayUser: (->
|
||||||
|
@get('controller.account.login') == @get('controller.user.login')
|
||||||
|
).property('controller.account.login', 'controller.user.login')
|
||||||
|
|
||||||
|
ProfileTabsView = View
|
|
@ -1,5 +1,6 @@
|
||||||
Travis.reopen
|
BasicView = Travis.BasicView
|
||||||
ProfileView: Travis.BasicView.extend
|
|
||||||
|
View = BasicView.extend
|
||||||
templateName: 'profile/show'
|
templateName: 'profile/show'
|
||||||
layoutName: 'layouts/profile'
|
layoutName: 'layouts/profile'
|
||||||
classNames: ['profile-view']
|
classNames: ['profile-view']
|
||||||
|
@ -11,37 +12,4 @@ Travis.reopen
|
||||||
@get('account.name') || @get('account.login')
|
@get('account.name') || @get('account.login')
|
||||||
).property('account.name', 'account.login')
|
).property('account.name', 'account.login')
|
||||||
|
|
||||||
ProfileTabsView: Travis.BasicView.extend
|
ProfileView = View
|
||||||
templateName: 'profile/tabs'
|
|
||||||
tabBinding: 'controller.tab'
|
|
||||||
|
|
||||||
activate: ->
|
|
||||||
@get('controller').activate(event.target.name)
|
|
||||||
|
|
||||||
classHooks: (->
|
|
||||||
'active' if @get('tab') == 'hooks'
|
|
||||||
).property('tab')
|
|
||||||
|
|
||||||
classUser: (->
|
|
||||||
'active' if @get('tab') == 'user'
|
|
||||||
).property('tab')
|
|
||||||
|
|
||||||
displayUser: (->
|
|
||||||
@get('controller.account.login') == @get('controller.user.login')
|
|
||||||
).property('controller.account.login', 'controller.user.login')
|
|
||||||
|
|
||||||
HooksView: Travis.BasicView.extend
|
|
||||||
templateName: 'profile/tabs/hooks'
|
|
||||||
userBinding: 'controller.user'
|
|
||||||
|
|
||||||
urlGithubAdmin: (->
|
|
||||||
Travis.Urls.githubAdmin(@get('hook.slug'))
|
|
||||||
).property('hook.slug')
|
|
||||||
|
|
||||||
AccountsInfoView: Travis.BasicView.extend
|
|
||||||
templateName: 'profile/tabs/user'
|
|
||||||
userBinding: 'controller.user'
|
|
||||||
|
|
||||||
gravatarUrl: (->
|
|
||||||
"#{location.protocol}//www.gravatar.com/avatar/#{@get('user.gravatarId')}?s=200&d=mm"
|
|
||||||
).property('user.gravatarId')
|
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
statusImage = Travis.Urls.statusImage
|
statusImage = Travis.Urls.statusImage
|
||||||
StatusImagesView = Travis.StatusImagesView
|
StatusImagesView = Travis.StatusImagesView
|
||||||
config = ENV.config
|
config = ENV.config
|
||||||
|
BasicView = Travis.BasicView
|
||||||
|
|
||||||
View = Travis.BasicView.extend
|
View = BasicView.extend
|
||||||
reposBinding: 'controllers.repos'
|
reposBinding: 'controllers.repos'
|
||||||
repoBinding: 'controller.repo'
|
repoBinding: 'controller.repo'
|
||||||
buildBinding: 'controller.build'
|
buildBinding: 'controller.build'
|
||||||
|
@ -23,11 +24,11 @@ View = Travis.BasicView.extend
|
||||||
statusImages: () ->
|
statusImages: () ->
|
||||||
@popupCloseAll()
|
@popupCloseAll()
|
||||||
view = StatusImagesView.create(toolsView: this)
|
view = StatusImagesView.create(toolsView: this)
|
||||||
Travis.BasicView.currentPopupView = view
|
BasicView.currentPopupView = view
|
||||||
view.appendTo($('body'))
|
view.appendTo($('body'))
|
||||||
return false
|
return false
|
||||||
|
|
||||||
ReposEmptyView: Travis.BasicView.extend
|
ReposEmptyView: BasicView.extend
|
||||||
template: (->
|
template: (->
|
||||||
if config.pro
|
if config.pro
|
||||||
'pro/repos/show/empty'
|
'pro/repos/show/empty'
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
colorForState = Travis.Helpers.colorForState
|
colorForState = Travis.Helpers.colorForState
|
||||||
|
|
||||||
View = Em.CollectionView.extend
|
View = Ember.CollectionView.extend
|
||||||
elementId: 'repos'
|
elementId: 'repos'
|
||||||
tagName: 'ul'
|
tagName: 'ul'
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
@Travis.reopen
|
BasicView = Travis.BasicView
|
||||||
SigninView: Travis.BasicView.extend
|
|
||||||
|
View = BasicView.extend
|
||||||
templateName: 'auth/signin'
|
templateName: 'auth/signin'
|
||||||
|
|
||||||
|
Travis.SigninView = View
|
||||||
|
|
|
@ -1,73 +0,0 @@
|
||||||
@Travis.reopen
|
|
||||||
StatsView: Travis.BasicView.extend
|
|
||||||
templateName: 'stats/show'
|
|
||||||
didInsertElement: ->
|
|
||||||
# @renderChart(config) for name, config of @CHARTS
|
|
||||||
|
|
||||||
renderChart: (config) ->
|
|
||||||
chart = new Highcharts.Chart(config)
|
|
||||||
@fetch config.source, (data) ->
|
|
||||||
stats = (config.map(stats) for stats in data.stats)
|
|
||||||
chart.series[0].setData(stats)
|
|
||||||
|
|
||||||
fetch: (url, callback) ->
|
|
||||||
$.ajax
|
|
||||||
type: 'GET'
|
|
||||||
url: url
|
|
||||||
accepts: { json: 'application/vnd.travis-ci.2+json' }
|
|
||||||
success: callback
|
|
||||||
|
|
||||||
CHARTS:
|
|
||||||
repos:
|
|
||||||
source: '/api/stats/repos'
|
|
||||||
total: 0
|
|
||||||
map: (data) ->
|
|
||||||
[Date.parse(data.date), @total += parseInt(data.count)]
|
|
||||||
chart:
|
|
||||||
renderTo: "repos_stats"
|
|
||||||
title:
|
|
||||||
text: "Total Projects/Repositories"
|
|
||||||
xAxis:
|
|
||||||
type: "datetime"
|
|
||||||
dateTimeLabelFormats: # don't display the dummy year
|
|
||||||
month: "%e. %b"
|
|
||||||
year: "%b"
|
|
||||||
yAxis:
|
|
||||||
title:
|
|
||||||
text: "Count"
|
|
||||||
min: 0
|
|
||||||
tooltip:
|
|
||||||
formatter: ->
|
|
||||||
Highcharts.dateFormat("%e. %b", @x) + ": " + @y + " repos"
|
|
||||||
series: [
|
|
||||||
name: "Repository Growth"
|
|
||||||
data: []
|
|
||||||
]
|
|
||||||
|
|
||||||
builds:
|
|
||||||
source: '/api/stats/tests'
|
|
||||||
map: (data) ->
|
|
||||||
[Date.parse(data.date), parseInt(data.count)]
|
|
||||||
chart:
|
|
||||||
renderTo: "tests_stats"
|
|
||||||
type: "column"
|
|
||||||
title:
|
|
||||||
text: "Build Count"
|
|
||||||
subtitle:
|
|
||||||
text: "last month"
|
|
||||||
xAxis:
|
|
||||||
type: "datetime"
|
|
||||||
dateTimeLabelFormats: # don't display the dummy year
|
|
||||||
month: "%e. %b"
|
|
||||||
year: "%b"
|
|
||||||
yAxis:
|
|
||||||
title:
|
|
||||||
text: "Count"
|
|
||||||
min: 0
|
|
||||||
tooltip:
|
|
||||||
formatter: ->
|
|
||||||
Highcharts.dateFormat("%e. %b", @x) + ": " + @y + " builds"
|
|
||||||
series: [
|
|
||||||
name: "Total Builds"
|
|
||||||
data: []
|
|
||||||
]
|
|
|
@ -1,3 +1,5 @@
|
||||||
Travis.StatusImageInput = Em.TextArea.extend
|
View = Ember.TextArea.extend
|
||||||
click: ->
|
click: ->
|
||||||
@get('element').select()
|
@get('element').select()
|
||||||
|
|
||||||
|
Travis.StatusImageInput = View
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
Travis.StatusImagesView = Em.View.extend
|
format = Travis.StatusImageFormats.format
|
||||||
|
|
||||||
|
View = Ember.View.extend
|
||||||
templateName: 'status_images'
|
templateName: 'status_images'
|
||||||
elementId: 'status-images'
|
elementId: 'status-images'
|
||||||
classNames: ['popup']
|
classNames: ['popup']
|
||||||
|
@ -46,6 +48,7 @@ Travis.StatusImagesView = Em.View.extend
|
||||||
).observes('repo.branches', 'repo.branches.isLoaded', 'build.commit.branch')
|
).observes('repo.branches', 'repo.branches.isLoaded', 'build.commit.branch')
|
||||||
|
|
||||||
statusString: (->
|
statusString: (->
|
||||||
Travis.StatusImageFormatter.format(@get('statusImageFormat'), @get('repo.slug'), @get('statusImageBranch.commit.branch'))
|
format(@get('statusImageFormat'), @get('repo.slug'), @get('statusImageBranch.commit.branch'))
|
||||||
).property('statusImageFormat', 'repo.slug', 'statusImageBranch.commit.branch')
|
).property('statusImageFormat', 'repo.slug', 'statusImageBranch.commit.branch')
|
||||||
|
|
||||||
|
Travis.StatusImagesView = View
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
@Travis.reopen
|
BasicView = Travis.BasicView
|
||||||
TopView: Travis.BasicView.extend
|
|
||||||
|
View = BasicView.extend
|
||||||
tabBinding: 'controller.tab'
|
tabBinding: 'controller.tab'
|
||||||
|
|
||||||
# hrm. how to parametrize bind-attr?
|
# hrm. how to parametrize bind-attr?
|
||||||
|
@ -24,3 +25,4 @@
|
||||||
hideProfile: ->
|
hideProfile: ->
|
||||||
$('#top .profile ul').hide()
|
$('#top .profile ul').hide()
|
||||||
|
|
||||||
|
Travis.TopView = View
|
||||||
|
|
|
@ -182,8 +182,13 @@ require 'models/user'
|
||||||
require 'models/env-var'
|
require 'models/env-var'
|
||||||
require 'models/ssh-key'
|
require 'models/ssh-key'
|
||||||
|
|
||||||
|
require 'vendor/log'
|
||||||
|
|
||||||
require 'views/basic'
|
require 'views/basic'
|
||||||
require 'views/accounts'
|
require 'views/flash-item'
|
||||||
|
require 'views/accounts-info'
|
||||||
|
require 'views/hooks'
|
||||||
|
require 'views/pre'
|
||||||
require 'views/annotation'
|
require 'views/annotation'
|
||||||
require 'views/application'
|
require 'views/application'
|
||||||
require 'views/build'
|
require 'views/build'
|
||||||
|
@ -199,7 +204,7 @@ require 'views/repo-show-tools'
|
||||||
require 'views/repo-show-tabs'
|
require 'views/repo-show-tabs'
|
||||||
require 'views/repo-actions'
|
require 'views/repo-actions'
|
||||||
require 'views/profile'
|
require 'views/profile'
|
||||||
require 'views/stats'
|
require 'views/profile-tabs'
|
||||||
require 'views/signin'
|
require 'views/signin'
|
||||||
require 'views/top'
|
require 'views/top'
|
||||||
require 'views/status-images'
|
require 'views/status-images'
|
||||||
|
|
2
assets/scripts/vendor/log.js
vendored
2
assets/scripts/vendor/log.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user