diff --git a/app/assets/javascripts/katello/sync_management/sync_management.js b/app/assets/javascripts/katello/sync_management/sync_management.js index cc0b706e2d6..44bfa017727 100644 --- a/app/assets/javascripts/katello/sync_management/sync_management.js +++ b/app/assets/javascripts/katello/sync_management/sync_management.js @@ -205,10 +205,22 @@ KT.content = (function () { $(this).collapse(); }); }; + populate_repo_status = function () { + var ids = []; + $.each(KT.repo_status, function (repo_id, status) { + if (status.is_running) { + ids.push(repo_id); + KT.content.draw_syncing(repo_id, status.progress.progress, status.sync_id); + } + }); + KT.content.reset_products(KT.repo_status); + KT.content_actions.addSyncing(ids); + } return { updateProduct: updateProduct, updateRepo: updateRepo, + populateRepoStatus: populate_repo_status, finishRepo: finishRepo, select_all: select_all, select_none: select_none, @@ -346,15 +358,7 @@ KT.content_actions = (function () { }; })(); -var ids = []; -$.each(KT.repo_status, function (repo_id, status) { - if (status.is_running) { - ids.push(repo_id); - KT.content.draw_syncing(repo_id, status.progress.progress, status.sync_id); - } -}); -KT.content.reset_products(KT.repo_status); -KT.content_actions.addSyncing(ids); +KT.content.populateRepoStatus(); $("#select_all").on("click", KT.content.select_all); $("#select_none").on("click", KT.content.select_none); diff --git a/app/views/katello/sync_management/index.html.erb b/app/views/katello/sync_management/index.html.erb index fcc49800c8f..b0111ee32b9 100644 --- a/app/views/katello/sync_management/index.html.erb +++ b/app/views/katello/sync_management/index.html.erb @@ -8,9 +8,9 @@ "complete": "<%= escape_javascript(_('Sync complete.')) %>", "no_start_time": "<%= escape_javascript(_('No start time currently available.')) %>" }); - KT.repo_status = JSON.parse('<%= escape_javascript(@repo_status.to_json.html_safe) %>'); KT.permissions = { "syncable" : <%= any_syncable? %> }; + KT.content.populateRepoStatus(); <% end -%>