diff --git a/app/models/compute_resources/foreman/model/vmware.rb b/app/models/compute_resources/foreman/model/vmware.rb index 3e43da47952..ea56a432e81 100644 --- a/app/models/compute_resources/foreman/model/vmware.rb +++ b/app/models/compute_resources/foreman/model/vmware.rb @@ -761,22 +761,6 @@ def normalize_vm_attrs(vm_attrs) normalized end - def secure_boot - attrs[:secure_boot] ||= false - end - - def secure_boot=(enabled) - attrs[:secure_boot] = ActiveRecord::Type::Boolean.new.cast(enabled) - end - - def virtual_tpm - attrs[:virtual_tpm] ||= false - end - - def virtual_tpm=(enabled) - attrs[:virtual_tpm] = ActiveRecord::Type::Boolean.new.cast(enabled) - end - private def dc diff --git a/app/views/compute_resources_vms/form/vmware/_base.html.erb b/app/views/compute_resources_vms/form/vmware/_base.html.erb index 2de064da822..f478ca3e460 100644 --- a/app/views/compute_resources_vms/form/vmware/_base.html.erb +++ b/app/views/compute_resources_vms/form/vmware/_base.html.erb @@ -8,7 +8,7 @@ <%= text_f f, :memory_mb, :class => "col-md-2", :label => _("Memory (MB)") %> <%= field(f, :firmware, :label => _('Firmware'), :label_size => "col-md-2") do compute_resource.firmware_types.collect do |type, name| - radio_button_f f, :firmware, {:disabled => !new_vm, :value => type, :text => _(name)} + radio_button_f f, :firmware, {:disabled => !new_vm, :value => type, :text => _(name), :onchange => 'tfm.computeResource.vmware.onFirmwareChange(this)'} end.join(' ').html_safe end %> <%= selectable_f f, :cluster, compute_resource.clusters, { :include_blank => _('Please select a cluster') }, @@ -49,15 +49,16 @@ end %> { :disabled => images.empty?, :label => _('Image'), :label_size => "col-md-2" } %> -<%= checkbox_f f, :secure_boot, { :help_inline => _("Enable Secure Bott for provisioning."), - :label => _('Secure Boot'), - :label_size => "col-md-2", - :disabled => !new_vm } %> + +
> + <%= checkbox_f f, :secure_boot, { :help_inline => _("Enable Secure Boot for provisioning."), + :label => _('Secure Boot'), + :label_size => "col-md-2" } %> -<%= checkbox_f f, :virtual_tpm, { :help_inline => _("Add Virtual TPM module to the VM."), - :label => _('Virtual TPM'), - :label_size => "col-md-2", - :disabled => !new_vm } %> + <%= checkbox_f f, :virtual_tpm, { :help_inline => _("Add Virtual TPM module to the VM."), + :label => _('Virtual TPM'), + :label_size => "col-md-2" } %> +
<%= compute_specific_js(compute_resource, "nic_info") %> diff --git a/webpack/assets/javascripts/compute_resource/vmware.js b/webpack/assets/javascripts/compute_resource/vmware.js index fa87bc95728..1e238a97523 100644 --- a/webpack/assets/javascripts/compute_resource/vmware.js +++ b/webpack/assets/javascripts/compute_resource/vmware.js @@ -83,3 +83,10 @@ function fetchNetworks(url, clusterId) { }, }); } + +export function onFirmwareChange(item) { + const selected = $(item).val(); + const inputs = $('#efi_features'); + + inputs.toggleClass('hide', selected !== 'efi'); +}