Sha256: 315ac9672be398565e24b170dd13d381165771c53b7cb01b3a6ae204ce9301be

Contents?: true

Size: 1.66 KB

Versions: 2

Compression:

Stored size: 1.66 KB

Contents

module Katello
  class ProvidersController < Katello::ApplicationController
    before_action :find_rh_provider, :only => [:redhat_provider, :redhat_provider_tab]
    before_action :search_filter, :only => [:auto_complete_search]

    respond_to :html, :js

    def section_id
      'contents'
    end

    def redhat_provider
      render :template => "katello/providers/redhat/show"
    end

    def redhat_provider_tab
      #preload orphaned product information, as it is very slow per product
      subscription_product_ids = []
      included_list = %w(product.id providedProducts.id derivedProvidedProducts.id)
      subscriptions = Resources::Candlepin::Subscription.get_for_owner(current_organization.label, included_list)
      subscriptions.each do |sub|
        subscription_product_ids << sub['product']['id'] if sub['product']['id']
        subscription_product_ids += sub['providedProducts'].map { |p| p['id'] } if sub['providedProducts']
        subscription_product_ids += sub['derivedProvidedProducts'].map { |p| p['id'] } if sub['derivedProvidedProducts']
      end

      orphaned_product_ids = current_organization.redhat_provider.products.
          where("cp_id not in (?)", subscription_product_ids).pluck(:id)

      render :partial => "katello/providers/redhat/tab",
             :locals => { :tab_id => params[:tab], :orphaned_product_ids => orphaned_product_ids }
    end

    def find_rh_provider
      @provider = current_organization.redhat_provider
    end

    def controller_display_name
      return 'provider'
    end

    def search_filter
      @filter = {:organization_id => current_organization}
    end

    def title
      _('Repositories')
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
katello-3.3.0.rc1.1 app/controllers/katello/providers_controller.rb
katello-3.3.0.rc1 app/controllers/katello/providers_controller.rb