fix(admin): streamline error history and preserve safe raw records

This commit is contained in:
Thomas Durieux committed 2026-11-14 19:15:45 +00:00
1 parent b39f3b6878
commit 40ffe7ce72
8 files changed
+330 -202

No files matched your search

+6 -2
View File
@@ -1481,6 +1481,9 @@ export const errorsAdminController = function (state, http, location, interval)
return "info";
}
function decorate(e) {
// Preserve the API's safe record before adding UI-only fields. Raw and
// Copy JSON must not silently omit fields through the summary projection.
e._rawJson = JSON.stringify(e, null, 2);
const detail = (e.raw || []).find(
(a) => a && typeof a === "object" && !Array.isArray(a)
);
@@ -1532,7 +1535,7 @@ export const errorsAdminController = function (state, http, location, interval)
return e;
}
// Build a curated, column-aligned JSON payload for the Raw tab. Mirrors
// Build a curated, column-aligned payload for the readable Details tab. Mirrors
// the reference admin design: name / code / kind / httpStatus / module /
// detail / url / ts on aligned colons. We can't just JSON.stringify the
// raw entry because it includes the human "anonymous error" wrapper
@@ -1543,6 +1546,7 @@ export const errorsAdminController = function (state, http, location, interval)
if (v === undefined || v === null || v === "") return;
fields.push([k, v]);
};
for (const key of ["service", "event", "severity", "requestId", "jobId"]) push(key, detail && detail[key]);
push("name", detail && detail.name);
push("code", entry.displayMessage || (detail && detail.message));
if (entry._bucket) push("kind", entry._bucket);
@@ -1840,7 +1844,7 @@ export const errorsAdminController = function (state, http, location, interval)
timers.timeout(() => { state.copyHint = ""; }, 1500);
}
state.copyJson = (row) => {
navigator.clipboard.writeText(row._detailJson).then(() => flashCopy("JSON"));
navigator.clipboard.writeText(row._rawJson).then(() => flashCopy("JSON"));
};
state.copyCurl = (row) => {
if (!row._url) return;