commit 391752b9fba17aece2d220b36f8b74e0b087ec78 Author: Kostas Papadimitriou Date: Mon Jul 11 12:01:06 2011 +0300 Don't append vms with no ips in public network Refs. #753 diff --git a/ui/templates/networks.html b/ui/templates/networks.html index 94a5968..a9be5b5 100644 --- a/ui/templates/networks.html +++ b/ui/templates/networks.html @@ -1010,42 +1010,45 @@ function update_networks_view(servers_data, networks_data){ } // If server does not exist in public network, create it else { - var machine = $("#networks-pane #public-machine-template").clone().attr("id", "net-pub-server-" + server.id).fadeIn("slow"); - machine.find('span.name').text(server.name.substring(0,30)); - // find and display ips - var ips = get_public_ips(server); - if (ips['ip4'] == undefined) { - machine.find(".ip4-container").hide(); - } else { - machine.find("span.ip4").text(ips['ip4']); - } - if (ips['ip6'] == undefined) { - machine.find(".ip6-container").hide(); - } else { - machine.find("span.ip6").text(ips['ip6']); - } - // add the proper icon - if (server.status=='BUILD' || server.status=='ACTIVE' ||server.status=='REBOOT') { - machine.find("img.logo").attr("src","static/icons/machines/medium/" + server_image + '-on.png'); - } else { - machine.find("img.logo").attr("src","static/icons/machines/medium/" + server_image + '-off.png'); - } - machine.appendTo("#networks-pane .public-networks .machines-list"); - //update firewall setting - try { - if (server.addresses.values[0].firewallProfile) { - machine.find("input[value=" + server.addresses.values[0].firewallProfile + "]").attr('checked',true); - machine.find(".firewall-label span").removeClass('firewall-off firewall-on'); - if (server.addresses.values[0].firewallProfile == 'DISABLED') { - machine.find('.firewall-label span').addClass('firewall-off'); - machine.find('.firewall-label span').html(VARIOUS["OFF"]); - } else { - machine.find('.firewall-label span').addClass('firewall-on'); - machine.find('.firewall-label span').html(VARIOUS["ON"]); - } - } - } catch (err) { - try{console.info('Server ' + server.id + ' has no network addresses')}catch(err){}; + // quick fix to skip machines with no addresses + if (server.addresses) { + var machine = $("#networks-pane #public-machine-template").clone().attr("id", "net-pub-server-" + server.id).fadeIn("slow"); + machine.find('span.name').text(server.name.substring(0,30)); + // find and display ips + var ips = get_public_ips(server); + if (ips['ip4'] == undefined) { + machine.find(".ip4-container").hide(); + } else { + machine.find("span.ip4").text(ips['ip4']); + } + if (ips['ip6'] == undefined) { + machine.find(".ip6-container").hide(); + } else { + machine.find("span.ip6").text(ips['ip6']); + } + // add the proper icon + if (server.status=='BUILD' || server.status=='ACTIVE' ||server.status=='REBOOT') { + machine.find("img.logo").attr("src","static/icons/machines/medium/" + server_image + '-on.png'); + } else { + machine.find("img.logo").attr("src","static/icons/machines/medium/" + server_image + '-off.png'); + } + machine.appendTo("#networks-pane .public-networks .machines-list"); + //update firewall setting + try { + if (server.addresses.values[0].firewallProfile) { + machine.find("input[value=" + server.addresses.values[0].firewallProfile + "]").attr('checked',true); + machine.find(".firewall-label span").removeClass('firewall-off firewall-on'); + if (server.addresses.values[0].firewallProfile == 'DISABLED') { + machine.find('.firewall-label span').addClass('firewall-off'); + machine.find('.firewall-label span').html(VARIOUS["OFF"]); + } else { + machine.find('.firewall-label span').addClass('firewall-on'); + machine.find('.firewall-label span').html(VARIOUS["ON"]); + } + } + } catch (err) { + try{console.info('Server ' + server.id + ' has no network addresses')}catch(err){}; + } } }