history.js: show an empty note when a check recorded no standards or security statuses

This commit is contained in:
ai-bot committed 2026-10-02 15:25:08 +00:00
1 parent 78ac91abfd
commit 98aab74a9d
1 file changed
+22 -4
+22 -4
View File
@@ -23,6 +23,13 @@ function displayFlag(value) {
return "—"; return "—";
} }
function emptyNote(text) {
const note = document.createElement("p");
note.className = "empty-state";
note.textContent = text;
return note;
}
function definitionList(entries) { function definitionList(entries) {
const list = document.createElement("dl"); const list = document.createElement("dl");
list.className = "detail-list"; list.className = "detail-list";
@@ -119,6 +126,10 @@ function keyEntries(keyCheck) {
} }
function toolCheckTable(toolChecks) { function toolCheckTable(toolChecks) {
if (!toolChecks.length) {
// A key that was not available records no standards at all (section 22).
return emptyNote("No BIP327 or SLIP39 results were recorded for this check.");
}
const headers = ["Product", "BIP327", "SLIP39"]; const headers = ["Product", "BIP327", "SLIP39"];
// Older records stored a version, a date, and notes for each product. // Older records stored a version, a date, and notes for each product.
const hasLegacyColumns = toolChecks.some( const hasLegacyColumns = toolChecks.some(
@@ -137,6 +148,16 @@ function toolCheckTable(toolChecks) {
return dataTable(headers, rows); return dataTable(headers, rows);
} }
function securityTable(securityChecks) {
if (!securityChecks.length) {
return emptyNote("No security statuses were recorded for this check.");
}
return dataTable(
["Provider", "Status", "Comment"],
securityChecks.map((entry) => [entry.provider, entry.status, entry.comments]),
);
}
function renderDetail(record) { function renderDetail(record) {
detailTitle.textContent = `Check from ${record.checked_at}`; detailTitle.textContent = `Check from ${record.checked_at}`;
const fragment = document.createDocumentFragment(); const fragment = document.createDocumentFragment();
@@ -152,10 +173,7 @@ function renderDetail(record) {
fragment.append(card("BIP327 and SLIP39", toolCheckTable(record.tool_checks || []))); fragment.append(card("BIP327 and SLIP39", toolCheckTable(record.tool_checks || [])));
fragment.append(card("Security status", dataTable( fragment.append(card("Security status", securityTable(record.ai_security_checks || [])));
["Provider", "Status", "Comment"],
(record.ai_security_checks || []).map((entry) => [entry.provider, entry.status, entry.comments]),
)));
detailBody.replaceChildren(fragment); detailBody.replaceChildren(fragment);
detailSection.hidden = false; detailSection.hidden = false;