Commit ab55fbae by Őry Máté

dashboard: make abort view more generic

parent 2e3d4c2d
...@@ -12,9 +12,9 @@ ...@@ -12,9 +12,9 @@
{% if user.is_superuser and a.is_abortable %} {% if user.is_superuser and a.is_abortable %}
<form action="" method="POST" class="pull-right"> <form action="" method="POST" class="pull-right">
{% csrf_token %} {% csrf_token %}
<input type="hidden" name="abort_shutdown"/> <input type="hidden" name="abort_operation"/>
<input type="hidden" name="activity" value="{{ a.pk }}"/> <input type="hidden" name="activity" value="{{ a.pk }}"/>
<button class="btn btn-danger btn-xs"><i class="icon-bolt"></i> {% trans "Abort shutdown" %}</button> <button class="btn btn-danger btn-xs"><i class="icon-bolt"></i> {% trans "Abort" %}</button>
</form> </form>
{% endif %} {% endif %}
{% if a.children.count > 0 %} {% if a.children.count > 0 %}
......
...@@ -243,7 +243,7 @@ class VmDetailView(CheckedDetailView): ...@@ -243,7 +243,7 @@ class VmDetailView(CheckedDetailView):
'to_remove': self.__remove_tag, 'to_remove': self.__remove_tag,
'port': self.__add_port, 'port': self.__add_port,
'new_network_vlan': self.__new_network, 'new_network_vlan': self.__new_network,
'abort_shutdown': self.__abort_shutdown, 'abort_operation': self.__abort_operation,
} }
for k, v in options.iteritems(): for k, v in options.iteritems():
if request.POST.get(k) is not None: if request.POST.get(k) is not None:
...@@ -429,7 +429,7 @@ class VmDetailView(CheckedDetailView): ...@@ -429,7 +429,7 @@ class VmDetailView(CheckedDetailView):
return redirect("%s#network" % reverse_lazy( return redirect("%s#network" % reverse_lazy(
"dashboard.views.detail", kwargs={'pk': self.object.pk})) "dashboard.views.detail", kwargs={'pk': self.object.pk}))
def __abort_shutdown(self, request): def __abort_operation(self, request):
self.object = self.get_object() self.object = self.get_object()
if not request.user.is_superuser: if not request.user.is_superuser:
raise PermissionDenied() raise PermissionDenied()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment