Commit b5fead6f by tarokkk

webui: VM connect button popup on not cloudgui clients

parent 53edd6ca
...@@ -27,6 +27,7 @@ urlpatterns = patterns('', ...@@ -27,6 +27,7 @@ urlpatterns = patterns('',
url(r'^vm/port_add/(?P<iid>\d+)/$', 'one.views.vm_port_add', name='vm_port_add'), url(r'^vm/port_add/(?P<iid>\d+)/$', 'one.views.vm_port_add', name='vm_port_add'),
url(r'^vm/port_del/(?P<iid>\d+)/(?P<proto>tcp|udp)/(?P<public>\d+)/$', 'one.views.vm_port_del', name='vm_port_del'), url(r'^vm/port_del/(?P<iid>\d+)/(?P<proto>tcp|udp)/(?P<public>\d+)/$', 'one.views.vm_port_del', name='vm_port_del'),
url(r'^vm/saveas/(?P<vmid>\d+)$', 'one.views.vm_saveas', name='vm_saveas'), url(r'^vm/saveas/(?P<vmid>\d+)$', 'one.views.vm_saveas', name='vm_saveas'),
url(r'^vm/credentials/(?P<iid>\d+)$', 'one.views.vm_credentials', name='vm_credentials'),
url(r'^reload/$', 'firewall.views.reload_firewall', name='reload_firewall'), url(r'^reload/$', 'firewall.views.reload_firewall', name='reload_firewall'),
url(r'^fwapi/$', 'firewall.views.firewall_api', name='firewall_api'), url(r'^fwapi/$', 'firewall.views.firewall_api', name='firewall_api'),
url(r'^store/$', 'store.views.index', name='store_index'), url(r'^store/$', 'store.views.index', name='store_index'),
......
...@@ -41,9 +41,12 @@ $(function() { ...@@ -41,9 +41,12 @@ $(function() {
delete_template_confirm($(this).data('id'), $(this).data('name')); delete_template_confirm($(this).data('id'), $(this).data('name'));
}); });
$('.wm .summary').unbind('click').click(toggleDetails); $('.wm .summary').unbind('click').click(toggleDetails);
if (window.navigator.userAgent.indexOf('cloud-gui') != 0) {
$('.connect-vm-button').click(function(e) { $('.connect-vm-button').click(function(e) {
e.stopPropagation(); e.preventDefault(); e.stopPropagation();
get_vm_details($(this).data('id'));
}); });
}
$('.stop-vm-button').click(function(e) { $('.stop-vm-button').click(function(e) {
e.preventDefault(); e.stopPropagation(); e.preventDefault(); e.stopPropagation();
stop_vm($(this).data('id'), $(this).data('name')); stop_vm($(this).data('id'), $(this).data('name'));
...@@ -65,19 +68,22 @@ $(function() { ...@@ -65,19 +68,22 @@ $(function() {
$('#modal-container').html($('#new-wm').html()); $('#modal-container').html($('#new-wm').html());
$('#modal-container .wm .summary').click(toggleDetails); $('#modal-container .wm .summary').click(toggleDetails);
}); });
/*
*FIXME Most ez itt miért van 2x??????
*/
$('#new-template-button').click(function() { $('#new-template-button').click(function() {
$('#modal').show(); $('#modal').show();
$('#modal-container').html($('#new-template').html()); $('#modal-container').html($('#new-template').html());
}); });
$('#shadow').click(function() {
$('#modal').hide();
})
$('#new-template-button').click(function() { $('#new-template-button').click(function() {
$.get('/ajax/templateWizard', function(data) { $.get('/ajax/templateWizard', function(data) {
$('#modal-container').html(data); $('#modal-container').html(data);
}) })
$('#modal').show(); $('#modal').show();
}); });
$('#shadow').click(function() {
$('#modal').hide();
})
$('#old-upload').click(function(e) { $('#old-upload').click(function(e) {
e.preventDefault(); e.preventDefault();
$(this).parent().parent().hide().parent().find('#old-upload-form').show(); $(this).parent().parent().hide().parent().find('#old-upload-form').show();
...@@ -116,6 +122,15 @@ $(function() { ...@@ -116,6 +122,15 @@ $(function() {
toggleDetails.apply($('.selected-summary')); toggleDetails.apply($('.selected-summary'));
toggleDetails.apply($('.selected-summary')); toggleDetails.apply($('.selected-summary'));
/** /**
* Connect button new window
*/
function get_vm_details(id) {
$.get('/vm/credentials/'+id, function(data) {
$('#modal-container').html(data);
})
$('#modal').show();
};
/**
* Confirm pop-up window * Confirm pop-up window
*/ */
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
</div> </div>
<div class="actions"> <div class="actions">
{% if i.state == 'ACTIVE' %} {% if i.state == 'ACTIVE' %}
<a href="{{i.get_connect_uri}}" class="connect-vm-button" title="{% trans "Connect" %}"> <a href="{{i.get_connect_uri}}" data-id="{{ i.id }}" class="connect-vm-button" title="{% trans "Connect" %}">
<img src="/static/icons/plug.png" alt="{% trans "Connect" %}" /> <img src="/static/icons/plug.png" alt="{% trans "Connect" %}" />
</a> </a>
<a href="#" class="stop-vm-button" data-name="{{ i.name}}" data-id="{{ i.id }}" title="{% trans "Pause" %}"> <a href="#" class="stop-vm-button" data-name="{{ i.name}}" data-id="{{ i.id }}" title="{% trans "Pause" %}">
......
...@@ -75,7 +75,7 @@ def home(request): ...@@ -75,7 +75,7 @@ def home(request):
return render_to_response("home.html", RequestContext(request, { return render_to_response("home.html", RequestContext(request, {
'templates': Template.objects.filter(state='READY'), 'templates': Template.objects.filter(state='READY'),
'mytemplates': Template.objects.filter(owner=request.user), 'mytemplates': Template.objects.filter(owner=request.user),
'publictemplates': Template.objects.filter(public=True), 'publictemplates': Template.objects.filter(public=True, state='READY'),
'instances': _list_instances(request), 'instances': _list_instances(request),
'groups': request.user.person_set.all()[0].owned_groups.all(), 'groups': request.user.person_set.all()[0].owned_groups.all(),
'semesters': Semester.objects.all(), 'semesters': Semester.objects.all(),
...@@ -105,6 +105,15 @@ def ajax_template_name_unique(request, name): ...@@ -105,6 +105,15 @@ def ajax_template_name_unique(request, name):
s = "False" s = "False"
return HttpResponse(s) return HttpResponse(s)
@login_required
def vm_credentials(request, iid):
vm = get_object_or_404(Instance, pk=iid)
if vm.owner == request.user:
return render_to_response('vm-credentials.html', RequestContext(request, { 'i' : vm }))
else:
return HttpResponse("Stale id.")
class AjaxTemplateWizard(View): class AjaxTemplateWizard(View):
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
return render_to_response('new-template-flow-1.html', RequestContext(request,{ return render_to_response('new-template-flow-1.html', RequestContext(request,{
......
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