Move grouped notes into severity tooltip

This commit is contained in:
2026-04-21 13:14:30 +00:00
parent 1fb62f17c8
commit 37e4309524
3 changed files with 16 additions and 9 deletions

View File

@@ -394,22 +394,18 @@ function renderGroupedTable(groups, { includeOwner=false, includeReason=false, i
`<th>${localize("KSA.Table.References")}</th>`
];
if (includeOwner) headers.push(`<th>${localize("KSA.Field.OwnerPackage")}</th>`);
if (includeReason) headers.push(`<th>${localize("KSA.Table.Note")}</th>`);
if (includeSources) headers.push(`<th>${localize("KSA.Field.Source")}</th>`);
const rows = groups.map(group => {
const note = includeReason
? buildGroupedTooltip(group)
: "";
const cells = [
`<td><span class="storage-audit__severity storage-audit__severity--inline severity-${group.severity}">${severityLabel(group.severity)}</span></td>`,
`<td><span class="storage-audit__severity storage-audit__severity--inline storage-audit__severity--hint severity-${group.severity}" ${note ? `title="${escapeHtml(note)}"` : ""}>${severityLabel(group.severity)}</span></td>`,
`<td><code>${escapeHtml(group.target)}</code></td>`,
`<td>${group.count ?? ""}</td>`
];
if (includeOwner) cells.push(`<td><code>${escapeHtml(group.ownerLabel ?? "")}</code></td>`);
if (includeReason) {
const note = group.targetKind === "wildcard"
? `${group.shortReason ?? group.reason ?? ""} ${localize("KSA.Finding.WildcardNoMatch")}`
: (group.shortReason ?? group.reason ?? "");
cells.push(`<td>${escapeHtml(note.trim())}</td>`);
}
if (includeSources) {
cells.push(`<td>${renderGroupedSourcesCell(group.sources ?? [])}</td>`);
}
@@ -424,6 +420,13 @@ function renderGroupedTable(groups, { includeOwner=false, includeReason=false, i
`;
}
function buildGroupedTooltip(group) {
const note = group.targetKind === "wildcard"
? `${group.shortReason ?? group.reason ?? ""} ${localize("KSA.Finding.WildcardNoMatch")}`
: (group.shortReason ?? group.reason ?? "");
return note.trim();
}
function renderGroupedSourcesCell(sources) {
if (!sources.length) return "";
return `<div class="storage-audit__source-list">${sources.map(source => `<div>${source.renderedSource ?? renderPlainSourceLabel(source)}</div>`).join("")}</div>`;