File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -500,6 +500,7 @@ def badge(result: str | None) -> str:
500500 <button data-filter="pending" onclick="setFilter(this)">Pending</button>
501501 <button data-filter="same" onclick="setFilter(this)">Same</button>
502502 </div>
503+ <button class="btn" id="update-all" onclick="updateAll()">Update all in view</button>
503504 { log_link }
504505 </div>
505506</header>
@@ -555,6 +556,39 @@ def badge(result: str | None) -> str:
555556 document.getElementById("chip-pending").textContent = counts.pending + " pending";
556557}
557558
559+ async function updateAll() {
560+ const rows = [...document.querySelectorAll("tbody tr")].filter(tr => !tr.hidden);
561+ if (rows.length === 0) {
562+ alert("No files in the current view.");
563+ return;
564+ }
565+ if (!confirm(`Update reference for ${rows.length} file(s) in the current view?`)) return;
566+
567+ const btn = document.getElementById("update-all");
568+ const label = btn.textContent;
569+ btn.disabled = true;
570+
571+ const failed = [];
572+ let done = 0;
573+ for (const tr of rows) {
574+ const path = tr.dataset.path;
575+ btn.textContent = `Updating ${++done}/${rows.length}…`;
576+ try {
577+ const res = await fetch(`/update_ref/${path}`);
578+ if (!res.ok) failed.push(path);
579+ } catch (e) {
580+ failed.push(path);
581+ }
582+ }
583+
584+ btn.disabled = false;
585+ btn.textContent = label;
586+ if (failed.length) {
587+ alert(`Updated ${rows.length - failed.length}/${rows.length}. Failed:\n ` + failed.join("\n "));
588+ }
589+ location.reload();
590+ }
591+
558592async function poll() {
559593 try {
560594 const res = await fetch("/status");
You can’t perform that action at this time.
0 commit comments