Commit ed395c7a by Bach Dániel

vm: vnc support for VmDetailView

parent 5b27960e
......@@ -61,13 +61,13 @@
$("#vm-detail-pane").addClass("col-md-12");
WebUtil.init_logging('warn');
host = '10.9.2.232';
port = '443';
password = 'tbdgpzhtow';
path = 'vnc/';
host = window.location.hostname;
port = window.location.port == ""?"443":window.location.port ;
password = 'autogiro';
path = 'vnc/?d={{ vnc_url }}';
rfb = new RFB({'target': $D('noVNC_canvas'),
'encrypt': true,// (window.location.protocol === "https:"),
'encrypt': (window.location.protocol === "https:"),
'true_color': true,
'local_cursor': true,
'shared': true,
......
......@@ -4,7 +4,7 @@
{% block content %}
<div class="body-content">
<div class="page-header">
<h1>devenv <small>550.vm.ik.bme.hu</small></h1>
<h1>{{ instance.name }} <small>550.vm.ik.bme.hu</small></h1>
</div>
<div class="row">
<div class="col-md-4" id="vm-info-pane">
......
......@@ -4,5 +4,5 @@ from .views import IndexView, VmDetailView
urlpatterns = patterns('',
url(r'^$', IndexView.as_view()),
url(r'^vm/(?P<id>\d+)/$', VmDetailView.as_view(),
url(r'^vm/(?P<pk>\d+)/$', VmDetailView.as_view(),
name='dashboard.views.detail'),)
from django.views.generic import TemplateView
from django.views.generic import TemplateView, DetailView
from vm.models import Instance
from django.core import signing
class IndexView(TemplateView):
......@@ -18,5 +19,19 @@ class IndexView(TemplateView):
return context
class VmDetailView(TemplateView):
class VmDetailView(DetailView):
template_name = "dashboard/vm-detail.html"
queryset = Instance.objects.all()
def get_context_data(self, **kwargs):
context = super(DetailView, self).get_context_data(**kwargs)
instance = context['instance']
if instance.node:
port = instance.vnc_port
host = instance.node.host.ipv4
value = signing.dumps({'host': host,
'port': port}, key='asdasd')
context.update({
'vnc_url': '%s' % value
})
return context
......@@ -359,7 +359,7 @@ class Instance(BaseResourceConfigModel, TimeStampedModel):
@permalink
def get_absolute_url(self):
return ('dashboard.views.detail', None, {'id': self.id})
return ('dashboard.views.detail', None, {'pk': self.id})
@property
def vm_name(self):
......
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