Add delete ssh key modal
This commit is contained in:
parent
77314d04c8
commit
ab29b138c3
5 changed files with 47 additions and 3 deletions
|
@ -53,7 +53,7 @@
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<h4 class="modal-title" id="ModalLabel">{% trans "Do You want do delete your order?"%}</h4>
|
<h4 class="modal-title" id="ModalLabel">{% trans "Do You want to delete your order?"%}</h4>
|
||||||
|
|
||||||
<form method="post"
|
<form method="post"
|
||||||
action="{% url 'hosting:delete_order' order.id %}">
|
action="{% url 'hosting:delete_order' order.id %}">
|
||||||
|
|
|
@ -54,6 +54,41 @@
|
||||||
<span class="h3 label label-success"><strong>Active</strong></span>
|
<span class="h3 label label-success"><strong>Active</strong></span>
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
|
<td>
|
||||||
|
<button type="button" class="btn btn-default" data-toggle="modal"
|
||||||
|
data-target="#Modal{{ user_key.id }}"><a
|
||||||
|
href="#">{% trans "Delete Key"%}</a>
|
||||||
|
</button>
|
||||||
|
<div class="modal fade" id="Modal{{user_key.id }}" tabindex="-1" role="dialog">
|
||||||
|
<div class="modal-dialog" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" data-dismiss="modal"
|
||||||
|
aria-label="Confirm"><span
|
||||||
|
aria-hidden="true">×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<h4 class="modal-title" id="ModalLabel">{% trans "Do You want to delete this key?"%}</h4>
|
||||||
|
|
||||||
|
<form method="post"
|
||||||
|
action="{% url 'hosting:delete_ssh_key' user_key.id %}">
|
||||||
|
{% csrf_token %}
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-default"
|
||||||
|
data-dismiss="modal">
|
||||||
|
{% trans "Close"%}
|
||||||
|
</button>
|
||||||
|
<button type="submit" class="btn btn-primary">{% trans "Delete"%}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
|
@ -2,4 +2,6 @@ from django.test import TestCase
|
||||||
|
|
||||||
# Create your tests here.
|
# Create your tests here.
|
||||||
|
|
||||||
test_user_can_add_key()
|
test_user_can_add_ssh_key()
|
||||||
|
|
||||||
|
test_user_can_delete_ssh_ke()
|
||||||
|
|
|
@ -5,7 +5,7 @@ from .views import DjangoHostingView, RailsHostingView, PaymentVMView,\
|
||||||
OrdersHostingListView, OrdersHostingDetailView, VirtualMachinesPlanListView,\
|
OrdersHostingListView, OrdersHostingDetailView, VirtualMachinesPlanListView,\
|
||||||
VirtualMachineView, GenerateVMSSHKeysView, OrdersHostingDeleteView, NotificationsView, \
|
VirtualMachineView, GenerateVMSSHKeysView, OrdersHostingDeleteView, NotificationsView, \
|
||||||
MarkAsReadNotificationView, PasswordResetView, PasswordResetConfirmView, HostingPricingView,\
|
MarkAsReadNotificationView, PasswordResetView, PasswordResetConfirmView, HostingPricingView,\
|
||||||
CreateVirtualMachinesView, HostingBillListView, HostingBillDetailView
|
CreateVirtualMachinesView, HostingBillListView, HostingBillDetailView, SSHKeyDeleteView
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
url(r'index/?$', IndexView.as_view(), name='index'),
|
url(r'index/?$', IndexView.as_view(), name='index'),
|
||||||
|
@ -27,6 +27,8 @@ urlpatterns = [
|
||||||
# name='virtual_machines_cancel'),
|
# name='virtual_machines_cancel'),
|
||||||
url(r'vm-key-pair/?$', GenerateVMSSHKeysView.as_view(),
|
url(r'vm-key-pair/?$', GenerateVMSSHKeysView.as_view(),
|
||||||
name='key_pair'),
|
name='key_pair'),
|
||||||
|
url(r'delete_ssh_key/(?P<pk>\d+)/?$', SSHKeyDeleteView.as_view(),
|
||||||
|
name='delete_ssh_key'),
|
||||||
url(r'^notifications/$', NotificationsView.as_view(), name='notifications'),
|
url(r'^notifications/$', NotificationsView.as_view(), name='notifications'),
|
||||||
url(r'^notifications/(?P<pk>\d+)/?$', MarkAsReadNotificationView.as_view(),
|
url(r'^notifications/(?P<pk>\d+)/?$', MarkAsReadNotificationView.as_view(),
|
||||||
name='read_notification'),
|
name='read_notification'),
|
||||||
|
|
|
@ -288,6 +288,11 @@ class MarkAsReadNotificationView(LoginRequiredMixin, UpdateView):
|
||||||
return HttpResponseRedirect(reverse('hosting:notifications'))
|
return HttpResponseRedirect(reverse('hosting:notifications'))
|
||||||
|
|
||||||
|
|
||||||
|
class SSHKeyDeleteView(LoginRequiredMixin, DeleteView):
|
||||||
|
login_url = reverse_lazy('hosting:login')
|
||||||
|
success_url = reverse_lazy('hosting:key-pair')
|
||||||
|
model = UserHostingKey
|
||||||
|
|
||||||
class GenerateVMSSHKeysView(LoginRequiredMixin, FormView):
|
class GenerateVMSSHKeysView(LoginRequiredMixin, FormView):
|
||||||
form_class = UserHostingKeyForm
|
form_class = UserHostingKeyForm
|
||||||
model = UserHostingKey
|
model = UserHostingKey
|
||||||
|
|
Loading…
Reference in a new issue