fix: 增加任务详情自动刷新
This commit is contained in:
@@ -71,6 +71,26 @@ document.addEventListener("DOMContentLoaded", () => {
|
||||
updateScaleHint();
|
||||
});
|
||||
|
||||
function pollTaskDetailStatus(taskId) {
|
||||
if (!taskId) return;
|
||||
const intervalMs = 3000;
|
||||
const poll = async () => {
|
||||
try {
|
||||
const resp = await fetch(`/api/tasks/${taskId}`, { cache: "no-store" });
|
||||
if (!resp.ok) return;
|
||||
const task = await resp.json();
|
||||
if (task.status !== "running") {
|
||||
window.location.reload();
|
||||
return;
|
||||
}
|
||||
} catch (_error) {
|
||||
return;
|
||||
}
|
||||
window.setTimeout(poll, intervalMs);
|
||||
};
|
||||
window.setTimeout(poll, intervalMs);
|
||||
}
|
||||
|
||||
async function downloadExport(url, defaultFilename, event) {
|
||||
if (event) event.preventDefault();
|
||||
const resp = await fetch(url);
|
||||
|
||||
Reference in New Issue
Block a user