Actions
Refactor #12395
openImprove AJAX handling in host and hostgroup form
Status:
New
Priority:
Normal
Assignee:
-
Category:
Web Interface
Target version:
-
Description
There is some code that adds the host or hostgroup id parameters to ajax requests refreshing parts of the host[group] form:
if (url.match('hostgroups')) { data = data + '&hostgroup_id=' + host_id } else { data = data + '&host_id=' + host_id }
(for example https://github.com/theforeman/foreman/blob/develop/app/assets/javascripts/host_edit.js#L190)
However, the preceding line is:
var data = $("form").serialize().replace('method=put', 'method=post');
which means that the host or hostgroup_id, if existing, is already present in the data variable. Therefor, this code can be removed from many places in the codebase with some minor changes to the relevant controllers, reducing code complexity.
No data to display
Actions