Implement delete action for ssh-key

This commit is contained in:
Piotr Sarnacki 2015-07-21 14:32:33 +02:00
parent 8f7603c9fe
commit 34510791b0
4 changed files with 21 additions and 15 deletions

View File

@ -8,16 +8,14 @@ SshKeyComponent = Ember.Component.extend
actions: actions:
delete: -> delete: ->
console.log('isDeleting') return if @get('isDeleting')
@set('isDeleting', true)
# return if @get('isDeleting') deletingDone = => @set('isDeleting', false)
# @set('isDeleting', true)
# deletingDone = => @set('isDeleting', false) @get('key').deleteRecord()
@get('key').save().then(deletingDone, deletingDone).then =>
# @get('model').deleteRecord() @sendAction('sshKeyDeleted')
# @get('model').save().then(deletingDone, deletingDone).then =>
# @set('model', null)
`export default SshKeyComponent` `export default SshKeyComponent`

View File

@ -6,4 +6,8 @@ SettingsController = Ember.Controller.extend
actions: actions:
sshKeyAdded: (sshKey) -> sshKeyAdded: (sshKey) ->
@set('model.customSshKey', sshKey) @set('model.customSshKey', sshKey)
sshKeyDeleted: ->
@set('model.customSshKey', null)
`export default SettingsController` `export default SettingsController`

View File

@ -8,12 +8,16 @@
<span>{{key.fingerprint}}</span> <span>{{key.fingerprint}}</span>
</div> </div>
<div class="ssh-key-action"> <div class="ssh-key-action">
<div class="tooltip"> {{#if isDeleting}}
<a href="#" title="" {{action "delete"}}> {{loading-indicator}}
<span class="icon-delete"></span> {{else}}
</a> <div class="tooltip">
<div class="tooltip-bubble">Delete</div> <a href="#" title="" {{action "delete"}}>
</div> <span class="icon-delete"></span>
</a>
<div class="tooltip-bubble">Delete</div>
</div>
{{/if}}
</div> </div>
{{else}} {{else}}
<div class="ssh-key-name"> <div class="ssh-key-name">

View File

@ -32,7 +32,7 @@
<h2 class="small-title">SSH Key</h2> <h2 class="small-title">SSH Key</h2>
{{#if model.customSshKey}} {{#if model.customSshKey}}
{{ssh-key key=model.customSshKey}} {{ssh-key key=model.customSshKey sshKeyDeleted="sshKeyDeleted"}}
{{else}} {{else}}
{{ssh-key key=model.sshKey}} {{ssh-key key=model.sshKey}}
{{add-ssh-key repo=repo sshKeyAdded="sshKeyAdded"}} {{add-ssh-key repo=repo sshKeyAdded="sshKeyAdded"}}