Skip to content
Snippets Groups Projects
Verified Commit 421ac132 authored by Alexander Olofsson's avatar Alexander Olofsson
Browse files

Clean up method of extending provision methods

parent f38fa721
No related branches found
No related tags found
No related merge requests found
......@@ -32,13 +32,6 @@ function wds_os_selected() {
}
};
function wds_content_loaded() {
$('#wds_provisioning').detach().insertBefore('#media_select');
$('#host_provision_method_build').prop('disabled', false);
$('#host_provision_method_wds').prop('disabled', false);
};
function wds_provision_method_selected() {
$('div[id*=_provisioning]').hide();
$('#network_provisioning').show();
......@@ -48,13 +41,23 @@ function wds_provision_method_selected() {
$('#wds_image_select select').attr('disabled', true);
}
}
$(document)
.on('change', '#host_provision_method_wds', wds_provision_method_selected)
.on('change', '.host-architecture-os-select', wds_os_selected)
.on('ContentLoad', wds_content_loaded);
$(function() {
function wds_enable_provision_methods() {
$('#provision_method').show();
$('#host_provision_method_build').prop('disabled', false);
$('#host_provision_method_wds').prop('disabled', false);
if($('#host_provision_method_wds').is(':checked')) {
wds_provision_method_selected();
}
};
$(document)
.on('change', '#host_provision_method_wds', wds_provision_method_selected)
.on('change', '.host-architecture-os-select', wds_os_selected);
$(function() {
$('#wds_provisioning').detach().insertBefore('#media_select');
wds_enable_provision_methods();
});
......@@ -2,6 +2,8 @@
module ForemanWds
module HostsControllerExtensions
extend ActiveSupport::Concern
included do
before_action :cleanup_wds_params
......@@ -17,8 +19,10 @@ module ForemanWds
end
def cleanup_wds_params
# Don't create a WDS facet unless provisioning with it
params[:host].delete :wds_facet_attributes if params[:host] && params[:host][:provision_method] != 'wds'
return unless params.dig(:host, :provision_method)
# Don't create a WDS facet if not provisioning with it
params[:host].delete :wds_facet_attributes if params.dig(:host, :provision_method) != 'wds'
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment