Remove raw finding view

This commit is contained in:
2026-04-21 13:28:11 +00:00
parent 37e4309524
commit 6d8f7a0559
4 changed files with 4 additions and 122 deletions

View File

@@ -18,12 +18,7 @@
"Export": "Report exportieren", "Export": "Report exportieren",
"ScopeLabel": "Umfang", "ScopeLabel": "Umfang",
"ShowAll": "Alle Findings", "ShowAll": "Alle Findings",
"ShowWarnings": "Nur Warnungen", "ShowWarnings": "Nur Warnungen"
"DetailLabel": "Details",
"GroupedOnly": "Nur Gruppen",
"WithRaw": "Mit Einzelfällen",
"ShowRaw": "Einzelfälle anzeigen",
"HideRaw": "Einzelfälle ausblenden"
}, },
"Progress": { "Progress": {
"Initialize": "Initialisiere Analyse", "Initialize": "Initialisiere Analyse",
@@ -64,8 +59,6 @@
"NoGrouped": "Keine gruppierten {scope}Findings vorhanden.", "NoGrouped": "Keine gruppierten {scope}Findings vorhanden.",
"NoPrompt": "Die Analyse kann direkt aus dieser Ansicht gestartet werden.", "NoPrompt": "Die Analyse kann direkt aus dieser Ansicht gestartet werden.",
"Running": "Analyse läuft...", "Running": "Analyse läuft...",
"NoRaw": "Keine {scope}Findings gefunden.",
"RawEntries": "Einzelfälle",
"Samples": "Beispiele", "Samples": "Beispiele",
"UnanchoredPackageTargets": "Unverankerte Paketziele", "UnanchoredPackageTargets": "Unverankerte Paketziele",
"UnanchoredPackageTargetsDesc": "Diese Ziele liegen in Modul- oder Systemordnern, werden aus Weltdaten referenziert, sind im Owner-Paket selbst aber derzeit nicht als Referenz sichtbar.", "UnanchoredPackageTargetsDesc": "Diese Ziele liegen in Modul- oder Systemordnern, werden aus Weltdaten referenziert, sind im Owner-Paket selbst aber derzeit nicht als Referenz sichtbar.",

View File

@@ -18,12 +18,7 @@
"Export": "Export Report", "Export": "Export Report",
"ScopeLabel": "Scope", "ScopeLabel": "Scope",
"ShowAll": "All Findings", "ShowAll": "All Findings",
"ShowWarnings": "Warnings Only", "ShowWarnings": "Warnings Only"
"DetailLabel": "Details",
"GroupedOnly": "Grouped Only",
"WithRaw": "With Raw Entries",
"ShowRaw": "Show Raw Entries",
"HideRaw": "Hide Raw Entries"
}, },
"Progress": { "Progress": {
"Initialize": "Initializing analysis", "Initialize": "Initializing analysis",
@@ -64,8 +59,6 @@
"NoGrouped": "No grouped {scope}findings available.", "NoGrouped": "No grouped {scope}findings available.",
"NoPrompt": "The analysis can be started directly from this view.", "NoPrompt": "The analysis can be started directly from this view.",
"Running": "Analysis in progress...", "Running": "Analysis in progress...",
"NoRaw": "No {scope}findings found.",
"RawEntries": "Raw Entries",
"Samples": "Examples", "Samples": "Examples",
"UnanchoredPackageTargets": "Unanchored Package Targets", "UnanchoredPackageTargets": "Unanchored Package Targets",
"UnanchoredPackageTargetsDesc": "These targets live in module or system folders, are referenced from world data, but are currently not visibly referenced by their owning package.", "UnanchoredPackageTargetsDesc": "These targets live in module or system folders, are referenced from world data, but are currently not visibly referenced by their owning package.",

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.22", "version": "0.0.23",
"compatibility": { "compatibility": {
"minimum": "13", "minimum": "13",
"verified": "13" "verified": "13"

View File

@@ -6,7 +6,6 @@ export class StorageAuditReportApp extends foundry.applications.api.ApplicationV
actions: { actions: {
runAnalysis: StorageAuditReportApp.#onRunAnalysis, runAnalysis: StorageAuditReportApp.#onRunAnalysis,
toggleShowAll: StorageAuditReportApp.#onToggleShowAll, toggleShowAll: StorageAuditReportApp.#onToggleShowAll,
toggleRaw: StorageAuditReportApp.#onToggleRaw,
exportReport: StorageAuditReportApp.#onExportReport exportReport: StorageAuditReportApp.#onExportReport
}, },
window: { window: {
@@ -24,7 +23,6 @@ export class StorageAuditReportApp extends foundry.applications.api.ApplicationV
#loading = false; #loading = false;
#showAll = false; #showAll = false;
#progress = null; #progress = null;
#showRaw = false;
constructor(options = {}) { constructor(options = {}) {
super(options); super(options);
@@ -39,11 +37,9 @@ export class StorageAuditReportApp extends foundry.applications.api.ApplicationV
loading: this.#loading, loading: this.#loading,
hasAnalysis: !!this.#analysis, hasAnalysis: !!this.#analysis,
showAll: this.#showAll, showAll: this.#showAll,
showRaw: this.#showRaw,
progress: this.#progress, progress: this.#progress,
summary: this.#summarize(this.#analysis), summary: this.#summarize(this.#analysis),
groupedFindings, groupedFindings
findings: await enrichFindings(visibleFindings)
}; };
} }
@@ -90,35 +86,11 @@ export class StorageAuditReportApp extends foundry.applications.api.ApplicationV
</button> </button>
</div> </div>
</div> </div>
<div class="storage-audit__toggle-group" role="group" aria-label="${escapeHtml(localize("KSA.Action.DetailLabel"))}">
<span class="storage-audit__toggle-label">${localize("KSA.Action.DetailLabel")}</span>
<div class="storage-audit__toggle-buttons">
<button
type="button"
class="button ${context.showRaw ? "" : "active"}"
data-action="toggleRaw"
data-mode="grouped"
aria-pressed="${context.showRaw ? "false" : "true"}"
${context.hasAnalysis ? "" : "disabled"}>
<span>${localize("KSA.Action.GroupedOnly")}</span>
</button>
<button
type="button"
class="button ${context.showRaw ? "active" : ""}"
data-action="toggleRaw"
data-mode="raw"
aria-pressed="${context.showRaw ? "true" : "false"}"
${context.hasAnalysis ? "" : "disabled"}>
<span>${localize("KSA.Action.WithRaw")}</span>
</button>
</div>
</div>
</div> </div>
</section> </section>
${renderProgress(context.progress, context.loading)} ${renderProgress(context.progress, context.loading)}
${renderSummary(context.summary, context.loading)} ${renderSummary(context.summary, context.loading)}
${renderGroupedFindingList(context.groupedFindings, context.hasAnalysis, context.loading, context.showAll)} ${renderGroupedFindingList(context.groupedFindings, context.hasAnalysis, context.loading, context.showAll)}
${renderFindingList(context.findings, context.hasAnalysis, context.loading, context.showAll, context.showRaw)}
`; `;
return container; return container;
} }
@@ -165,16 +137,6 @@ export class StorageAuditReportApp extends foundry.applications.api.ApplicationV
return this.render({ force: true }); return this.render({ force: true });
} }
toggleRaw() {
this.#showRaw = !this.#showRaw;
return this.render({ force: true });
}
setShowRaw(value) {
this.#showRaw = !!value;
return this.render({ force: true });
}
exportReport() { exportReport() {
if (!this.#analysis) return; if (!this.#analysis) return;
const payload = { const payload = {
@@ -245,17 +207,6 @@ export class StorageAuditReportApp extends foundry.applications.api.ApplicationV
return this.toggleShowAll(); return this.toggleShowAll();
} }
static #onToggleRaw(_event, _button) {
const mode = _button?.dataset?.mode;
if (mode === "grouped") {
return this.setShowRaw(false);
}
if (mode === "raw") {
return this.setShowRaw(true);
}
return this.toggleRaw();
}
static #onExportReport(_event, _button) { static #onExportReport(_event, _button) {
return this.exportReport(); return this.exportReport();
} }
@@ -432,43 +383,6 @@ function renderGroupedSourcesCell(sources) {
return `<div class="storage-audit__source-list">${sources.map(source => `<div>${source.renderedSource ?? renderPlainSourceLabel(source)}</div>`).join("")}</div>`; return `<div class="storage-audit__source-list">${sources.map(source => `<div>${source.renderedSource ?? renderPlainSourceLabel(source)}</div>`).join("")}</div>`;
} }
function renderFindingList(findings, hasAnalysis, loading, showAll, showRaw) {
if (loading) {
return `<section class="storage-audit__list"><p>${localize("KSA.Section.Running")}</p></section>`;
}
if (!hasAnalysis) {
return `<section class="storage-audit__list"><p>${localize("KSA.Section.NoPrompt")}</p></section>`;
}
if (!showRaw) {
return "";
}
if (!findings.length) {
return `<section class="storage-audit__list"><p>${format("KSA.Section.NoRaw", { scope: localize(showAll ? "KSA.Scope.Empty" : "KSA.Scope.Warning") })}</p></section>`;
}
const items = findings.map(finding => `
<article class="storage-audit__finding severity-${finding.severity}">
<header>
<span class="storage-audit__severity">${severityLabel(finding.severity)}</span>
<span>${humanizeKind(finding.kind)}</span>
</header>
<p>${escapeHtml(finding.reason)}</p>
<dl>
<div><dt>${localize("KSA.Field.Target")}</dt><dd><code>${escapeHtml(finding.target.locator ?? `${finding.target.storage}:${finding.target.path}`)}</code></dd></div>
${finding.source ? `<div><dt>${localize("KSA.Field.Source")}</dt><dd>${finding.source.renderedSource ?? renderPlainSourceLabel(finding.source)}</dd></div>` : ""}
</dl>
<p class="storage-audit__recommendation">${escapeHtml(finding.recommendation)}</p>
</article>
`).join("");
return `
<section class="storage-audit__list storage-audit__list--raw">
<h3>${localize("KSA.Section.RawEntries")}</h3>
${items}
</section>
`;
}
function groupFindings(findings) { function groupFindings(findings) {
return { return {
brokenReferences: groupByTarget(findings.filter(f => f.kind === "broken-reference")), brokenReferences: groupByTarget(findings.filter(f => f.kind === "broken-reference")),
@@ -645,24 +559,6 @@ async function enrichGroupedSources(groups) {
return enriched; return enriched;
} }
async function enrichFindings(findings) {
const enriched = [];
for (const finding of findings) {
if (!finding.source) {
enriched.push(finding);
continue;
}
enriched.push({
...finding,
source: {
...finding.source,
renderedSource: await renderSourceHtml(finding.source)
}
});
}
return enriched;
}
async function renderSourceHtml(source) { async function renderSourceHtml(source) {
const markup = buildSourceMarkup(source); const markup = buildSourceMarkup(source);
if (!markup) return renderPlainSourceLabel(source); if (!markup) return renderPlainSourceLabel(source);