-
Notifications
You must be signed in to change notification settings - Fork 32
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
base: develop
Are you sure you want to change the base?
Add scoped search and rabl nodes for IoP #934
Conversation
3f71c20
to
1d61d10
Compare
02a9d1b
to
d477dd1
Compare
d477dd1
to
3b30531
Compare
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. |
@parthaa Thanks, updated! |
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. |
class InsightsAdvisorController < ::Api::V2::BaseController | ||
include ::Api::Version2 | ||
|
||
api :GET, "insights_advisor/host_details", N_('Fetch Insights-related host details') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
api :GET, "insights_advisor/host_details", N_('Fetch Insights-related host details') | |
api :GET, "/insights_advisor/host_details", N_('Fetch Insights-related host details') |
insights_uuid
, so you can search hosts by their Insights UUID.insights_facet
so I stop going crazy 😄/api/v2/insights_advisor/host_details
, which returns only Insights-related details about hosts.