Skip to content

Commit

Permalink
Fixes #37068 - fix redirect after provisioning discovered host
Browse files Browse the repository at this point in the history
Redirect to the correct page after provisioning discovered hosts,
based on user settings.
  • Loading branch information
nofaralfasi authored and stejskalleos committed Jan 25, 2024
1 parent 248085b commit 1a11647
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion app/controllers/discovered_hosts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ def perform_update(host, success_message = nil)
::ForemanDiscovery::HostConverter.set_build_clean_facts(host)
::ForemanDiscovery::HostConverter.unused_ip_for_host(host)
if host.save
success_options = { :success_redirect => host_path(host), :redirect_xhr => request.xhr? }
host_path = Setting['host_details_ui'] ? host_details_page_path(host) : host_path(host)
success_options = { :success_redirect => host_path, :redirect_xhr => request.xhr? }
success_options[:success_msg] = success_message if success_message
process_success success_options
else
Expand Down
2 changes: 1 addition & 1 deletion test/functional/discovered_hosts_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def test_edit_form_quick_submit

managed_host = Host.find(host.id)
assert managed_host.build
assert_redirected_to host_url(managed_host)
assert_redirected_to host_details_page_path(managed_host)
assert_equal hostgroup.id, managed_host.hostgroup_id
assert_match(/Successfully/, flash[:success])
end
Expand Down

0 comments on commit 1a11647

Please sign in to comment.