Commit cbdf34c6 by Dányi Bence

cloud: vm status view added (ajax)

parent 8d8d3048
...@@ -22,6 +22,7 @@ from django.views.generic import * ...@@ -22,6 +22,7 @@ from django.views.generic import *
from one.models import * from one.models import *
import django.contrib.auth as auth import django.contrib.auth as auth
from firewall.tasks import * from firewall.tasks import *
import json
class LoginView(View): class LoginView(View):
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
...@@ -119,6 +120,13 @@ def vm_show(request, iid): ...@@ -119,6 +120,13 @@ def vm_show(request, iid):
'ports': inst.firewall_host.list_ports() 'ports': inst.firewall_host.list_ports()
})) }))
@require_safe
@login_required
def vm_ajax_instance_status(request, iid):
inst = get_object_or_404(Instance, id=iid, owner=request.user)
inst.update_state()
return HttpResponse(json.dumps({'booting': not inst.active_since, 'state': inst.state}))
class VmPortAddView(View): class VmPortAddView(View):
def post(self, request, iid, *args, **kwargs): def post(self, request, iid, *args, **kwargs):
try: try:
......
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