Skip to content

Commit

Permalink
Fixes BZ#2238952 - Selecting host group change form URL
Browse files Browse the repository at this point in the history
  • Loading branch information
stejskalleos committed Nov 15, 2023
1 parent 0696b6f commit e646fd9
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions app/helpers/discovered_hosts_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,15 @@ def provision_button(host, authorization_options)
end

def host_path(host)
return super unless controller_name == 'discovered_hosts'
discovered_host_path(host)
return discovered_host_path(host) if controller_name == 'discovered_hosts'
# This is a hack to fix the hostgroup selection on the discovered host edit page
# The hostgroup onChange action is replacing the form url from `/discovered_hosts/:id`
# to `/hosts/:id``, which is not correct (in this case) and it breaks the form submission
return discovered_host_path(host) if controller_name == 'hosts' &&
action_name == 'process_hostgroup' &&
Host::Discovered.find_by(id: host[:id])

super
end

def discovery_doc_version
Expand Down

0 comments on commit e646fd9

Please sign in to comment.