fixes #14699 - Enable host edit to accept new params
Prior to this commit: Foreman plugins like Katello/Discovery extended the Host edit page and added fields of their own. For example Katello adds things like Content Views, enviroments etc.
However they were unable to get their attibutes passed to the backend because the os_selected and other "*_selected" methods do something like attrs = attribute_hash(['operatingsystem_id', 'organization_id', 'location_id']); sending a hard coded list. This makes it impossible for plugins to send more data when things like OS or Medium or image get selected.
This commit does the following:
Updates the Host edit js's os_select and other functions to use a globally available map to figure out which attributes to send to the server when one calls "medium_selected" "os_selected" etc.
This will help plugins like Katello and foreman-discovery extend the global map and add their parameters.
For example all katello would have to do now is to say something like window.tfm.hosts.registerPluginAttributes('os', ["content_view_id"]) and when os gets selected these attributes will be automatically get sent to server.
Related issues
Refactor #14699: Katello needs foreman's os_selected method to submit all form data
fixes #14699 - Enable host edit to accept new params
Prior to this commit:
Foreman plugins like Katello/Discovery extended the Host edit page
and added fields of their own.
For example
Katello adds things like Content Views, enviroments etc.
However they were unable to get their attibutes passed to the backend
because the os_selected and other "*_selected" methods do something
like
attrs = attribute_hash(['operatingsystem_id', 'organization_id',
'location_id']);
sending a hard coded list. This makes it impossible for plugins to send
more data when things like OS or Medium or image get selected.
This commit does the following:
Updates the Host edit js's os_select and other functions
to use a globally available map to figure out which attributes to
send to the server when one calls "medium_selected" "os_selected" etc.
This will help plugins like Katello and foreman-discovery extend the
global map and add their parameters.
For example all katello would have to do now is to say something like
window.tfm.hosts.registerPluginAttributes('os', ["content_view_id"])
and when os gets selected these attributes will be automatically
get sent to server.