Commit a04acaea by Bence Dányi

webui: vm-credentials popup

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