Merge pull request #354 from travis-ci/removing-deprecations

Removing deprecations
This commit is contained in:
Piotr Sarnacki 2015-06-02 11:48:54 +02:00
commit 410f4730bb
33 changed files with 270 additions and 229 deletions

View File

@ -0,0 +1,12 @@
`import Ember from 'ember'`
`import { gravatarImage } from 'travis/utils/urls'`
BuildsItemComponent = Ember.Component.extend
classNameBindings: ['build.state']
classNames: ['tile', 'tile--small', 'tile--build', 'row']
urlAuthorGravatarImage: (->
gravatarImage(@get('build.commit.authorEmail'), 40)
).property('build.commit.authorEmail')
`export default BuildsItemComponent`

View File

@ -0,0 +1,41 @@
`import Ember from 'ember'`
`import config from 'travis/config/environment'`
RequestsItemComponent = Ember.Component.extend
classNames: ['tile', 'tile--jobs', 'row']
classNameBindings: ['requestClass']
tagName: 'li'
requestClass: (->
if @get('request.isAccepted')
'accepted'
else
'rejected'
).property('content.isAccepted')
type: (->
if @get('request.isPullRequest')
'pull_request'
else
'push'
).property('request.isPullRequest')
status: (->
if @get('request.isAccepted')
'Accepted'
else
'Rejected'
).property('request.isAccepted')
message: (->
message = @get('request.message')
if config.pro && message == "private repository"
''
else if !message
'Build created successfully '
else
message
).property('request.message')
`export default RequestsItemComponent`

View File

@ -1,9 +1,9 @@
`import Ember from 'ember'`
Controller = Ember.ObjectController.extend
Controller = Ember.Controller.extend
allHooks: []
needs: ['currentUser']
userBinding: 'controllers.currentUser'
userBinding: 'controllers.currentUser.model'
init: ->
@_super.apply this, arguments
@ -21,7 +21,7 @@ Controller = Ember.ObjectController.extend
hook.toggle()
reloadHooks: ->
if login = @get('login')
if login = @get('model.login')
hooks = @store.find('hook', all: true, owner_name: login)
hooks.then () ->
@ -49,7 +49,7 @@ Controller = Ember.ObjectController.extend
billingUrl: (->
id = if @get('model.type') == 'user' then 'user' else @get('model.login')
"#{@get('config').billingEndpoint}/subscriptions/#{id}"
"#{@config.billingEndpoint}/subscriptions/#{id}"
).property('model.login', 'model.type')
`export default Controller`

View File

@ -3,10 +3,10 @@
`import GithubUrlPropertievs from 'travis/mixins/github-url-properties'`
Controller = Ember.Controller.extend GithubUrlPropertievs,
needs: ['repo']
needs: ['repo', 'currentUser']
repoBinding: 'controllers.repo.repo'
commitBinding: 'build.commit'
currentUserBinding: 'controllers.repo.currentUser'
currentUserBinding: 'controllers.currentUser.model'
tabBinding: 'controllers.repo.tab'
sendFaviconStateChanges: true

View File

@ -1,20 +0,0 @@
`import Ember from 'ember'`
`import { colorForState } from 'travis/utils/helpers'`
`import GithubUrlProperties from 'travis/mixins/github-url-properties'`
`import { gravatarImage } from 'travis/utils/urls'`
Controller = Ember.ObjectController.extend(GithubUrlProperties,
needs: ['builds']
isPullRequestsListBinding: 'controllers.builds.isPullRequestsList'
buildBinding: 'model'
color: (->
colorForState(@get('build.state'))
).property('build.state')
urlAuthorGravatarImage: (->
gravatarImage(@get('build.commit.committerEmail'), 40)
).property('build.commit.authorEmail')
)
`export default Controller`

View File

@ -1,8 +1,6 @@
`import Ember from 'ember'`
Controller = Ember.ArrayController.extend
isPullRequestsList: false
sortAscending: false
sortProperties: ['number']

View File

@ -1,25 +0,0 @@
`import Ember from 'ember'`
`import Ajax from 'travis/utils/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.ajax("/repos/#{repo.get('id')}/caches", "DELETE", data: data).then(deletingDone, deletingDone).then =>
model = @get('model')
@get('controllers.caches').removeObject(model)
`export default Controller`

View File

@ -1,27 +0,0 @@
`import Ember from 'ember'`
`import Ajax from 'travis/utils/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.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'))
`export default Controller`

