Class: Katello::SyncManagementController

Inherits:
ApplicationController show all
Includes:
ActionView::Helpers::DateHelper, ActionView::Helpers::NumberHelper, Katello::SyncManagementHelper::RepoMethods, TranslationHelper
Defined in:
app/controllers/katello/sync_management_controller.rb

Instance Method Summary collapse

Methods included from Katello::SyncManagementHelper::RepoMethods

#arches, #collect_arches, #collect_minor, #collect_repos, #minors, #pprint_collection

Methods included from TranslationHelper

#month, #months, #relative_time_in_words

Methods inherited from ApplicationController

#authorized, #current_organization_object, #current_organization_object=

Instance Method Details

#destroyObject



45
46
47
48
49
# File 'app/controllers/katello/sync_management_controller.rb', line 45

def destroy
  repo = Repository.where(:id => params[:id]).syncable.first
  repo&.cancel_dynflow_sync
  render :plain => ""
end

#indexObject



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

def index
  org = current_organization_object
  @products = org.library.products.readable
  redhat_products, custom_products = @products.partition(&:redhat?)
  redhat_products.sort_by { |p| p.name.downcase }
  custom_products.sort_by { |p| p.name.downcase }

  @products = redhat_products + custom_products
  @product_size = {}
  @repo_status = {}
  @product_map = collect_repos(@products, org.library, false)

  @products.each { |product| get_product_info(product) }
end

#section_idObject



11
12
13
# File 'app/controllers/katello/sync_management_controller.rb', line 11

def section_id
  'contents'
end

#syncObject



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

def sync
  tasks = sync_repos(params[:repoids]) || []
  render :json => tasks.as_json
end

#sync_statusObject



39
40
41
42
43
# File 'app/controllers/katello/sync_management_controller.rb', line 39

def sync_status
  repos = Repository.where(:id => params[:repoids]).readable
  statuses = repos.map { |repo| format_sync_progress(repo) }
  render :json => statuses.flatten.to_json
end

#titleObject



15
16
17
# File 'app/controllers/katello/sync_management_controller.rb', line 15

def title
  _('Sync Status')
end