Highlight module names in notices

This commit is contained in:
2026-04-21 14:43:17 +00:00
parent 4ea1a47239
commit 3d68eab7ef
2 changed files with 11 additions and 2 deletions

View File

@@ -2,7 +2,7 @@
"id": "kosmos-storage-audit", "id": "kosmos-storage-audit",
"title": "Kosmos Storage Audit", "title": "Kosmos Storage Audit",
"description": "Analyzes media references and risky storage locations across Foundry data and public roots.", "description": "Analyzes media references and risky storage locations across Foundry data and public roots.",
"version": "0.0.26", "version": "0.0.27",
"compatibility": { "compatibility": {
"minimum": "13", "minimum": "13",
"verified": "13" "verified": "13"

View File

@@ -241,7 +241,7 @@ function renderProgress(progress, loading) {
function renderNotices(notices, loading) { function renderNotices(notices, loading) {
if (loading || !notices?.length) return ""; if (loading || !notices?.length) return "";
const items = notices.map(notice => `<li>${escapeHtml(notice.message ?? "")}</li>`).join(""); const items = notices.map(notice => `<li>${renderNoticeMessage(notice)}</li>`).join("");
return ` return `
<section class="storage-audit__summary storage-audit__summary--notices"> <section class="storage-audit__summary storage-audit__summary--notices">
<h3>${localize("KSA.Notice.Title")}</h3> <h3>${localize("KSA.Notice.Title")}</h3>
@@ -250,6 +250,15 @@ function renderNotices(notices, loading) {
`; `;
} }
function renderNoticeMessage(notice) {
const moduleLabels = Array.isArray(notice?.moduleLabels) ? notice.moduleLabels : [];
if (!moduleLabels.length) return escapeHtml(notice?.message ?? "");
const plainModules = moduleLabels.join(", ");
const highlightedModules = moduleLabels.map(label => `<strong>${escapeHtml(label)}</strong>`).join(", ");
return escapeHtml(notice?.message ?? "").replace(escapeHtml(plainModules), highlightedModules);
}
function renderSummary(summary, loading) { function renderSummary(summary, loading) {
if (loading) return ""; if (loading) return "";
if (!summary) { if (!summary) {