Commit a04acaea by Bence Dányi

webui: vm-credentials popup

parent f2934fb6
...@@ -25,7 +25,7 @@ $(function() { ...@@ -25,7 +25,7 @@ $(function() {
$(this).parent().next().find('.host').hide(); $(this).parent().next().find('.host').hide();
$(this).parent().next().find('.ipv4host').show(); $(this).parent().next().find('.ipv4host').show();
} }
}) });
$('.delete-template').click(function(e) { $('.delete-template').click(function(e) {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
...@@ -269,6 +269,20 @@ $(function() { ...@@ -269,6 +269,20 @@ $(function() {
function get_vm_details(id) { function get_vm_details(id) {
$.get('/vm/credentials/' + id, function(data) { $.get('/vm/credentials/' + id, function(data) {
$('#modal-container').html(data); $('#modal-container').html(data);
$('#modal-container .host-toggle').click(function(e){
e.preventDefault();
if($(this).find('.v4').is(':hidden')){
$(this).find('.v4').show();
$(this).find('.v6').hide();
$(this).parent().next().find('.host').show();
$(this).parent().next().find('.ipv4host').hide();
} else {
$(this).find('.v6').show();
$(this).find('.v4').hide();
$(this).parent().next().find('.host').hide();
$(this).parent().next().find('.ipv4host').show();
}
});
$('#modal-container .hidden-password').click(function() { $('#modal-container .hidden-password').click(function() {
if ($(this).attr('type') == 'password') { if ($(this).attr('type') == 'password') {
$(this).attr('type', 'text'); $(this).attr('type', 'text');
......
...@@ -321,7 +321,7 @@ ...@@ -321,7 +321,7 @@
font-size: .8em; font-size: .8em;
text-align: right; text-align: right;
} }
span { .entry span {
background-position: left center; background-position: left center;
background-repeat: no-repeat; background-repeat: no-repeat;
padding-left: 18px; padding-left: 18px;
......
...@@ -358,11 +358,6 @@ vm_list = login_required(VmListView.as_view()) ...@@ -358,11 +358,6 @@ vm_list = login_required(VmListView.as_view())
@login_required @login_required
def vm_show(request, iid): def vm_show(request, iid):
inst = get_object_or_404(Instance, id=iid, owner=request.user) inst = get_object_or_404(Instance, id=iid, owner=request.user)
is_ipv6 = True #len(request.META["REMOTE_ADDR"].split('.')) == 1
inst.is_ipv6 = is_ipv6
inst.hostname_v4 = inst.get_connect_host(use_ipv6=False)
inst.nat = inst.template.network.nat
inst.port = inst.get_port(use_ipv6=is_ipv6)
try: try:
ports = inst.firewall_host.list_ports() ports = inst.firewall_host.list_ports()
except: except:
...@@ -372,9 +367,13 @@ def vm_show(request, iid): ...@@ -372,9 +367,13 @@ def vm_show(request, iid):
except UserCloudDetails.DoesNotExist: except UserCloudDetails.DoesNotExist:
details = UserCloudDetails(user=request.user) details = UserCloudDetails(user=request.user)
details.save() details.save()
proto = len(request.META["REMOTE_ADDR"].split('.')) == 1 is_ipv6 = len(request.META["REMOTE_ADDR"].split('.')) == 1
inst.hostname = inst.get_connect_host(use_ipv6=proto) inst.is_ipv6 = is_ipv6
inst.port = inst.get_port(use_ipv6=proto) inst.hostname_v4 = inst.get_connect_host(use_ipv6=False)
inst.nat = inst.template.network.nat
inst.port = inst.get_port(use_ipv6=is_ipv6)
inst.hostname = inst.get_connect_host(use_ipv6=is_ipv6)
inst.port = inst.get_port(use_ipv6=is_ipv6)
return render_to_response("show.html", RequestContext(request,{ return render_to_response("show.html", RequestContext(request,{
'uri': inst.get_connect_uri(), 'uri': inst.get_connect_uri(),
'state': inst.state, 'state': inst.state,
......
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