1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-30 22:50:10 +03:00

Feature : fix nic advanced section

This commit is contained in:
Carlos Martín 2014-03-13 17:41:00 +01:00
parent 6b6a446ce0
commit c66e3cbddc
2 changed files with 30 additions and 23 deletions
src/sunstone/public/js/plugins

@ -332,7 +332,8 @@ var template_actions = {
type: "single",
call: OpenNebula.Template.update,
callback: function(request, response){
$create_template_dialog.foundation('reveal', 'close')
$create_template_dialog.foundation('reveal', 'close');
templateShow(request);
notifyMessage(tr("Template updated correctly"));
},
error: onError
@ -1649,8 +1650,10 @@ function generate_nic_tab_content(str_nic_tab_id, str_datatable_id){
'<legend>'+tr("ICMP")+'</legend>'+
'<div class="row">'+
'<div class="large-12 columns">'+
'<input type="checkbox" name="icmp_type" value="ICMP" id="'+str_nic_tab_id+'icmp_type">'+
'<label for="'+str_nic_tab_id+'icmp_type">'+ tr("Drop")+'</label>'+
'<label>'+
'<input type="checkbox" name="icmp_type" value="ICMP" id="icmp_type"> '+
tr("Drop")+
'</label>'+
'</div>'+
'</div>'+
'</fieldset>'+
@ -1665,6 +1668,27 @@ function generate_nic_tab_content(str_nic_tab_id, str_datatable_id){
return html;
}
function retrieve_nic_tab_data(context){
var data = {};
addSectionJSON(data, context);
var tcp = $("input.tcp_type:checked", context).val();
if (tcp) {
data[tcp] = $("#TCP_PORTS", context).val();
}
var udp = $("input.udp_type:checked", context).val();
if (udp) {
data[udp] = $("#UDP_PORTS", context).val();
}
if ($("#icmp_type", context).is(":checked")) {
data["ICMP"] = "drop"
}
return data
}
function setup_nic_tab_content(nic_section, str_nic_tab_id, str_datatable_id) {
var dataTable_template_networks = $('#'+str_datatable_id, nic_section).dataTable({
"bAutoWidth":false,
@ -3606,22 +3630,7 @@ function initialize_create_template_dialog(dialog) {
vm_json["NIC"] = [];
$('.nic',dialog).each(function(){
var hash = {};
addSectionJSON(hash, this);
var tcp = $("input.tcp_type:checked").val();
if (tcp) {
hash[tcp] = $("#TCP_PORTS", this).val();
}
var udp = $("input.udp_type:checked").val();
if (udp) {
hash[udp] = $("#UDP_PORTS", this).val();
}
if ($("#icmp_type", this).is(":checked")) {
hash["ICMP"] = "drop"
}
hash = retrieve_nic_tab_data(this);
if (!$.isEmptyObject(hash)) {
vm_json["NIC"].push(hash);

@ -241,7 +241,7 @@ var deploy_vm_tmpl ='\
<div class="row">\
<div class="large-6 columns">\
<input type="checkbox" name="enforce" id="enforce"/>\
<label for="vm_id">'+tr("Enforce")+'\
<label for="enforce">'+tr("Enforce")+'\
<span class="tip">' + tr("If it is set to true, the host capacity will be checked. This will only affect oneadmin requests, regular users resize requests will always be enforced") +'</span>\
</label>\
</div>\
@ -2447,9 +2447,7 @@ function setupAttachNicDialog(){
$('#attach_nic_form',dialog).submit(function(){
var vm_id = $('#vm_id', this).text();
var data = {};
addSectionJSON(data, this);
var data = retrieve_nic_tab_data(this);
var obj = {NIC: data}
Sunstone.runAction('VM.attachnic', vm_id, obj);