View File

@ -1,4 +1,4 @@
Controller = Ember.ObjectController.extend
Controller = Ember.Controller.extend
sync: ->
@get('model').sync()

View File

@ -2,7 +2,7 @@
Controller = Ember.Controller.extend
needs: ['currentUser']
user: Ember.computed.alias('controllers.currentUser')
user: Ember.computed.alias('controllers.currentUser.model')
isSyncing: Ember.computed.alias('user.isSyncing')

View File

@ -4,7 +4,7 @@
Controller = Ember.ArrayController.extend
needs: ['currentUser']
currentUserBinding: 'controllers.currentUser'
currentUserBinding: 'controllers.currentUser.model'
init: ->
@_super.apply this, arguments

View File

@ -2,12 +2,12 @@
`import { githubCommit } from 'travis/utils/urls'`
Controller = Ember.Controller.extend
needs: ['repo']
needs: ['repo', 'currentUser']
repoBinding: 'controllers.repo.repo'
commitBinding: 'job.commit'
annotationsBinding: 'job.annotations'
currentUserBinding: 'controllers.repo.currentUser'
currentUserBinding: 'controllers.currentUser.model'
tabBinding: 'controllers.repo.tab'
currentItemBinding: 'job'

View File

@ -4,8 +4,8 @@ Controller = Ember.Controller.extend
name: 'profile'
needs: ['currentUser', 'accounts', 'account']
userBinding: 'controllers.currentUser'
accountBinding: 'controllers.account'
userBinding: 'controllers.currentUser.model'
accountBinding: 'controllers.account.model'
activate: (action, params) ->
this["view_#{action}".camelize()]()

View File

@ -2,12 +2,11 @@
`import { githubRepo } from 'travis/utils/urls'`
Controller = Ember.Controller.extend
needs: ['repos', 'currentUser', 'build', 'request', 'job']
currentUserBinding: 'controllers.currentUser'
needs: ['repos', 'currentUser', 'build', 'job']
currentUserBinding: 'controllers.currentUser.model'
build: Ember.computed.alias('controllers.build.build')
job: Ember.computed.alias('controllers.job.job')
request: Ember.computed.alias('controllers.request.model')
slug: (-> @get('repo.slug') ).property('repo.slug')
isLoading: (-> @get('repo.isLoading') ).property('repo.isLoading')

View File

