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, #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

#destroyObject



43
44
45
46
47
# File 'app/controllers/katello/sync_management_controller.rb', line 43

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

#indexObject



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

def index
  org = current_organization
  @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



9
10
11
# File 'app/controllers/katello/sync_management_controller.rb', line 9

def section_id
  'contents'
end

#syncObject



32
33
34
35
# File 'app/controllers/katello/sync_management_controller.rb', line 32

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

#sync_statusObject



37
38
39
40
41
# File 'app/controllers/katello/sync_management_controller.rb', line 37

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



13
14
15
# File 'app/controllers/katello/sync_management_controller.rb', line 13

def title
  _('Sync Status')
end