From 1fd6f0acd1077733ec4f6de82a5ab782141bb719 Mon Sep 17 00:00:00 2001 From: Jeremy Lenz Date: Fri, 20 Sep 2024 16:03:23 -0400 Subject: [PATCH] Fixes #37827 - Bring back sync status progress bars on initial page load --- .../sync_management/sync_management.js | 22 +++++++++++-------- .../katello/sync_management/index.html.erb | 2 +- 2 files changed, 14 insertions(+), 10 deletions(-) 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 -%>