Sha256: 9474e637e76d771472fff5b195b6c1e415f81941aba1beebe70bfb97e24383c8

Contents?: true

Size: 1.57 KB

Versions: 22

Compression:

Stored size: 1.57 KB

Contents

module Katello
  class ProvidersController < Katello::ApplicationController
    before_filter :find_rh_provider, :only => [:redhat_provider, :redhat_provider_tab]
    before_filter :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 = []

      subscriptions = Resources::Candlepin::Subscription.get_for_owner(current_organization.label)
      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

22 entries across 22 versions & 1 rubygems

Version Path
katello-3.1.0.1 app/controllers/katello/providers_controller.rb
katello-3.1.0 app/controllers/katello/providers_controller.rb
katello-3.1.0.rc2.1 app/controllers/katello/providers_controller.rb
katello-3.0.2 app/controllers/katello/providers_controller.rb
katello-2.4.5 app/controllers/katello/providers_controller.rb
katello-3.1.0.rc1 app/controllers/katello/providers_controller.rb
katello-3.0.1 app/controllers/katello/providers_controller.rb
katello-2.4.4 app/controllers/katello/providers_controller.rb
katello-3.0.0 app/controllers/katello/providers_controller.rb
katello-2.4.3 app/controllers/katello/providers_controller.rb
katello-3.0.0.rc7 app/controllers/katello/providers_controller.rb
katello-3.0.0.rc5 app/controllers/katello/providers_controller.rb
katello-2.4.2 app/controllers/katello/providers_controller.rb
katello-3.0.0.rc4 app/controllers/katello/providers_controller.rb
katello-3.0.0.rc3 app/controllers/katello/providers_controller.rb
katello-3.0.0.rc2 app/controllers/katello/providers_controller.rb
katello-3.0.0.rc1 app/controllers/katello/providers_controller.rb
katello-2.4.1 app/controllers/katello/providers_controller.rb
katello-2.4.0 app/controllers/katello/providers_controller.rb
katello-2.4.0.rc3 app/controllers/katello/providers_controller.rb