Can Foreman Plugins modify Host Details cards?

Hi,

I’m wondering if a Foreman Plugin can actually modify/extend the contents of existing cards on the Host Details page.

For example, if a plugin wants to add some information to the Virtualization card, would this be possible? If so, how?

If not, should my plugin add a new card instead? Or what would be the recommended way of adding information to the Host Details page?

Thanks
Frank

2 Likes

As far as I know it should be possible, but looking at the developer docs I am not sure if they are up to date!

I do not know an example from my head as most plugins add their own cards, so at least this would be an option. Examples would be Ansible or Puppet.

Here is an example pr: Fixes #34816 - Add Installed Products card (#10075) · Katello/katello@a26097c · GitHub
Here are docs for slot-and-fill
The cards that use the host-tab-details-cards go into the details tab

1 Like

Thanks! I’ve added a new card based on the InstalledProductsCard.js example. However, it does not seem to have access to compute resource attributes.

In the browser console I found the following request that failed:

GET http://foreman:5000/api/hosts/undefined/vm_compute_attributes
Status 404 Not Found

And the Foreman log entries:

12:00:05 rails.1   | 2025-08-06T12:00:05 [I|app|8b7e0bd0] Started GET "/api/hosts/undefined/vm_compute_attributes" for IP at 2025-08-06 12:00:05 +0200
12:00:05 rails.1   | 2025-08-06T12:00:05 [I|app|8b7e0bd0] Processing by Api::V2::HostsController#vm_compute_attributes as JSON
12:00:05 rails.1   | 2025-08-06T12:00:05 [I|app|8b7e0bd0]   Parameters: {"apiv"=>"v2", "id"=>"undefined"}
12:00:05 rails.1   | 2025-08-06T12:00:05 [I|app|8b7e0bd0] Couldn't find Host::Managed with 'id'=undefined [WHERE "hosts"."type" = $1 AND "hosts"."organization_id" = $2 AND "hosts"."location_id" = $3] (ActiveRecord::RecordNotFound)

Am I missing something?

It seems its being called here: webpack/assets/javascripts/react_app/components/HostDetails/Tabs/Details/Cards/Virtualization/index.js
But no idea why hostId will be empty, or how the rest of the page works if hostId is undefined

Thanks again. This example proved to be useful. The missing piece was this code to retrieve compute resource attributes:

const virtUrl = foremanUrl(`/api/hosts/${hostId}/vm_compute_attributes`);
const { response: vm, status } = useAPI('get', virtUrl);
1 Like