diff --git a/src/sunstone/public/css/application.css b/src/sunstone/public/css/application.css index 4e0ca48f29..5c9eb084b1 100644 --- a/src/sunstone/public/css/application.css +++ b/src/sunstone/public/css/application.css @@ -230,7 +230,7 @@ div.tip span.ui-icon{ div.tip span.man_icon { display:none; } -.kvm .man_icon,.xen .man_icon,.img_man .man_icon { +.img_man .man_icon { display:inline-block!important; } diff --git a/src/sunstone/public/js/plugins/templates-tab.js b/src/sunstone/public/js/plugins/templates-tab.js index cb558aa5c7..2deda3cd19 100644 --- a/src/sunstone/public/js/plugins/templates-tab.js +++ b/src/sunstone/public/js/plugins/templates-tab.js @@ -40,7 +40,7 @@ var create_template_tmpl = '
\ \
\ @@ -63,22 +63,22 @@ var create_template_tmpl = '
\

Capacity options

\
\
Capacity\ -
\ +
\ \ \
Name that the VM will get for description purposes. If NAME is not supplied a name generated by one will be in the form of one-<VID>.
\
\ -
\ +
\ \ \
Amount of RAM required for the VM, in Megabytes.
\
\ -
\ +
\ \ \
Percentage of CPU divided by 100 required for the Virtual Machine. Half a processor is written 0.5.
\
\ -
\ +
\ \ \
Number of virtual cpus. This value is optional, the default hypervisor behavior is used, usually one virtual CPU.
\ @@ -93,7 +93,7 @@ var create_template_tmpl = '
\

Boot/OS options

\
\
OS and Boot options\ -
\ +
\ \ \ - \ - \ - \ - \ \
Boot device type
\
\ @@ -168,43 +164,35 @@ var create_template_tmpl = '
\ \
\
\ -
\ +
\ \ \
Name of the image to use
\
\ -
\ +
\ \ \
Type of disk device to emulate: ide, scsi
\
\ -
\ +
\ \ \
Device to map image disk. If set, it will overwrite the default device mapping
\
\ -
\ +
\ \ \
Specific image mapping driver. KVM: raw, qcow2. Xen:tap:aio:, file:. VMware unsupported
\
\ -
\ +
\ \ \
Disk type
\
\ -
\ +
\ \ \
Disk file location path or URL
\ @@ -213,7 +201,7 @@ var create_template_tmpl = '
\ \ \ \ -
Disk file location path or URL. Mandatory for swap, fs and block images
\ +
Size in MB
\
\
\ \ @@ -221,7 +209,7 @@ var create_template_tmpl = '
\ \
Filesystem type for the fs images
\
\ -
\ +
\ \ \
Clone this image
\
\ -
\ +
\ \ \
Save this image after shutting down the VM
\
\ -
\ +
\ \ \ \ @@ -284,27 +272,27 @@ var create_template_tmpl = '
\ \
Request an specific IP from the Network
\
\ -
\ +
\ \ \
HW address associated with the network interface
\
\ -
\ +
\ \ \
Name of the bridge the network device is going to be attached to
\
\ -
\ +
\ \ \
Name for the tun device created for the VM
\
\ -
\ +
\ \ \
Name of a shell script to be executed after creating the tun device for the VM
\
\ -
\ +
\ \ \
Hardware that will emulate this network interface. With Xen this is the type attribute of the vif.
\ @@ -401,24 +389,24 @@ var create_template_tmpl = '
\

Add context variables

\
\
Context\ -
\ - \ - \ -
Name for the context variable
\ -
\ -
\ - \ - \ -
Value of the context variable
\ +
\ + \ + \ +
Name for the context variable
\ +
\ +
\ + \ + \ +
Value of the context variable
\ +
\ +
\ + \ + \ +
\ + \ + \
\ -
\ - \ - \ -
\ - \ - \ -
\
\
\ \ @@ -429,12 +417,12 @@ var create_template_tmpl = '
\

Add placement options

\
\
Placement\ -
\ +
\ \ \
Boolean expression that rules out provisioning hosts from list of machines suitable to run this VM
\
\ -
\ +
\ \ \
This field sets which attribute will be used to sort the suitable hosts for this VM. Basically, it defines which hosts are more suitable than others
\ @@ -450,7 +438,7 @@ var create_template_tmpl = '
\
\
Raw\ \ -
\ +
\ \ \ \ @@ -915,11 +903,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 +941,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 +952,59 @@ 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); + + var boot_opts = + '\ + \ + \ + '; + + $('div#os_boot_opts select#BOOT').html(boot_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 +1012,82 @@ 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#os_boot_opts select#BOOT').empty(); + + $('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#os_boot_opts select#BOOT').empty(); + + $('div#disks select#BOOT').empty(); + + $('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 +1321,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 +1399,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 +1448,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 +1627,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";