@ -31,7 +31,7 @@ Controller = Ember.ArrayController.extend
isLoadedBinding: 'content.isLoaded'
needs: ['currentUser', 'repo', 'runningJobs', 'queue']
currentUserBinding: 'controllers.currentUser'
currentUserBinding: 'controllers.currentUser.model'
selectedRepo: (->
# we need to observe also repo.content here, because we use
# ObjectProxy in repo controller

View File

@ -1,35 +0,0 @@
`import Ember from 'ember'`
Controller = Ember.ObjectController.extend
requestClass: (->
if @get('content.isAccepted')
'accepted'
else
'rejected'
).property('content.isAccepted')
type: (->
if @get('isPullRequest')
'pull_request'
else
'push'
).property('isPullRequest')
status: (->
if @get('isAccepted')
'Accepted'
else
'Rejected'
).property('isAccepted')
message: (->
message = @get('model.message')
if @config.pro && message == "private repository"
''
else if !message
'Build created successfully '
else
message
).property('model.message')
`export default Controller`

View File

@ -1,6 +1,6 @@
`import Ember from 'ember'`
Controller = Ember.ObjectController.extend
Controller = Ember.Controller.extend
settings: Ember.computed.alias('model.settings')
settingsChanged: (->

View File

@ -2,7 +2,7 @@
Controller = Ember.Controller.extend
needs: ['currentUser']
userBinding: 'controllers.currentUser'
userBinding: 'controllers.currentUser.model'
userName: (->
@get('user.name') || @get('user.login')

View File

@ -5,7 +5,7 @@ Route = TravisRoute.extend
# TODO: setting accounts model in ProfileRoute is wrong, but
# at this stage it's better than what we had before
accounts = @modelFor('accounts')
login = @controllerFor('currentUser').get('login')
login = @controllerFor('currentUser').get('model.login')
account = accounts.find (account) -> account.get('login') == login
@replaceWith 'account', account

View File

@ -2,16 +2,6 @@
Route = AbstractBuildsRoute.extend(
contentType: 'pull_requests'
# TODO: it would be better to have separate controller for branches and PRs list
setupController: (controller, model) ->
@_super(controller, model)
this.controllerFor('builds').set('isPullRequestsList', true)
deactivate: ->
@_super.apply(this, arguments)
this.controllerFor('builds').set('isPullRequestsList', false)
)
`export default Route`

View File

@ -1,56 +1,7 @@
{{#if content.isLoaded}}
{{!-- <table id="builds" class="list"> --}}
{{#each build in controller itemController="buildsItem"}}
<div {{bind-attr class="build.state :tile :tile--small :tile--build :row"}}>
<div class="tile-status">
<span {{bind-attr class=":icon :icon-status build.state"}}></span>
<span {{bind-attr class=":request-kind build.eventType :icon"}}></span>
</div>
<div class="column tile-main medium-6">
<h2>
{{#if isPullRequestsList}}
<small>PR #{{build.pullRequestNumber}}</small>
{{#link-to "build" build.repo build}}
{{{format-message build.pullRequestTitle short="true" repoBinding=build.repo}}}
{{/link-to}}
{{else}}
<small>{{build.commit.branch}}</small>
{{#link-to "build" build.repo build}}
{{{format-message build.commit.message short="true" repoBinding=build.repo}}}
{{/link-to}}
{{/if}}
</h2>
<p class="tile-author"><img {{bind-attr src="build.urlAuthorGravatarImage"}} alt="">{{build.commit.committerName}} committed</p>
</div>
<div class="column tile-additional medium-6 end">
<div class="column small-6">
<p class="build-status">
{{#if build.id}}
{{#link-to "build" build.repo build}}
<span class="icon icon-hash"></span>
{{build.number}} {{build.state}}
{{/link-to}}
{{/if}}
</p>
<p class="">
<a {{bind-attr href="build.urlGithubCommit"}}>
<span class="icon icon-github"></span>
{{format-sha build.commit.sha}}
</a>
</p>
</div>
<div class="column small-6">
<p class="" {{bind-attr title="build.duration"}}>
<span class="icon icon-clock"></span>
{{format-duration build.duration}}
</p>
<p class="" {{bind-attr title="build.formattedFinishedAt"}}>
<span class="icon icon-cal"></span>
{{format-time build.finishedAt}}
</p>
</div>
</div>
</div>
{{#each controller as |build|}}
{{builds-item build=build}}
{{/each}}
{{#if displayShowMoreButton}}
<p>

View File

@ -0,0 +1,52 @@
<div class="tile-status">
<span class="icon icon-status {{build.state}}"></span>
<span class="request-kind icon {{build.eventType}}"></span>
</div>
<div class="column tile-main medium-6">
<h2>
{{#if build.isPullRequest}}
<small>PR #{{build.pullRequestNumber}}</small>
{{#link-to "build" build.repo build}}
{{{format-message build.pullRequestTitle short="true" repoBinding=build.repo}}}
{{/link-to}}
{{else}}
<small>{{build.commit.branch}}</small>
{{#link-to "build" build.repo build}}
{{{format-message build.commit.message short="true" repoBinding=build.repo}}}
{{/link-to}}
{{/if}}
</h2>
<p class="tile-author"><img {{bind-attr src="urlAuthorGravatarImage"}} alt="">
{{build.commit.committerName}} committed
</p>
</div>
<div class="column tile-additional medium-6 end">
<div class="column small-6">
<p class="build-status">
{{#if build.id}}
{{#link-to "build" build.repo build}}
<span class="icon icon-hash"></span>
{{build.number}} {{build.state}}
{{/link-to}}
{{/if}}
</p>
<p class="">
<a {{bind-attr href="build.urlGithubCommit"}}>
<span class="icon icon-github"></span>
{{format-sha build.commit.sha}}
</a>
</p>
</div>
<div class="column small-6">
<p class="" {{bind-attr title="build.duration"}}>
<span class="icon icon-clock"></span>
{{format-duration build.duration}}
</p>
<p class="" {{bind-attr title="build.formattedFinishedAt"}}>
<span class="icon icon-cal"></span>
{{format-time build.finishedAt}}
</p>
</div>
</div>

View File

@ -0,0 +1,30 @@
<div class="tile-status tile-status--job">
<span class="icon icon--job {{requestClass}}"></span>
</div>
<p class="jobs-item requests-time column">{{format-time request.created_at}}</p>
<p class="jobs-item requests-branch column">
<span class="icon icon--grey {{type}}"></span>
{{#if request.isPullRequest}}
<strong>#{{request.pullRequestNumber}}</strong>
{{else}}
<strong>{{request.branchName}}</strong>
{{/if}}
{{github-commit-link request.repo.slug request.commit.sha}}
</p>
<p class="jobs-item requests-commit column">
{{{format-message request.commit.message short="true" repoBinding=request.build.repo}}}
</p>
<p class="jobs-item requests-build column">
{{#if request.build}}
<span class="icon icon-hash"></span>
{{#link-to "build" request.build}}
{{request.build.number}}{{/link-to}}
{{else}}
-
{{/if}}
</p>
<p class="jobs-item requests-message column">{{message}}</p>

View File

@ -8,7 +8,6 @@
</div>
<div class="dashboard">
<section class="dashboard-starred">
<div class="row">
<div class="dashboard--empty">

View File

@ -7,38 +7,7 @@
{{/if}}
<ul class="requests">
{{#each controller itemController="request"}}
<li {{bind-attr class=":tile :tile--jobs :row requestClass" }}>
<div class="tile-status tile-status--job">
<span {{bind-attr class=":icon :icon--job requestClass"}}></span>
</div>
<p class="jobs-item requests-time column">{{format-time created_at}}</p>
<p class="jobs-item requests-branch column">
<span {{bind-attr class=":icon :icon--grey type"}}></span>
{{#if isPullRequest}}
<strong>#{{pullRequestNumber}}</strong>
{{else}}
<strong>{{branchName}}</strong>
{{/if}}
{{github-commit-link repo.slug commit.sha}}
</p>
<p class="jobs-item requests-commit column">
{{{format-message commit.message short="true" repoBinding=build.repo}}}
</p>
<p class="jobs-item requests-build column">
{{#if build}}
<span class="icon icon-hash"></span>
{{#link-to "build" build}}
{{build.number}}{{/link-to}}
{{else}}
-
{{/if}}
</p>
<p class="jobs-item requests-message column">{{message}}</p>
</li>
{{#each model as |request| }}
{{requests-item request=request}}
{{/each}}
</ul>

View File

@ -23,7 +23,7 @@ githubAdmin = (slug) ->
statusImage = (slug, branch) ->
if config.pro
token = Travis.__container__.lookup('controller:currentUser').get('token')
token = Travis.__container__.lookup('controller:currentUser').get('model.token')
"#{location.protocol}//#{location.host}/#{slug}.svg?token=#{token}" + if branch then "&branch=#{branch}" else ''
else
"#{location.protocol}//#{location.host}/#{slug}.svg" + if branch then "?branch=#{encodeURIComponent(branch)}" else ''
@ -35,7 +35,7 @@ ccXml = (slug, branch) ->
if config.pro
delimiter = if url.indexOf('?') == -1 then '?' else '&'
token = Travis.__container__.lookup('controller:currentUser').get('token')
token = Travis.__container__.lookup('controller:currentUser').get('model.token')
url = "#{url}#{delimiter}token=#{token}"
url

View File

@ -25,7 +25,7 @@ Log.Scroll.prototype = $.extend new Log.Listener,
View = BasicView.extend
templateName: 'jobs/pre'
currentUserBinding: 'controller.currentUser'
currentUserBinding: 'controller.currentUser.model'
logWillChange: (->
console.log 'log view: log will change' if Log.DEBUG

View File

@ -3,7 +3,7 @@
View = Ember.View.extend
templateName: 'repos/list/tabs'
tabBinding: 'controller.tab'
currentUserBinding: 'controller.currentUser.id'
currentUserBinding: 'controller.currentUser.model'
classRecent: (->
if @get('tab') == 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YM6nBt1ejvKthMrmIvHP
KJgP9bcr4BZJJfb210hme2u7Ru+DCdvPeVoUA8phIupcf2b2CrXG0xuvVuSsxdDb
2YM=
-----END CERTIFICATE-----

17
ssl/server.csr Normal file
View File

@ -0,0 +1,17 @@
-----BEGIN CERTIFICATE REQUEST-----
MIICnjCCAYYCAQAwWTELMAkGA1UEBhMCQVUxEzARBgNVBAgTClNvbWUtU3RhdGUx
ITAfBgNVBAoTGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDESMBAGA1UEAxMJbG9j
YWxob3N0MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtOiSl/XyEfPS
3AmoUjlm9kt45aBpndOU0RZprlkHVSB9GvaF3IEDBmOeD9SeQyQghH/6p4892hEL
XLwVdj/qZGmoDfytLKVIWNMoQhXr2tezkj/Kygc8BhiPglHwC2bkhNVDbCjXbuVY
T2RAFQTJvfee+01E/pY1oyCHO5R9bQIO3vifdY7m6Bwj5406ZEGm83zCYpLQov/Y
jEVED3Pb/alxNhZ1yHYdJzM3vDuHXG27gavSpjaABMq3J5bovXx6ErgYxvQOUmZY
t+ouw7qW7igmB88dlnw4hVxgZ7Gz4ReuSMIq5VOMYM3k6H+QDj8giM+xQWAqChrH
E0Anadr1ZQIDAQABoAAwDQYJKoZIhvcNAQEFBQADggEBAGq46qWXlHunS/k7M8DD
AdKrOXrO836C/35gX6C8dabdbbGjIvRCopci1hxpOP7HBA0seN21P0DABn/YvwMW
20zeAraAzAgCso/yeMOWZFpsXyj/0uF7BMGyVV9kiy3x2U4T+//4fYQLKwuCJmh1
ZEbt7otycYYMETukX21TyzUTDEZXzeX+RPhCKJkIr/4H/Mb9Ij/XlOgMfDMNYfK3
90D9UNq/gLe7Jq+U13BmlIRYBOlRSKpSZDiLxFb0XYGwi8a9cXSvQZgHrc2cTl7V
pljnkCiKcwUOYBQfsQn/ohcp6cdQQcHTrHc/KApFw0jB1+EmOAg3gaTI041ryT5a
25A=
-----END CERTIFICATE REQUEST-----

View File

@ -0,0 +1,17 @@
`import { test, moduleForComponent } from 'ember-qunit'`
moduleForComponent 'builds-item', {
needs: ['helper:format-sha', 'helper:format-duration', 'helper:format-time',
'helper:format-message']
}
test 'it renders', (assert) ->
assert.expect 2
# creates the component instance
component = @subject()
assert.equal component._state, 'preRender'
# renders the component to the page
@render()
assert.equal component._state, 'inDOM'

View File

@ -29,7 +29,7 @@ test 'it renders', ->
ok component.$('.job-os').hasClass('linux'), 'OS class should be added for OS icon'
equal component.$('.job-duration').text().trim(), '1 min 40 sec', 'duration should be displayed'
test 'ouputs info on not set properties', ->
test 'outputs info on not set properties', ->
job = Ember.Object.create()
component = @subject(job: job)

View File

@ -0,0 +1,53 @@
`import { test, moduleForComponent } from 'ember-qunit'`
moduleForComponent 'requests-item', {
needs: ['helper:format-message', 'helper:format-time', 'helper:github-commit-link']
}
test 'it renders request data', (assert) ->
yesterday = new Date()
yesterday.setDate(yesterday.getDate() - 1)
request = {
id: 1,
branchName: 'dev',
commit: {
sha: 'abcdef123',
message: 'Bam! :bomb:'
},
repo: {
slug: 'travis-ci/travis-ci'
},
build: {
number: 10
}
created_at: yesterday,
isAccepted: true
}
component = @subject(request: request)
@render()
assert.equal component.$('.requests-branch').text().trim().replace(/[\s]+/, ' '),
'dev abcdef1'
assert.equal component.$('.requests-time').text().trim(), 'a day ago'
assert.ok component.$('.tile-status > .icon').hasClass('accepted'), 'icon should have accepted class'
assert.equal component.$('.requests-commit').text().trim(), 'Bam!'
assert.equal component.$('.requests-commit .emoji').length, 1, 'there should be an emoji icon in commit message'
assert.equal component.$('.requests-commit .emoji').attr('title'), ':bomb:'
assert.equal component.$('.requests-build a').text().trim(), '10', 'build number should be displayed'
test 'it renders PR number if a request is a PR', (assert) ->
# creates the component instance
request = {
id: 1,
isPullRequest: true,
pullRequestNumber: 20,
build: null
}
component = @subject(request: request)
@render()
assert.equal component.$('.requests-branch').text().trim(), '#20'
assert.equal component.$('.requests-build').text().trim(), '-'