Revision 391752b9 ui/templates/networks.html
b/ui/templates/networks.html | ||
---|---|---|
1010 | 1010 |
} |
1011 | 1011 |
// If server does not exist in public network, create it |
1012 | 1012 |
else { |
1013 |
var machine = $("#networks-pane #public-machine-template").clone().attr("id", "net-pub-server-" + server.id).fadeIn("slow"); |
|
1014 |
machine.find('span.name').text(server.name.substring(0,30)); |
|
1015 |
// find and display ips |
|
1016 |
var ips = get_public_ips(server); |
|
1017 |
if (ips['ip4'] == undefined) { |
|
1018 |
machine.find(".ip4-container").hide(); |
|
1019 |
} else { |
|
1020 |
machine.find("span.ip4").text(ips['ip4']); |
|
1021 |
} |
|
1022 |
if (ips['ip6'] == undefined) { |
|
1023 |
machine.find(".ip6-container").hide(); |
|
1024 |
} else { |
|
1025 |
machine.find("span.ip6").text(ips['ip6']); |
|
1026 |
} |
|
1027 |
// add the proper icon |
|
1028 |
if (server.status=='BUILD' || server.status=='ACTIVE' ||server.status=='REBOOT') { |
|
1029 |
machine.find("img.logo").attr("src","static/icons/machines/medium/" + server_image + '-on.png'); |
|
1030 |
} else { |
|
1031 |
machine.find("img.logo").attr("src","static/icons/machines/medium/" + server_image + '-off.png'); |
|
1032 |
} |
|
1033 |
machine.appendTo("#networks-pane .public-networks .machines-list"); |
|
1034 |
//update firewall setting |
|
1035 |
try { |
|
1036 |
if (server.addresses.values[0].firewallProfile) { |
|
1037 |
machine.find("input[value=" + server.addresses.values[0].firewallProfile + "]").attr('checked',true); |
|
1038 |
machine.find(".firewall-label span").removeClass('firewall-off firewall-on'); |
|
1039 |
if (server.addresses.values[0].firewallProfile == 'DISABLED') { |
|
1040 |
machine.find('.firewall-label span').addClass('firewall-off'); |
|
1041 |
machine.find('.firewall-label span').html(VARIOUS["OFF"]); |
|
1042 |
} else { |
|
1043 |
machine.find('.firewall-label span').addClass('firewall-on'); |
|
1044 |
machine.find('.firewall-label span').html(VARIOUS["ON"]); |
|
1045 |
} |
|
1046 |
} |
|
1047 |
} catch (err) { |
|
1048 |
try{console.info('Server ' + server.id + ' has no network addresses')}catch(err){}; |
|
1013 |
// quick fix to skip machines with no addresses |
|
1014 |
if (server.addresses) { |
|
1015 |
var machine = $("#networks-pane #public-machine-template").clone().attr("id", "net-pub-server-" + server.id).fadeIn("slow"); |
|
1016 |
machine.find('span.name').text(server.name.substring(0,30)); |
|
1017 |
// find and display ips |
|
1018 |
var ips = get_public_ips(server); |
|
1019 |
if (ips['ip4'] == undefined) { |
|
1020 |
machine.find(".ip4-container").hide(); |
|
1021 |
} else { |
|
1022 |
machine.find("span.ip4").text(ips['ip4']); |
|
1023 |
} |
|
1024 |
if (ips['ip6'] == undefined) { |
|
1025 |
machine.find(".ip6-container").hide(); |
|
1026 |
} else { |
|
1027 |
machine.find("span.ip6").text(ips['ip6']); |
|
1028 |
} |
|
1029 |
// add the proper icon |
|
1030 |
if (server.status=='BUILD' || server.status=='ACTIVE' ||server.status=='REBOOT') { |
|
1031 |
machine.find("img.logo").attr("src","static/icons/machines/medium/" + server_image + '-on.png'); |
|
1032 |
} else { |
|
1033 |
machine.find("img.logo").attr("src","static/icons/machines/medium/" + server_image + '-off.png'); |
|
1034 |
} |
|
1035 |
machine.appendTo("#networks-pane .public-networks .machines-list"); |
|
1036 |
//update firewall setting |
|
1037 |
try { |
|
1038 |
if (server.addresses.values[0].firewallProfile) { |
|
1039 |
machine.find("input[value=" + server.addresses.values[0].firewallProfile + "]").attr('checked',true); |
|
1040 |
machine.find(".firewall-label span").removeClass('firewall-off firewall-on'); |
|
1041 |
if (server.addresses.values[0].firewallProfile == 'DISABLED') { |
|
1042 |
machine.find('.firewall-label span').addClass('firewall-off'); |
|
1043 |
machine.find('.firewall-label span').html(VARIOUS["OFF"]); |
|
1044 |
} else { |
|
1045 |
machine.find('.firewall-label span').addClass('firewall-on'); |
|
1046 |
machine.find('.firewall-label span').html(VARIOUS["ON"]); |
|
1047 |
} |
|
1048 |
} |
|
1049 |
} catch (err) { |
|
1050 |
try{console.info('Server ' + server.id + ' has no network addresses')}catch(err){}; |
|
1051 |
} |
|
1049 | 1052 |
} |
1050 | 1053 |
} |
1051 | 1054 |
|
Also available in: Unified diff