Commit 1b0d1ba7 by Kálmán Viktor

dashboard: add messages for vm mass ops

parent a6f7f6ef
...@@ -1028,9 +1028,9 @@ class MassOperationView(OperationView): ...@@ -1028,9 +1028,9 @@ class MassOperationView(OperationView):
except SuspiciousOperation: except SuspiciousOperation:
continue continue
except PermissionDenied: except PermissionDenied:
setattr(i, "disabled", "No permission") setattr(i, "disabled", _("Permission denied"))
except Exception: except Exception:
setattr(i, "disabled", "Wrong state error, probably") raise
vms.append(i) vms.append(i)
return vms return vms
...@@ -1047,7 +1047,15 @@ class MassOperationView(OperationView): ...@@ -1047,7 +1047,15 @@ class MassOperationView(OperationView):
except Exception as e: except Exception as e:
pass pass
return redirect(reverse("dashboard.views.vm-list")) if request.is_ajax():
store = messages.get_messages(request)
store.used = True
return HttpResponse(
json.dumps({'messages': [unicode(m) for m in store]}),
content_type="application=json"
)
else:
return redirect(reverse("dashboard.views.vm-list"))
def _op_checks(self, instance, user): def _op_checks(self, instance, user):
objects_of_user = Instance.get_objects_with_level("user", user) objects_of_user = Instance.get_objects_with_level("user", user)
......
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