(progressPayload, taskId)
| 1411 | } |
| 1412 | |
| 1413 | function updateVendorProgressUi(progressPayload, taskId) { |
| 1414 | const progress = Math.max(0, Math.min(100, Number(progressPayload?.progress || 0))); |
| 1415 | const status = String(progressPayload?.status || "running").toLowerCase(); |
| 1416 | const bar = document.getElementById("vendor-progress-bar"); |
| 1417 | const percent = document.getElementById("vendor-progress-percent"); |
| 1418 | const title = document.getElementById("vendor-progress-title"); |
| 1419 | if (bar) bar.style.width = `${progress}%`; |
| 1420 | if (percent) percent.textContent = `${progress}%`; |
| 1421 | if (title) { |
| 1422 | if (status === "completed") { |
| 1423 | title.textContent = `任务 #${taskId} 订阅完成`; |
| 1424 | } else if (status === "failed") { |
| 1425 | title.textContent = `任务 #${taskId} 订阅失败`; |
| 1426 | } else if (status === "cancelled") { |
| 1427 | title.textContent = `任务 #${taskId} 已停止`; |
| 1428 | } else if (status === "pending") { |
| 1429 | title.textContent = `任务 #${taskId} 已提交,等待同步`; |
| 1430 | } else { |
| 1431 | title.textContent = `任务 #${taskId} 执行中`; |
| 1432 | } |
| 1433 | } |
| 1434 | updateVendorRuntimeHint(progressPayload, status); |
| 1435 | if (status === "running") { |
| 1436 | setVendorStopButtonState(false, true); |
| 1437 | setVendorRetryButtonState(false, false); |
| 1438 | return; |
| 1439 | } |
| 1440 | if (status === "failed") { |
| 1441 | setVendorStopButtonState(true, true); |
| 1442 | setVendorRetryButtonState(false, true); |
| 1443 | return; |
| 1444 | } |
| 1445 | if (status === "pending") { |
| 1446 | setVendorStopButtonState(false, true); |
| 1447 | setVendorRetryButtonState(false, true); |
| 1448 | return; |
| 1449 | } |
| 1450 | setVendorStopButtonState(true, true); |
| 1451 | setVendorRetryButtonState(false, false); |
| 1452 | } |
| 1453 | |
| 1454 | async function pollVendorProgress(taskId) { |
| 1455 | if (!taskId) return; |
no test coverage detected