\
+
\
\
\
\
@@ -915,11 +907,37 @@ function setupCreateTemplateDialog(){
enable_xen();
break;
case 2:
- break;
+ enable_vmware();
case 3:
break;
}
+ //hide_disabled();
+ //show_enabled();
}
+
+ //~ var hide_disabled = function(context) {
+ //~ var $disabled;
+ //~ if (!context) {
+ //~ $disabled = $('.vm_param input:disabled,.vm_param select:disabled');
+ //~ } else {
+ //~ $disabled = $('.vm_param input:disabled,.vm_param select:disabled',context);
+ //~ }
+ //~
+ //~ $disabled.each(function(){
+ //~ $(this).parent('.vm_param').hide();
+ //~ });
+ //~ }
+ //~
+ //~ var show_enabled = function(context){
+ //~ var $enabled;
+ //~ if (!context) {
+ //~ $enabled = $('.vm_param input:enabled,.vm_param select:enabled');
+ //~ } else {
+ //~ $enabled = $('.vm_param input:enabled,.vm_param select:enabled',context);
+ //~ }
+ //~
+ //~ $enabled.parent('.vm_param').show();
+ //~ }
//Using kvm wizard. Updates mandatory tag, optional tags, disable
//XEN-only (and others) items, enables KVM items
@@ -927,8 +945,10 @@ function setupCreateTemplateDialog(){
man_class="kvm";
opt_class="kvm_opt";
$(xen_items).attr("disabled","disabled");
+ $(vmware_items).attr("disabled","disabled");
$(kvm_items).removeAttr("disabled");
- //$(items+':disabled').hide();
+ $('.vm_param .man_icon').css("display","none");
+ $('.kvm .man_icon').css("display","inline-block");
//KVM particularities:
@@ -936,35 +956,51 @@ function setupCreateTemplateDialog(){
// * Add driver default option for boot and select it - hide some fields
// * Set the raw type to kvm
// * Show the inputs section
- $('div#disks select#TYPE option:selected').removeAttr("selected");
- $('div#disks select#TYPE').prepend(
- '');
- $('div#disks select#TYPE option#no_type').attr("selected","selected");
+
+ var type_opts =
+ '\
+ \
+ \
+ \
+ \
+ \
+ ';
+
+ $('div#disks select#TYPE').html(type_opts);
+
+ $('div#kernel_bootloader',section_os_boot).show();
$('select#boot_method option').removeAttr("selected");
$('select#boot_method option#no_boot').html("Driver default");
$('select#boot_method option').removeAttr("selected");
$('.kernel, .bootloader', $('div#os_boot_opts')).hide();
- $('div#disks select#BUS').append(
- '');
+ var bus_opts =
+ '\
+ \
+ ';
+ $('div#disks select#BUS').html(bus_opts);
$('input#TYPE', section_raw).val("kvm");
$(section_inputs).show();
+ $(section_graphics).show();
+
+
};
// Using XEN wizard. Update mandatory and optional classes, disable
// KVM-only (and other) items, enable XEN fields...
- enable_xen = function(){
+ var enable_xen = function(){
man_class="xen";
opt_class="xen_opt";
$(kvm_items).attr("disabled","disabled");
- $(kvm_items).css("background","");
+ $(vmware_items).attr("disabled","disabled");
$(xen_items).removeAttr("disabled");
- //$(items+':disabled').hide();
+ $('.vm_param .man_icon').css("display","none");
+ $('.xen .man_icon').css("display","inline-block");
// XEN particularities:
@@ -972,18 +1008,79 @@ function setupCreateTemplateDialog(){
// * Remove driver default boot method
// * Set the raw section to XEN
// * Hide the inputs section
- $('div#disks select#TYPE option#no_type').remove();
+
+ var type_opts =
+ '\
+ \
+ \
+ \
+ \
+ ';
+
+ $('div#disks select#TYPE').html(type_opts);
+
+ $('div#kernel_bootloader',section_os_boot).show();
$('select#boot_method option:selected').removeAttr("selected");
$('select#boot_method option#no_boot').html("Please choose");
$('.kernel, .bootloader', $('div#os_boot_opts')).hide();
- $('div#disks select#BUS option#virtio').remove();
+ var bus_opts =
+ '\
+ ';
+
+ $('div#disks select#BUS').html(bus_opts);
$('input#TYPE', section_raw).val("xen");
$(section_inputs).hide(); //not present for xen
+ $(section_graphics).show();
+
+
+
};
+ var enable_vmware = function() {
+ man_class="vmware";
+ opt_class="vmware_opt";
+ $(xen_items).attr("disabled","disabled");
+ $(kvm_items).attr("disabled","disabled");
+ $(vmware_items).removeAttr("disabled");
+ $('.vm_param .man_icon').css("display","none");
+ $('.vmware .man_icon').css("display","inline-block");
+
+ //VMWARE particularities
+ // * Add no_type option for disks
+ // * Set the raw type to kvm
+ // * Hide the inputs and graphics section
+ // * Hide boot method
+ var type_opts =
+ '\
+ \
+ ';
+
+ $('div#disks select#TYPE').html(type_opts);
+
+ $('select#boot_method option').removeAttr("selected");
+ $('select#boot_method option#no_boot').html("Driver default");
+ $('select#boot_method option').removeAttr("selected");
+ $('.kernel, .bootloader', $('div#os_boot_opts')).hide();
+
+ var bus_opts =
+ '\
+ ';
+
+ $('div#disks select#BUS').html(bus_opts);
+
+
+ $('input#TYPE', section_raw).val("vmware");
+
+ $(section_inputs).hide();
+ $(section_graphics).hide();
+
+ $('div#kernel_bootloader',section_os_boot).hide();
+ $('.kernel, .bootloader', $('div#os_boot_opts')).hide();
+ }
+
//This function checks that all mandatory items within a section
//have some value. Returns true if so, false if not.
var mandatory_filter = function(context){
@@ -1217,6 +1314,7 @@ function setupCreateTemplateDialog(){
$('#FORMAT',section_disks).parent().hide();
$('#SIZE',section_disks).parent().attr("disabled","disabled");
$('#TYPE :selected',section_disks).removeAttr("selected");
+ //hide_disabled(section_disks);
});
//Chrome workaround
@@ -1294,6 +1392,7 @@ function setupCreateTemplateDialog(){
$('#FORMAT',section_disks).parent().hide();
$('#FORMAT',section_disks).parent().attr("disabled","disabled");
}
+ //hide_disabled(section_disks);
});
//Our filter for the disks section fields is the mandatory
@@ -1342,6 +1441,7 @@ function setupCreateTemplateDialog(){
$('.niccfg',section_networks).removeAttr("disabled");
break;
}
+ //hide_disabled(section_networks);
});
//The filter to add a new network checks that we have selected a
@@ -1520,13 +1620,16 @@ function setupCreateTemplateDialog(){
var section_raw = $('#raw');
//Different selector for items of kvm and xen (mandatory and optional)
- var items = '.vm_section input,.vm_section select';
+ var items = '.vm_param input,.vm_param select';
var kvm_man_items = '.kvm input,.kvm select';
var kvm_opt_items = '.kvm_opt input, .kvm_opt select';
var kvm_items = kvm_man_items +','+kvm_opt_items;
var xen_man_items = '.xen input,.xen select';
var xen_opt_items = '.xen_opt input, .xen_opt select';
var xen_items = xen_man_items +','+ xen_opt_items;
+ var vmware_man_items = '.vmware input,.vmware select';
+ var vmware_opt_items = '.vmware_opt input, .vmware_opt select';
+ var vmware_items = vmware_man_items +','+ vmware_opt_items;
//Starting template type, optional items class and mandatory items class
var templ_type = "kvm";