Class: Katello::ProvidersController

Inherits:
ApplicationController show all
Defined in:
app/controllers/katello/providers_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#authorized, #current_organization, #current_organization=, #default_label, #default_label_assigned, #escape_html, #flash_to_headers, #format_time, #generate_label, #label_overridden, #n_gettext_for_generate_label, #no_env_available_msg, #parse_calendar_date, #permission_denied, #render_correct_nav

Instance Method Details

#controller_display_nameObject



38
39
40
# File 'app/controllers/katello/providers_controller.rb', line 38

def controller_display_name
  return 'provider'
end

#find_rh_providerObject



34
35
36
# File 'app/controllers/katello/providers_controller.rb', line 34

def find_rh_provider
  @provider = current_organization.redhat_provider
end

#redhat_providerObject



12
13
14
# File 'app/controllers/katello/providers_controller.rb', line 12

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

#redhat_provider_tabObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'app/controllers/katello/providers_controller.rb', line 16

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

#search_filterObject



42
43
44
# File 'app/controllers/katello/providers_controller.rb', line 42

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

#section_idObject



8
9
10
# File 'app/controllers/katello/providers_controller.rb', line 8

def section_id
  'contents'
end

#titleObject



46
47
48
# File 'app/controllers/katello/providers_controller.rb', line 46

def title
  _('Repositories')
end