Remove some more deprecations
This commit is contained in:
parent
63ddf332a8
commit
d677307006
|
@ -2,8 +2,7 @@
|
|||
|
||||
Controller = Ember.Controller.extend
|
||||
allHooks: []
|
||||
needs: ['currentUser']
|
||||
userBinding: 'controllers.currentUser.model'
|
||||
userBinding: 'auth.currentUser'
|
||||
|
||||
init: ->
|
||||
@_super.apply this, arguments
|
||||
|
@ -22,7 +21,7 @@ Controller = Ember.Controller.extend
|
|||
|
||||
reloadHooks: ->
|
||||
if login = @get('model.login')
|
||||
hooks = @store.find('hook', all: true, owner_name: login)
|
||||
hooks = @store.query('hook', all: true, owner_name: login)
|
||||
|
||||
hooks.then () ->
|
||||
hooks.set('isLoaded', true)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
`import Ember from 'ember'`
|
||||
|
||||
Controller = Ember.Controller.extend
|
||||
needs: ['currentUser', 'repos']
|
||||
userBinding: 'controllers.currentUser'
|
||||
repos: Ember.inject.controller()
|
||||
userBinding: 'auth.currentUser'
|
||||
|
||||
`export default Controller`
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
`import GithubUrlPropertievs from 'travis/mixins/github-url-properties'`
|
||||
|
||||
Controller = Ember.Controller.extend GithubUrlPropertievs,
|
||||
needs: ['repo', 'currentUser']
|
||||
repoBinding: 'controllers.repo.repo'
|
||||
repoController: Ember.inject.controller('repo')
|
||||
repoBinding: 'repoController.repo'
|
||||
commitBinding: 'build.commit'
|
||||
currentUserBinding: 'controllers.currentUser.model'
|
||||
tabBinding: 'controllers.repo.tab'
|
||||
currentUserBinding: 'auth.currentUser'
|
||||
tabBinding: 'repoController.tab'
|
||||
sendFaviconStateChanges: true
|
||||
|
||||
currentItemBinding: 'build'
|
||||
|
|
|
@ -4,10 +4,10 @@ Controller = Ember.ArrayController.extend
|
|||
sortAscending: false
|
||||
sortProperties: ['number']
|
||||
|
||||
needs: ['repo']
|
||||
repoController: Ember.inject.controller('repo')
|
||||
|
||||
repoBinding: 'controllers.repo.repo'
|
||||
tabBinding: 'controllers.repo.tab'
|
||||
repoBinding: 'repoController.repo'
|
||||
tabBinding: 'repoController.tab'
|
||||
isLoadedBinding: 'content.isLoaded'
|
||||
isLoadingBinding: 'content.isLoading'
|
||||
|
||||
|
@ -53,7 +53,7 @@ Controller = Ember.ArrayController.extend
|
|||
if type?
|
||||
options.event_type = type.replace(/s$/, '') # poor man's singularize
|
||||
|
||||
@store.find('build', options)
|
||||
@store.query('build', options)
|
||||
|
||||
actions:
|
||||
showMoreBuilds: ->
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
`import Ajax from 'travis/utils/ajax'`
|
||||
|
||||
Controller = Ember.Controller.extend
|
||||
needs: ['repo']
|
||||
repo: Ember.computed.alias('controllers.repo.repo')
|
||||
repoController: Ember.inject.controller('repo')
|
||||
repo: Ember.computed.alias('repoController.repo')
|
||||
|
||||
isDeleting: false
|
||||
|
||||
|
|
|
@ -1,48 +0,0 @@
|
|||
`import Ember from 'ember'`
|
||||
`import Validations from 'travis/utils/validations'`
|
||||
|
||||
Controller = Ember.ObjectController.extend Validations,
|
||||
isEditing: false
|
||||
isDeleting: false
|
||||
|
||||
validates:
|
||||
name: ['presence']
|
||||
|
||||
actionType: 'Save'
|
||||
showValueField: Ember.computed.alias('public')
|
||||
|
||||
value: ( (key, value) ->
|
||||
if arguments.length == 2
|
||||
@get('model').set('value', value)
|
||||
value
|
||||
else if @get('public')
|
||||
@get('model.value')
|
||||
else
|
||||
'••••••••••••••••'
|
||||
).property('model.value', 'public')
|
||||
|
||||
actions:
|
||||
delete: ->
|
||||
return if @get('isDeleting')
|
||||
@set('isDeleting', true)
|
||||
|
||||
@get('model').destroyRecord()
|
||||
|
||||
edit: ->
|
||||
@set('isEditing', true)
|
||||
|
||||
cancel: ->
|
||||
@set('isEditing', false)
|
||||
@get('model').revert()
|
||||
|
||||
save: ->
|
||||
return if @get('isSaving')
|
||||
|
||||
if @isValid()
|
||||
env_var = @get('model')
|
||||
|
||||
# TODO: handle errors
|
||||
env_var.save().then =>
|
||||
@set('isEditing', false)
|
||||
|
||||
`export default Controller`
|
|
@ -1,6 +0,0 @@
|
|||
`import Ember from 'ember'`
|
||||
|
||||
Controller = Ember.ArrayController.extend
|
||||
vars: Ember.computed.alias('model')
|
||||
|
||||
`export default Controller`
|
|
@ -1,45 +0,0 @@
|
|||
`import Validations from 'travis/utils/validations'`
|
||||
|
||||
Controller = Ember.Controller.extend Validations,
|
||||
needs: ['repo']
|
||||
repo: Ember.computed.alias('controllers.repo.repo')
|
||||
|
||||
isSaving: false
|
||||
|
||||
validates:
|
||||
name: ['presence']
|
||||
|
||||
actionType: 'Add'
|
||||
showValueField: true
|
||||
|
||||
reset: ->
|
||||
@setProperties(name: null, value: null, public: null)
|
||||
|
||||
actions:
|
||||
cancel: ->
|
||||
@reset()
|
||||
@transitionToRoute('env_vars')
|
||||
|
||||
save: ->
|
||||
return if @get('isSaving')
|
||||
@set('isSaving', true)
|
||||
|
||||
if @isValid()
|
||||
env_var = @store.createRecord('env_var',
|
||||
name: @get('name')
|
||||
value: @get('value')
|
||||
public: @get('public')
|
||||
repo: @get('repo')
|
||||
)
|
||||
|
||||
self = this
|
||||
env_var.save().then =>
|
||||
@set('isSaving', false)
|
||||
@reset()
|
||||
self.transitionToRoute('env_vars')
|
||||
, =>
|
||||
@set('isSaving', false)
|
||||
else
|
||||
@set('isSaving', false)
|
||||
|
||||
`export default Controller`
|
|
@ -1,8 +1,7 @@
|
|||
`import Ember from 'ember'`
|
||||
|
||||
Controller = Ember.Controller.extend
|
||||
needs: ['currentUser']
|
||||
user: Ember.computed.alias('controllers.currentUser.model')
|
||||
user: Ember.computed.alias('auth.currentUser')
|
||||
|
||||
isSyncing: Ember.computed.alias('user.isSyncing')
|
||||
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
`import { githubCommit } from 'travis/utils/urls'`
|
||||
|
||||
Controller = Ember.Controller.extend
|
||||
needs: ['repo', 'currentUser']
|
||||
repoController: Ember.inject.controller('repo')
|
||||
|
||||
repoBinding: 'controllers.repo.repo'
|
||||
repoBinding: 'repoController.repo'
|
||||
commitBinding: 'job.commit'
|
||||
annotationsBinding: 'job.annotations'
|
||||
currentUserBinding: 'controllers.currentUser.model'
|
||||
tabBinding: 'controllers.repo.tab'
|
||||
currentUserBinding: 'auth.currentUser'
|
||||
tabBinding: 'repoController.tab'
|
||||
|
||||
currentItemBinding: 'job'
|
||||
|
||||
|
|
|
@ -3,16 +3,17 @@
|
|||
Controller = Ember.Controller.extend
|
||||
name: 'profile'
|
||||
|
||||
needs: ['currentUser', 'accounts', 'account']
|
||||
userBinding: 'controllers.currentUser.model'
|
||||
accountBinding: 'controllers.account.model'
|
||||
accountController: Ember.inject.controller('account')
|
||||
accountsController: Ember.inject.controller('accounts')
|
||||
userBinding: 'auth.currentUser'
|
||||
accountBinding: 'accountController.model'
|
||||
|
||||
activate: (action, params) ->
|
||||
this["view_#{action}".camelize()]()
|
||||
|
||||
viewHooks: ->
|
||||
@connectTab('hooks')
|
||||
@get('controllers.account').reloadHooks()
|
||||
@get('accountController').reloadHooks()
|
||||
|
||||
viewUser: ->
|
||||
@connectTab('user')
|
||||
|
|
|
@ -2,13 +2,15 @@
|
|||
`import { githubRepo } from 'travis/utils/urls'`
|
||||
|
||||
Controller = Ember.Controller.extend
|
||||
needs: ['repos', 'currentUser', 'build', 'job']
|
||||
currentUserBinding: 'controllers.currentUser.model'
|
||||
jobController: Ember.inject.controller('job')
|
||||
buildController: Ember.inject.controller('build')
|
||||
reposController: Ember.inject.controller('repos')
|
||||
currentUserBinding: 'auth.currentUser'
|
||||
|
||||
classNames: ['repo']
|
||||
|
||||
build: Ember.computed.alias('controllers.build.build')
|
||||
job: Ember.computed.alias('controllers.job.job')
|
||||
build: Ember.computed.alias('buildController.build')
|
||||
job: Ember.computed.alias('jobController.job')
|
||||
|
||||
slug: (-> @get('repo.slug') ).property('repo.slug')
|
||||
isLoading: (-> @get('repo.isLoading') ).property('repo.isLoading')
|
||||
|
|
|
@ -31,14 +31,14 @@ Controller = Ember.Controller.extend
|
|||
@container.lookup('router:main').send('redirectToGettingStarted')
|
||||
|
||||
isLoadedBinding: 'repos.isLoaded'
|
||||
needs: ['currentUser', 'repo']
|
||||
currentUserBinding: 'controllers.currentUser.model'
|
||||
repoController: Ember.inject.controller('repo')
|
||||
currentUserBinding: 'auth.currentUser'
|
||||
selectedRepo: (->
|
||||
# we need to observe also repo.content here, because we use
|
||||
# ObjectProxy in repo controller
|
||||
# TODO: get rid of ObjectProxy there
|
||||
@get('controllers.repo.repo.content') || @get('controllers.repo.repo')
|
||||
).property('controllers.repo.repo', 'controllers.repo.repo.content')
|
||||
@get('repoController.repo.content') || @get('repoController.repo')
|
||||
).property('repoController.repo', 'repoController.repo.content')
|
||||
|
||||
startedJobsCount: Ember.computed.alias('runningJobs.length')
|
||||
allJobsCount: (->
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
`import Ember from 'ember'`
|
||||
|
||||
Controller = Ember.ArrayController.extend
|
||||
needs: ['repo']
|
||||
repo: Ember.computed.alias('controllers.repo.repo')
|
||||
repoController: Ember.inject.controller('repo')
|
||||
|
||||
lintUrl: (->
|
||||
slug = @get('repo.slug')
|
||||
slug = @get('repoController.repo.slug')
|
||||
"https://lint.travis-ci.org/#{slug}"
|
||||
).property('repo.slug')
|
||||
).property('repoController.repo.slug')
|
||||
|
||||
`export default Controller`
|
||||
|
|
|
@ -3,8 +3,7 @@
|
|||
`import config from 'travis/config/environment'`
|
||||
|
||||
Controller = Ember.Controller.extend
|
||||
needs: ['currentUser']
|
||||
userBinding: 'controllers.currentUser.model'
|
||||
userBinding: 'auth.currentUser'
|
||||
|
||||
store: Ember.inject.service()
|
||||
currentUserBinding: 'auth.currentUser'
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
`import { safe, formatCommit as formatCommitHelper } from 'travis/utils/helpers'`
|
||||
|
||||
helper = Ember.HTMLBars.makeBoundHelper (params) ->
|
||||
helper = Ember.Helper.helper (params) ->
|
||||
commit = params[0]
|
||||
safe formatCommitHelper(commit.get('sha'), commit.get('branch')) if commit
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
`import { timeInWords, safe } from 'travis/utils/helpers'`
|
||||
`import Ember from "ember"`
|
||||
|
||||
helper = Ember.HTMLBars.makeBoundHelper (params) ->
|
||||
helper = Ember.Helper.helper (params) ->
|
||||
safe timeInWords(params[0])
|
||||
|
||||
`export default helper`
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
`import { formatMessage as _formatMessage, safe } from 'travis/utils/helpers'`
|
||||
`import Ember from "ember"`
|
||||
|
||||
helper = Ember.HTMLBars.makeBoundHelper (params, hash) ->
|
||||
helper = Ember.Helper.helper (params, hash) ->
|
||||
safe _formatMessage(params[0], hash)
|
||||
|
||||
`export default helper`
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
`import { formatSha as _formatSha, safe } from 'travis/utils/helpers'`
|
||||
`import Ember from "ember"`
|
||||
|
||||
helper = Ember.HTMLBars.makeBoundHelper (params) ->
|
||||
helper = Ember.Helper.helper (params) ->
|
||||
safe _formatSha(params[0])
|
||||
|
||||
`export default helper`
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
`import { timeAgoInWords, safe } from 'travis/utils/helpers'`
|
||||
`import Ember from "ember"`
|
||||
|
||||
helper = Ember.HTMLBars.makeBoundHelper (params) ->
|
||||
helper = Ember.Helper.helper (params) ->
|
||||
safe timeAgoInWords(params[0]) || '-'
|
||||
|
||||
`export default helper`
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
`import { formatCommit, safe } from 'travis/utils/helpers'`
|
||||
`import { githubCommit as githubCommitUrl } from 'travis/utils/urls'`
|
||||
|
||||
helper = Ember.HTMLBars.makeBoundHelper (params) ->
|
||||
helper = Ember.Helper.helper (params) ->
|
||||
slug = params[0]
|
||||
commitSha = params[1]
|
||||
return '' unless commitSha
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
`import { safe } from 'travis/utils/helpers'`
|
||||
`import Ember from "ember"`
|
||||
|
||||
helper = Ember.HTMLBars.makeBoundHelper (params) ->
|
||||
helper = Ember.Helper.helper (params) ->
|
||||
state = params[0]
|
||||
if state == 'received'
|
||||
'booting'
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
`import { timeAgoInWords, safe } from 'travis/utils/helpers'`
|
||||
`import Ember from "ember"`
|
||||
|
||||
helper = Ember.HTMLBars.makeBoundHelper (params) ->
|
||||
helper = Ember.Helper.helper (params) ->
|
||||
safe timeAgoInWords(params[0]) || 'currently running'
|
||||
|
||||
`export default helper`
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
`import { timeAgoInWords, safe } from 'travis/utils/helpers'`
|
||||
`import Ember from "ember"`
|
||||
|
||||
helper = Ember.HTMLBars.makeBoundHelper (params) ->
|
||||
helper = Ember.Helper.helper (params) ->
|
||||
safe moment(params[0]).format('MMMM D, YYYY H:mm:ss') || '-'
|
||||
|
||||
`export default helper`
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
`import { pathFrom } from 'travis/utils/helpers'`
|
||||
`import Ember from "ember"`
|
||||
|
||||
helper = Ember.HTMLBars.makeBoundHelper (params) ->
|
||||
helper = Ember.Helper.helper (params) ->
|
||||
url = params[0]
|
||||
path = pathFrom(url)
|
||||
if path.indexOf('...') >= 0
|
||||
|
|
|
@ -4,4 +4,4 @@ fn = (size) ->
|
|||
if size
|
||||
(size / 1024 / 1024).toFixed(2)
|
||||
|
||||
`export default Ember.HTMLBars.makeBoundHelper(fn)`
|
||||
`export default Ember.Helper.helper(fn)`
|
||||
|
|
|
@ -85,7 +85,7 @@ Repo = Model.extend
|
|||
).property()
|
||||
|
||||
branches: (->
|
||||
builds = @store.find 'build', repository_id: @get('id'), branches: true
|
||||
builds = @store.query 'build', repository_id: @get('id'), branches: true
|
||||
|
||||
builds.then ->
|
||||
builds.set 'isLoaded', true
|
||||
|
@ -149,7 +149,7 @@ Repo.reopenClass
|
|||
@find()
|
||||
|
||||
accessibleBy: (store, login) ->
|
||||
repos = store.find('repo', { member: login, orderBy: 'name' })
|
||||
repos = store.query('repo', { member: login, orderBy: 'name' })
|
||||
|
||||
repos.then () ->
|
||||
repos.set('isLoaded', true)
|
||||
|
@ -157,7 +157,7 @@ Repo.reopenClass
|
|||
repos
|
||||
|
||||
search: (store, query) ->
|
||||
promise = store.find('repo', search: query, orderBy: 'name')
|
||||
promise = store.query('repo', search: query, orderBy: 'name')
|
||||
result = Ember.ArrayProxy.create(content: [])
|
||||
|
||||
promise.then ->
|
||||
|
@ -178,11 +178,11 @@ Repo.reopenClass
|
|||
|
||||
bySlug: (store, slug) ->
|
||||
# first check if there is a repo with a given slug already ordered
|
||||
repos = store.all('repo').filterBy('slug', slug)
|
||||
repos = store.peekAll('repo').filterBy('slug', slug)
|
||||
if repos.get('length') > 0
|
||||
repos
|
||||
else
|
||||
store.find('repo', { slug: slug })
|
||||
store.query('repo', { slug: slug })
|
||||
|
||||
fetchBySlug: (store, slug) ->
|
||||
repos = @bySlug(store, slug)
|
||||
|
|
|
@ -88,7 +88,7 @@ User = Model.extend
|
|||
@setWithSession('syncedAt', data.user.synced_at)
|
||||
Travis.trigger('user:synced', data.user)
|
||||
|
||||
@store.findQuery('account', {})
|
||||
@store.query('account', {})
|
||||
|
||||
setWithSession: (name, value) ->
|
||||
@set(name, value)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
Route = TravisRoute.extend
|
||||
model: ->
|
||||
@store.find('account', { all: true })
|
||||
@store.query('account', { all: true })
|
||||
|
||||
setupController: (controller, model) ->
|
||||
user = model.filterBy('type', 'user')[0]
|
||||
|
|
|
@ -21,7 +21,7 @@ Route = TravisRoute.extend BuildFaviconMixin,
|
|||
@get('stylesheetsManager').disable('dashboard')
|
||||
|
||||
if !config.pro
|
||||
repos = @get('store').all('repo')
|
||||
repos = @get('store').peekAll('repo')
|
||||
repos.forEach (repo) =>
|
||||
@subscribeToRepo(repo)
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ Route = SimpleLayoutRoute.extend
|
|||
if !controller.get('isSyncing')
|
||||
self = this
|
||||
Ember.run.later this, ->
|
||||
@store.find('repo', member: @get('controller.user.login')).then( (repos) ->
|
||||
@store.query('repo', member: @get('controller.user.login')).then( (repos) ->
|
||||
if repos.get('length')
|
||||
self.transitionTo('main')
|
||||
else
|
||||
|
|
|
@ -21,10 +21,10 @@ Route = BasicRoute.extend
|
|||
@_super.apply this, arguments
|
||||
|
||||
loadMoreRepos: ->
|
||||
@store.find('build').then (builds) =>
|
||||
@store.findAll('build').then (builds) =>
|
||||
repoIds = builds.mapBy('data.repo').uniq()
|
||||
repos = @get('repos.repos')
|
||||
@store.find('repo', ids: repoIds).then (reposFromRequest) =>
|
||||
@store.query('repo', ids: repoIds).then (reposFromRequest) =>
|
||||
reposFromRequest.toArray().forEach (repo) ->
|
||||
repos.pushObject(repo) unless repos.contains(repo)
|
||||
|
||||
|
|
|
@ -7,6 +7,6 @@ Route = TravisRoute.extend
|
|||
@controllerFor('repo').activate('requests')
|
||||
|
||||
model: ->
|
||||
@store.find 'request', repository_id: @modelFor('repo').get('id')
|
||||
@store.query 'request', repository_id: @modelFor('repo').get('id')
|
||||
|
||||
`export default Route`
|
||||
|
|
|
@ -119,7 +119,12 @@ Auth = Ember.Object.extend
|
|||
storage.setItem('travis.user', JSON.stringify(data.user))
|
||||
|
||||
loadUser: (user) ->
|
||||
@store.pushPayload(users: [user])
|
||||
@store.push(
|
||||
data:
|
||||
type: 'user',
|
||||
id: user.id
|
||||
attributes: user
|
||||
)
|
||||
@store.recordForId('user', user.id)
|
||||
|
||||
receiveMessage: (event) ->
|
||||
|
|
|
@ -14,7 +14,12 @@ Auth = Ember.Object.extend
|
|||
signInForTests: (user) ->
|
||||
@set('state', 'signed-in')
|
||||
if user.constructor.typeKey? != 'user'
|
||||
@store.pushPayload(users: [user])
|
||||
@store.push(
|
||||
data:
|
||||
type: 'user',
|
||||
id: user.id
|
||||
attributes: user
|
||||
)
|
||||
user = @store.recordForId('user', user.id)
|
||||
|
||||
@set('currentUser', user)
|
||||
|
|
|
@ -8,11 +8,11 @@ View = BasicView.extend Polling,
|
|||
store = @get('controller.store')
|
||||
|
||||
if contentType == 'builds'
|
||||
store.find('build', { event_type: 'push', repository_id: repositoryId })
|
||||
store.query('build', { event_type: 'push', repository_id: repositoryId })
|
||||
else if contentType == 'pull_requests'
|
||||
store.filter('build', { event_type: 'pull_request', repository_id: repositoryId })
|
||||
else
|
||||
store.find 'build', repository_id: repositoryId, branches: true
|
||||
store.query 'build', repository_id: repositoryId, branches: true
|
||||
|
||||
|
||||
`export default View`
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
View = BasicView.extend Polling,
|
||||
popup: Ember.inject.service()
|
||||
reposBinding: 'controllers.repos'
|
||||
reposBinding: 'reposController'
|
||||
repoBinding: 'controller.repo'
|
||||
buildBinding: 'controller.build'
|
||||
jobBinding: 'controller.job'
|
||||
|
|
Loading…
Reference in New Issue
Block a user