Commit 38e373e3 by Guba Sándor

dashboard: added state change button

parent c342b6da
...@@ -334,6 +334,7 @@ class VmDetailView(CheckedDetailView): ...@@ -334,6 +334,7 @@ class VmDetailView(CheckedDetailView):
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:
return v(request) return v(request)
raise Http404()
def __change_password(self, request): def __change_password(self, request):
self.object = self.get_object() self.object = self.get_object()
...@@ -514,6 +515,10 @@ class VmRawDataUpdate(SuperuserRequiredMixin, UpdateView): ...@@ -514,6 +515,10 @@ class VmRawDataUpdate(SuperuserRequiredMixin, UpdateView):
def get_success_url(self): def get_success_url(self):
return self.get_object().get_absolute_url() + "#resources" return self.get_object().get_absolute_url() + "#resources"
def post(self, request, **kwargs):
messages.error(request, "%s" % request.POST.get("raw_data"))
return redirect(self.get_object().get_absolute_url() + "#resources")
class OperationView(RedirectToLoginMixin, DetailView): class OperationView(RedirectToLoginMixin, DetailView):
...@@ -862,12 +867,15 @@ vm_ops = OrderedDict([ ...@@ -862,12 +867,15 @@ vm_ops = OrderedDict([
op='shut_off', icon='ban', effect='warning')), op='shut_off', icon='ban', effect='warning')),
('recover', VmOperationView.factory( ('recover', VmOperationView.factory(
op='recover', icon='medkit', effect='warning')), op='recover', icon='medkit', effect='warning')),
('nostate', VmOperationView.factory(
op='change_state', icon='legal', effect='danger')),
('destroy', VmOperationView.factory( ('destroy', VmOperationView.factory(
extra_bases=[TokenOperationView], extra_bases=[TokenOperationView],
op='destroy', icon='times', effect='danger')), op='destroy', icon='times', effect='danger')),
('create_disk', VmCreateDiskView), ('create_disk', VmCreateDiskView),
('download_disk', VmDownloadDiskView), ('download_disk', VmDownloadDiskView),
('renew', VmRenewView), ('renew', VmRenewView),
('resources_change', VmResourcesChangeView),
]) ])
......
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