diff --git a/app/components/ssh-key.coffee b/app/components/ssh-key.coffee index 88d62182..33475041 100644 --- a/app/components/ssh-key.coffee +++ b/app/components/ssh-key.coffee @@ -8,16 +8,14 @@ SshKeyComponent = Ember.Component.extend actions: delete: -> - console.log('isDeleting') + return if @get('isDeleting') + @set('isDeleting', true) - # return if @get('isDeleting') - # @set('isDeleting', true) + deletingDone = => @set('isDeleting', false) - # deletingDone = => @set('isDeleting', false) - - # @get('model').deleteRecord() - # @get('model').save().then(deletingDone, deletingDone).then => - # @set('model', null) + @get('key').deleteRecord() + @get('key').save().then(deletingDone, deletingDone).then => + @sendAction('sshKeyDeleted') `export default SshKeyComponent` diff --git a/app/controllers/settings.coffee b/app/controllers/settings.coffee index 0006d2bf..2b2ff314 100644 --- a/app/controllers/settings.coffee +++ b/app/controllers/settings.coffee @@ -6,4 +6,8 @@ SettingsController = Ember.Controller.extend actions: sshKeyAdded: (sshKey) -> @set('model.customSshKey', sshKey) + + sshKeyDeleted: -> + @set('model.customSshKey', null) + `export default SettingsController` diff --git a/app/templates/components/ssh-key.hbs b/app/templates/components/ssh-key.hbs index 7e11e550..91b8cadf 100644 --- a/app/templates/components/ssh-key.hbs +++ b/app/templates/components/ssh-key.hbs @@ -8,12 +8,16 @@ {{key.fingerprint}}
-
- - - -
Delete
-
+ {{#if isDeleting}} + {{loading-indicator}} + {{else}} +
+ + + +
Delete
+
+ {{/if}}
{{else}}
diff --git a/app/templates/settings.hbs b/app/templates/settings.hbs index 90ef2770..d455bac8 100644 --- a/app/templates/settings.hbs +++ b/app/templates/settings.hbs @@ -32,7 +32,7 @@

SSH Key

{{#if model.customSshKey}} - {{ssh-key key=model.customSshKey}} + {{ssh-key key=model.customSshKey sshKeyDeleted="sshKeyDeleted"}} {{else}} {{ssh-key key=model.sshKey}} {{add-ssh-key repo=repo sshKeyAdded="sshKeyAdded"}}