Class: Katello::Api::V2::ContentViewRepositoriesController
- Inherits:
-
ApiController
- Object
- Api::V2::BaseController
- ApiController
- Katello::Api::V2::ContentViewRepositoriesController
- Includes:
- Concerns::FilteredAutoCompleteSearch
- Defined in:
- app/controllers/katello/api/v2/content_view_repositories_controller.rb
Constant Summary
Constants included from Concerns::FilteredAutoCompleteSearch
Concerns::FilteredAutoCompleteSearch::PAGE_SIZE
Instance Method Summary collapse
Methods included from Concerns::FilteredAutoCompleteSearch
Methods inherited from ApiController
#check_katello_agent_not_disabled, #deprecate_katello_agent, #empty_search_query?, #full_result_response, #katello_agent_removal_release, #resource_class, #scoped_search, #skip_session
Methods included from Rendering
#respond_for_async, #respond_for_bulk_async, #respond_for_create, #respond_for_destroy, #respond_for_index, #respond_for_show, #respond_for_status, #respond_for_update, #respond_with_template, #respond_with_template_collection, #respond_with_template_resource, #try_specific_collection_template, #try_specific_resource_template
Methods included from Katello::Api::Version2
Instance Method Details
#show_all ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'app/controllers/katello/api/v2/content_view_repositories_controller.rb', line 14 def show_all kr = Katello::Repository.table_name krr = Katello::RootRepository.table_name kcvr = Katello::ContentViewRepository.table_name join_query = " LEFT OUTER JOIN \#{kcvr}\n ON \#{kr}.id = \#{kcvr}.repository_id\n AND \#{kcvr}.content_view_id = \#{@content_view.id}\n SQL\n order_query = <<-SQL\n CAST (\#{kcvr}.repository_id as BOOLEAN) ASC, \#{krr}.name\n SQL\n\n query = Katello::Repository.readable.in_default_view.in_organization(@organization)\n query = query.with_type(params[:content_type]) if params[:content_type]\n # Use custom sort to perform the join and order since we need to order by specific content_view\n # and the ORDER BY query needs access to the katello_content_view_repositories table\n custom_sort = ->(sort_query) { sort_query.joins(:root).joins(join_query).order(Arel.sql(order_query)) }\n options = { resource_class: Katello::Repository, custom_sort: custom_sort }\n repos = scoped_search(query, nil, nil, options)\n\n respond_for_index(:collection => repos)\nend\n" |