From 3e01b5f3531751ada34b896b9450461ca8a8a090 Mon Sep 17 00:00:00 2001 From: Corne Oppelaar Date: Wed, 15 Jun 2016 12:57:38 +0200 Subject: [PATCH] reset interface before opening revoke modal and remove certificate row afterwards --- public/js/panel.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/public/js/panel.js b/public/js/panel.js index d6ea4af..9a8cc31 100644 --- a/public/js/panel.js +++ b/public/js/panel.js @@ -4,23 +4,26 @@ $(function(){ var selected = false; $('.revoke').click(function () { - selected = $(this).data('name'); + selected = $(this); $('.revoke-modal').modal('show'); + error.hide(); }); $('.revoke-confirm').click(function () { var selectedSnapshot = selected; + error.hide(); $.post('/panel/certificates/revoke', { - name: selectedSnapshot, + name: selectedSnapshot.data('name'), password: $('.revoke-password').val() }, function(data) { if (data.success) { - $('#certificates').after(success.text("Successfully revoked '" + selectedSnapshot + "'")); + $('#certificates').after(success.text("Successfully revoked '" + selectedSnapshot.data('name') + "'").delay(3000).hide(0)); $('.revoke-modal').modal('hide'); + $(selectedSnapshot).parents('tr').first().remove(); } else { - $('#revoke-put-error-after-me').after(error.text(data.error)); + $('#revoke-put-error-after-me').after(error.text(data.error).show()); } });