From 539f905e4280ccb4c9be72cd5e8d01c1234755b5 Mon Sep 17 00:00:00 2001 From: Markus Winter Date: Tue, 13 Aug 2024 01:43:28 +0200 Subject: [PATCH 1/2] [JENKINS-73592] refresh buildhistory widget when page gets focus --- war/src/main/js/pages/project/builds-card.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/war/src/main/js/pages/project/builds-card.js b/war/src/main/js/pages/project/builds-card.js index bea375d337d8..5f2e5341e98c 100644 --- a/war/src/main/js/pages/project/builds-card.js +++ b/war/src/main/js/pages/project/builds-card.js @@ -30,6 +30,9 @@ function load(options = {}) { // Avoid fetching if the page isn't active if (document.hidden) { + if (buildHistoryPage.dataset.pageHasUp === "false") { + createRefreshTimeout(); + } return; } @@ -101,6 +104,7 @@ function updateCardControls(parameters) { buildHistoryPage.dataset.pageEntryNewest = parameters.pageEntryNewest; buildHistoryPage.dataset.pageEntryOldest = parameters.pageEntryOldest; + buildHistoryPage.dataset.pageHasUp = parameters.pageHasUp; } paginationPrevious.addEventListener("click", () => { From a2386a841fb20ee8e7f2649bafce8347dca87b4a Mon Sep 17 00:00:00 2001 From: Markus Winter Date: Fri, 16 Aug 2024 00:56:32 +0200 Subject: [PATCH 2/2] [JENKINS-73613] refresh buildhistory in all cases refresh the buildHistory widget instantly when the window gets focus, e.g. after switching browser tabs but also when one was in another application and clicks in the browser window. When the window is visible it will update even when it has no focus, when the window is hidden no calls to the controller will be done. Additionally the buildHistory will be updated when it is not on the first page. So e.g. when someone deletes a build, changes the display name or the description or when a build is still running the page gets updated. --- .../hudson/widgets/HistoryWidget/index.jelly | 2 +- war/src/main/js/pages/project/builds-card.js | 32 ++++++++++++------- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/core/src/main/resources/hudson/widgets/HistoryWidget/index.jelly b/core/src/main/resources/hudson/widgets/HistoryWidget/index.jelly index 8d4663bb00dd..6b158ddc4ea6 100644 --- a/core/src/main/resources/hudson/widgets/HistoryWidget/index.jelly +++ b/core/src/main/resources/hudson/widgets/HistoryWidget/index.jelly @@ -56,7 +56,7 @@ THE SOFTWARE.
-
+