This is an automated email from the ASF dual-hosted git repository.

sbp pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tooling-trusted-releases.git


The following commit(s) were added to refs/heads/main by this push:
     new 6486ff5  Add a progress bar to the checks banner to indicate polling
6486ff5 is described below

commit 6486ff5e5b92f69189ff7cd197fa649d802decc8
Author: Sean B. Palmer <[email protected]>
AuthorDate: Fri Nov 28 14:46:44 2025 +0000

    Add a progress bar to the checks banner to indicate polling
---
 atr/templates/check-selected.html | 44 ++++++++++++++++++++++++++++++++++++++-
 1 file changed, 43 insertions(+), 1 deletion(-)

diff --git a/atr/templates/check-selected.html 
b/atr/templates/check-selected.html
index 98da71e..7448666 100644
--- a/atr/templates/check-selected.html
+++ b/atr/templates/check-selected.html
@@ -25,6 +25,20 @@
       table tr {
           border-bottom: none;
       }
+
+      #poll-progress-container {
+          height: 6px;
+      }
+
+      @keyframes poll-grow {
+          from {
+              width: 0%;
+          }
+
+          to {
+              width: 100%;
+          }
+      }
   </style>
 {% endblock stylesheets %}
 
@@ -84,6 +98,9 @@
        {% if revision_number %}data-api-url="/api/checks/ongoing/{{ 
release.project.name }}/{{ release.version }}/{{ revision_number }}"{% endif %}>
     <i class="bi bi-exclamation-triangle me-2"></i>
     <span id="ongoing-tasks-text">There {{ 'is' if ongoing_tasks_count == 1 
else 'are' }} currently <strong id="ongoing-tasks-count">{{ ongoing_tasks_count 
}}</strong> background verification {{ 'task' if ongoing_tasks_count == 1 else 
'tasks' }} running for the latest revision. Results shown below may be 
incomplete or outdated until the tasks finish.</span>
+    <div id="poll-progress-container" class="progress mt-2">
+      <div id="poll-progress" class="progress-bar bg-warning"></div>
+    </div>
   </div>
 
   <div class="card mb-4">
@@ -225,11 +242,19 @@
           const countSpan = document.getElementById("ongoing-tasks-count");
           const textSpan = document.getElementById("ongoing-tasks-text");
           const voteButton = document.getElementById("start-vote-button");
-          const pollInterval = 2500;
+          const progress = document.getElementById("poll-progress");
+          const pollInterval = 3000;
 
           let currentCount = parseInt(countSpan?.textContent || "0", 10);
           if (currentCount === 0) return;
 
+          function restartProgress() {
+              if (!progress) return;
+              progress.style.animation = "none";
+              progress.offsetHeight;
+              progress.style.animation = `poll-grow ${pollInterval}ms linear 
forwards`;
+          }
+
           function updateBanner(count) {
               if (!countSpan || !textSpan) return;
 
@@ -266,27 +291,44 @@
           function pollOngoingTasks() {
               if (currentCount === 0) return;
 
+              if (progress) {
+                  progress.style.animation = "none";
+                  progress.style.width = "100%";
+                  progress.classList.remove("bg-warning");
+                  progress.classList.add("bg-info", "progress-bar-striped", 
"progress-bar-animated");
+              }
               fetch(apiUrl)
                   .then(response => {
                       if (!response.ok) throw new Error(`HTTP 
${response.status}`);
                       return response.json();
                   })
                   .then(data => {
+                      if (progress) {
+                          progress.classList.remove("bg-info", 
"progress-bar-striped", "progress-bar-animated");
+                          progress.classList.add("bg-warning");
+                      }
                       const newCount = data.ongoing || 0;
                       if (newCount !== currentCount) {
                           updateBanner(newCount);
                       }
                       if (newCount > 0) {
+                          restartProgress();
                           setTimeout(pollOngoingTasks, pollInterval);
                       }
                   })
                   .catch(error => {
                       console.error("Error polling ongoing tasks:", error);
+                      if (progress) {
+                          progress.classList.remove("bg-info", 
"progress-bar-striped", "progress-bar-animated");
+                          progress.classList.add("bg-warning");
+                      }
+                      restartProgress();
                       // Double the interval when there's an error
                       setTimeout(pollOngoingTasks, pollInterval * 2);
                   });
           }
 
+          restartProgress();
           setTimeout(pollOngoingTasks, pollInterval);
       })();
   </script>


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to