Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add scoped search and rabl nodes for IoP #934

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

jeremylenz
Copy link
Collaborator

@jeremylenz jeremylenz commented Dec 18, 2024

  1. Add a scoped_search field, insights_uuid, so you can search hosts by their Insights UUID.
  2. Add rabl nodes to the host list API response so you can see insights information. This included adding RABL infrastructure to foreman_rh_cloud, since it didn't use rabl previously.
  3. Add an alias for insights_facet so I stop going crazy 😄
  4. Add a new API endpoint, /api/v2/insights_advisor/host_details, which returns only Insights-related details about hosts.

image

@jeremylenz jeremylenz force-pushed the add-rabl-and-scoped-search branch from 3f71c20 to 1d61d10 Compare December 18, 2024 19:26
@jeremylenz jeremylenz force-pushed the add-rabl-and-scoped-search branch 5 times, most recently from 02a9d1b to d477dd1 Compare December 20, 2024 15:59
@jeremylenz jeremylenz force-pushed the add-rabl-and-scoped-search branch from d477dd1 to 3b30531 Compare December 20, 2024 16:54
@parthaa
Copy link
Collaborator

parthaa commented Dec 21, 2024

I like the rabl + api work. But looks like we can do with a simpler host details controller for the advisors engine. So recommending changes.

-        before_action :find_organization
-
+        api :GET, "insights_advisor/host_details", N_('fetch host details given insights uuid')
+        param :host_uuids, Array, required: true
         def host_details
-          @hosts = ::Host::Managed.search_for(params[:search] || "", :order => params[:order]).where(:organization_id => @organization.id).includes(:insights)
+          uuids = params.require(:host_uuids)
+          @hosts = ::Host.joins(:insights).where(:insights => {:uuid => uuids })
           respond_to do |format|
             format.json { render 'api/v2/insights_advisor/host_details' }
           end
         end

No need to search as I initially thought we would. I just pass in a list of uuids that only insights and katello knows about.

@jeremylenz
Copy link
Collaborator Author

@parthaa Thanks, updated!

@jeremylenz jeremylenz requested a review from parthaa December 23, 2024 15:22
@jeremylenz
Copy link
Collaborator Author

No need to search as I initially thought we would

I removed the search param from the controller. But didn't remove it from scoped_search since I don't see any harm in keeping it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants