-
Notifications
You must be signed in to change notification settings - Fork 300
Fixes #38317 - Create host form - Remember value of content_source_id #11353
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
@jeremylenz @ianballou hi folks, can anybody take a look please? |
We'll find a reviewer for this soon. |
This patch is addressing two fields that should be persisted when an error is thrown upon submit and displayed in the form: |
@@ -161,7 +161,7 @@ def content_options(host, selected_id, object_type, options = {}) | |||
accessible_content_proxies(host) | |||
end | |||
accessible_content_objects.each do |content_object| | |||
selected = selected_id == content_object.id ? 'selected' : '' | |||
selected = "#{selected_id}" == "#{content_object.id}" ? 'selected' : '' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
selected_id
should be kept as integer.
@@ -22,8 +22,14 @@ | |||
<%= select_tag cs_select_id, content_source_options(@hostgroup, :include_blank => blank_or_inherit_with_id(f, :content_source)), :data => {"spinner_path" => spinner_path}, | |||
:class => 'form-control', :name => cs_select_name %> | |||
<% else %> | |||
<%= hidden_field_tag 'host[content_facet_attributes][content_source_id]', fetch_content_source(@host).try(:id) %> | |||
<%= select_tag cs_select_id, content_source_options(@host, :selected_host_group => @hostgroup || @host.hostgroup, :include_blank => blank_or_inherit_with_id(f, :content_source)), :data => {"spinner_path" => spinner_path}, :class => 'form-control', :name => cs_select_name, :disabled => cv_lce_disabled? %> | |||
<% content_source_id = fetch_content_source(@host).try(:id) || params.dig("host", "content_facet_attributes", "content_source_id") %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<% content_source_id = fetch_content_source(@host).try(:id) || params.dig("host", "content_facet_attributes", "content_source_id")&.to_i %>
Here we could ensure content_source_id
as integer.
@lfu, thanks for the review. The host form is right now in a "funky state." I'm moving the PR to the draft state until all the related issues are fixed. |
@stejskalleos Any update? I'd like to move the associated Jira card out of review if it's not going to be updated any soon. |
Hi, |
What are the changes introduced in this pull request?
If the host form is not submitted successfully, the content source is reset, and unexpected changes are made in the OS Media Selection.
Considerations taken when implementing this change?
https://issues.redhat.com/browse/SAT-18646
theforeman/foreman#10495
What are the testing steps for this pull request?
Preconditions:
Steps to reproduce
Before patch
Form is going to show errors, and also will reset or change the following fields:
After patch