Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions app/controllers/api/v2/job_invocations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,11 @@ def output
def hosts
set_hosts_and_template_invocations
set_statuses_and_smart_proxies
@total = @job_invocation.targeting.hosts.size
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is removed since it's essentially this: https://github.com/theforeman/foreman_remote_execution/blob/master/app/controllers/api/v2/job_invocations_controller.rb#L304, although not sure 'cause of .where later when params[:search] is present.

@total = @hosts.size
@hosts = @hosts.search_for(params[:search], :order => params[:order]).paginate(:page => params[:page], :per_page => params[:per_page])
@subtotal = @hosts.total_entries
if params[:awaiting]
@hosts = @hosts.select { |host| @host_statuses[host.id] == 'N/A' }
@subtotal = @hosts.size
else
@subtotal = @hosts.respond_to?(:total_entries) ? @hosts.total_entries : @hosts.sizes
end
render :hosts, :layout => 'api/v2/layouts/index_layout'
end
Expand Down Expand Up @@ -303,7 +301,7 @@ def set_hosts_and_template_invocations
@pattern_template_invocations = @job_invocation.pattern_template_invocations.includes(:input_values)
@hosts = @job_invocation.targeting.hosts.authorized(:view_hosts, Host)

unless params[:search].nil?
if params[:search].present?
@hosts = @hosts.joins(:template_invocations)
.where(:template_invocations => { :job_invocation_id => @job_invocation.id})
end
Expand Down
Loading