fix runid

This commit is contained in:
2026-08-03 17:54:36 +08:00
parent a3b7d3d876
commit 8c3df90a87
6 changed files with 71 additions and 10 deletions
+16 -3
View File
@@ -305,6 +305,7 @@ async function refreshIdentificationFiles() {
state.identificationFiles = result.files || result.fileList || [];
elements.identificationFileList.innerHTML = state.identificationFiles.map((file) => `
<tr><td>${escapeHtml(file.uploadTime || "-")}</td><td>${escapeHtml(file.fileName)}</td>
<td>${escapeHtml(file.runId || "-")}</td>
<td>${file.mediaType === "json" ? "行程 JSON" : "辨识 CSV"}</td><td>${formatSize(file.size)}</td>
<td>${file.status === "processed" ? "已处理" : "待处理"}</td>
<td><button class="table-action" data-identification-preview="${escapeHtml(file.fileID)}">查看</button><button class="table-action" data-identification-download="${escapeHtml(file.fileID)}">下载</button><button class="table-action danger" data-identification-delete="${escapeHtml(file.fileID)}">删除</button></td></tr>
@@ -457,8 +458,9 @@ function showImage(result) {
plot.showImage.disabled = false;
plot.openImage.disabled = false;
if (mediaType === "csv" && result.reviewable) {
state.review = { runId: result.fileName, deviceId: result.deviceId };
elements.reviewTarget.textContent = result.fileName;
const runId = result.runId || result.fileName;
state.review = { runId, deviceId: result.deviceId };
elements.reviewTarget.textContent = `${result.fileName} (runId: ${runId})`;
elements.approveReview.disabled = false;
elements.rejectReview.disabled = false;
}
@@ -954,6 +956,12 @@ elements.identificationFileList.addEventListener("click", async (event) => {
if (result) {
showImage(result);
activateTab("plot-panel");
if ((file.mediaType !== "json") && file.runId) {
state.review = { runId: file.runId, deviceId: elements.deviceId.value };
elements.reviewTarget.textContent = `${result.fileName} (runId: ${file.runId})`;
elements.approveReview.disabled = false;
elements.rejectReview.disabled = false;
}
}
} else if (event.target.dataset.identificationDownload) {
const result = await runBusy("正在保存辨识原始数据", () => window.reinloop.downloadIdentificationFile({
@@ -1146,7 +1154,12 @@ function renderNotifications() {
? "查看结果"
: "查看绘图";
const secondaryAction = notification.type === "identification_result_ready" ? "查看辨识数据" : "";
return `<article class="panel-notification" data-notification-id="${escapeHtml(notification.notificationId)}" data-type="${escapeHtml(notification.type)}"><div class="notification-copy"><strong>${escapeHtml(notification.title)}</strong><span>${escapeHtml(notification.message)}</span></div><div class="notification-actions"><button class="button secondary" data-notification-action="primary" data-notification-id="${escapeHtml(notification.notificationId)}">${action}</button>${secondaryAction ? `<button class="button secondary" data-notification-action="secondary" data-notification-id="${escapeHtml(notification.notificationId)}">${secondaryAction}</button>` : ""}<button class="button icon" title="关闭提醒" aria-label="关闭提醒" data-notification-action="close" data-notification-id="${escapeHtml(notification.notificationId)}">x</button></div></article>`;
const traces = [
notification.runId ? `runId: ${notification.runId}` : "",
notification.fileID ? `fileID: ${notification.fileID}` : "",
notification.requestId ? `requestId: ${notification.requestId}` : ""
].filter(Boolean).join(" | ");
return `<article class="panel-notification" data-notification-id="${escapeHtml(notification.notificationId)}" data-type="${escapeHtml(notification.type)}"><div class="notification-copy"><strong>${escapeHtml(notification.title)}</strong><span>${escapeHtml(notification.message)}</span>${traces ? `<small class="notification-trace">${escapeHtml(traces)}</small>` : ""}</div><div class="notification-actions"><button class="button secondary" data-notification-action="primary" data-notification-id="${escapeHtml(notification.notificationId)}">${action}</button>${secondaryAction ? `<button class="button secondary" data-notification-action="secondary" data-notification-id="${escapeHtml(notification.notificationId)}">${secondaryAction}</button>` : ""}<button class="button icon" title="关闭提醒" aria-label="关闭提醒" data-notification-action="close" data-notification-id="${escapeHtml(notification.notificationId)}">x</button></div></article>`;
}).join("");
}