Project

General

Profile

« Previous | Next » 

Revision 406b34f1

Added by Tomer Brisker about 8 years ago

Fixes #14341 - List all images for compute resource

Previously, the listing was paginated, but since the table is loaded
via ajax and handled by datatables, the pagination had no effect,
leading to a list limited to the max per page (20 usually).
Also, improved the lookup to only bring the needed data.

View differences:

app/controllers/images_controller.rb
def index
# Listing images in /hosts/new consumes this method as JSON
values = resource_base.where(:compute_resource_id => @compute_resource.id).search_for(params[:search], :order => params[:order]).includes(:operatingsystem)
@images = resource_base.where(:compute_resource_id => @compute_resource.id).includes(:operatingsystem)
respond_to do |format|
format.html { @images = values.paginate :page => params[:page] }
format.json { render :json => values }
format.html { render :partial => 'images/list' }
format.json { render :json => @images.where(:operatingsystem_id => params[:operatingsystem_id], :architecture_id => params[:architecture_id]) }
end
end

Also available in: Unified diff