Revision e9e7fe51 ui/templates/networks.html
b/ui/templates/networks.html | ||
---|---|---|
167 | 167 |
(<span class="firewall-off">{% trans "Off" %}</span>) |
168 | 168 |
</div> |
169 | 169 |
<div class="toggler down"></div> |
170 |
|
|
171 |
<div class="network-progress-indicator"> |
|
172 |
<img src="/static/icons/indicators/small/progress.gif" alt="{% trans "updating firewall settings" %}" title="{% trans "updating firewall settings" %}" /> |
|
173 |
</div> |
|
170 | 174 |
</div> |
171 | 175 |
</div> |
172 | 176 |
<div class="firewall-content"> |
... | ... | |
657 | 661 |
var serverID = $(this).closest('.network-machine').attr("id").split('-').pop(); |
658 | 662 |
var networkID = $(this).closest('.network-machine').attr("id").split('-')[1]; |
659 | 663 |
var profile = $(this).parent().find('input:checked').attr('value'); |
664 |
|
|
665 |
// Do not make api call if profile choice is the |
|
666 |
// same as current vm firewall profile |
|
667 |
try { |
|
668 |
if (profile == get_machine(serverID).addresses.values[0].firewallProfile) { |
|
669 |
return; |
|
670 |
} |
|
671 |
} catch (err) { |
|
672 |
console.info(err); |
|
673 |
} |
|
674 |
|
|
660 | 675 |
if (profile != undefined) { |
661 | 676 |
set_firewall(networkID, serverID, profile); |
662 | 677 |
$(this).attr("disabled", true); |
663 | 678 |
$(this).html('<img src="static/icons/indicators/medium/horizontal-progress.gif"></img>'); |
679 |
show_machine_network_indicator(serverID, "pub"); |
|
664 | 680 |
} |
665 | 681 |
return false; |
666 | 682 |
}); |
... | ... | |
1003 | 1019 |
existing_public.find('.firewall-label span').addClass('firewall-on'); |
1004 | 1020 |
existing_public.find('.firewall-label span').html(VARIOUS["ON"]); |
1005 | 1021 |
} |
1022 |
existing_public.find(".firewall-apply").hide(); |
|
1006 | 1023 |
} |
1007 | 1024 |
} catch (err) { |
1008 | 1025 |
try{console.info('Server ' + server.id + ' has no network addresses')}catch(err){}; |
1009 | 1026 |
} |
1010 | 1027 |
//TODO: server has changed OS |
1011 |
} |
|
1012 |
// If server does not exist in public network, create it |
|
1013 |
else { |
|
1028 |
|
|
1029 |
// indicator handle |
|
1030 |
var vm = get_machine(server.id); |
|
1031 |
var networkID = "pub"; |
|
1032 |
var serverID = server.id; |
|
1033 |
var network_el = existing_public; |
|
1034 |
|
|
1035 |
network_el.find(".network-progress-indicator").hide(); |
|
1036 |
if (vm.network_transition == "NETWORK_CHANGE") { |
|
1037 |
network_el.find(".network-progress-indicator").show(); |
|
1038 |
} |
|
1039 |
|
|
1040 |
if (vm.network_transition == "CHANGED") { |
|
1041 |
network_el.find(".network-progress-indicator").hide(); |
|
1042 |
} |
|
1043 |
} else { |
|
1044 |
// If server does not exist in public network, create it |
|
1045 |
|
|
1014 | 1046 |
// quick fix to skip machines with no addresses |
1015 | 1047 |
if (server.addresses) { |
1016 | 1048 |
var machine = $("#networks-pane #public-machine-template").clone().attr("id", "net-pub-server-" + server.id).fadeIn("slow"); |
... | ... | |
1051 | 1083 |
machine.find('.firewall-label span').addClass('firewall-on'); |
1052 | 1084 |
machine.find('.firewall-label span').html(VARIOUS["ON"]); |
1053 | 1085 |
} |
1054 |
} |
|
1086 |
} |
|
1087 |
machine.find(".firewall-apply").hide(); |
|
1055 | 1088 |
} catch (err) { |
1056 | 1089 |
try{console.info('Server ' + server.id + ' has no network addresses')}catch(err){}; |
1057 | 1090 |
} |
1091 |
|
|
1092 |
// indicator handle |
|
1093 |
var vm = get_machine(server.id); |
|
1094 |
var networkID = "pub"; |
|
1095 |
var serverID = server.id; |
|
1096 |
var network_el = machine; |
|
1097 |
|
|
1098 |
network_el.find(".network-progress-indicator").hide(); |
|
1099 |
if (vm.network_transition == "NETWORK_CHANGE") { |
|
1100 |
network_el.find(".network-progress-indicator").show(); |
|
1101 |
} |
|
1102 |
|
|
1103 |
if (vm.network_transition == "CHANGED") { |
|
1104 |
network_el.find(".network-progress-indicator").hide(); |
|
1105 |
} |
|
1106 |
|
|
1107 |
// vm added. apply firewall options change handlers |
|
1108 |
$(".firewall-content input[type=radio]", machine).change(function() { |
|
1109 |
var vm = server; |
|
1110 |
var el = $(this).closest(".firewall-content"); |
|
1111 |
var current_profile = get_firewall_profile(vm.id); |
|
1112 |
var selected_profile = $(this).val(); |
|
1113 |
|
|
1114 |
if (current_profile == selected_profile) { |
|
1115 |
el.find(".firewall-apply").hide(); |
|
1116 |
} else { |
|
1117 |
el.find(".firewall-apply").show(); |
|
1118 |
} |
|
1119 |
}) |
|
1058 | 1120 |
} |
1059 | 1121 |
} |
1060 | 1122 |
|
... | ... | |
1148 | 1210 |
|
1149 | 1211 |
//remove top margin from the first machine of each private network |
1150 | 1212 |
$(".private-networks").find(".network-contents .network-machine:first-child").css("margin-top","0"); |
1213 |
|
|
1151 | 1214 |
} |
1152 | 1215 |
|
1153 | 1216 |
// indicate that the requested action was not completed |
Also available in: Unified diff