Reset ssh key controller properly
This commit is contained in:
parent
3b8ecdad41
commit
5c41529d07
|
@ -12,6 +12,9 @@ Travis.SshKeyController = Ember.ObjectController.extend Travis.Validations,
|
|||
validates:
|
||||
value: ['presence']
|
||||
|
||||
reset: ->
|
||||
@set('isEditing', false)
|
||||
|
||||
actions:
|
||||
add: ->
|
||||
model = Travis.SshKey.create(id: @get('repo.id'))
|
||||
|
@ -38,6 +41,11 @@ Travis.SshKeyController = Ember.ObjectController.extend Travis.Validations,
|
|||
@set('isDeleting', true)
|
||||
|
||||
deletingDone = => @set('isDeleting', false)
|
||||
|
||||
# because of the bug in ember model reference is not cleared after
|
||||
# deleting the record, so I'm doing it manually here
|
||||
delete @get('model').constructor._referenceCache(parseInt(@get('model.id')))
|
||||
|
||||
@get('model').deleteRecord().then(deletingDone, deletingDone).then =>
|
||||
@set('model', null)
|
||||
|
||||
|
|
|
@ -414,6 +414,7 @@ Travis.SshKeyRoute = Travis.Route.extend
|
|||
@defaultKey = Ember.Object.create(fingerprint: data.fingerprint)
|
||||
|
||||
setupController: (controller, model) ->
|
||||
controller.reset()
|
||||
@_super.apply this, arguments
|
||||
|
||||
if @defaultKey
|
||||
|
|
Loading…
Reference in New Issue
Block a user