Remove raw finding view
This commit is contained in:
@@ -18,12 +18,7 @@
|
||||
"Export": "Report exportieren",
|
||||
"ScopeLabel": "Umfang",
|
||||
"ShowAll": "Alle Findings",
|
||||
"ShowWarnings": "Nur Warnungen",
|
||||
"DetailLabel": "Details",
|
||||
"GroupedOnly": "Nur Gruppen",
|
||||
"WithRaw": "Mit Einzelfällen",
|
||||
"ShowRaw": "Einzelfälle anzeigen",
|
||||
"HideRaw": "Einzelfälle ausblenden"
|
||||
"ShowWarnings": "Nur Warnungen"
|
||||
},
|
||||
"Progress": {
|
||||
"Initialize": "Initialisiere Analyse",
|
||||
@@ -64,8 +59,6 @@
|
||||
"NoGrouped": "Keine gruppierten {scope}Findings vorhanden.",
|
||||
"NoPrompt": "Die Analyse kann direkt aus dieser Ansicht gestartet werden.",
|
||||
"Running": "Analyse läuft...",
|
||||
"NoRaw": "Keine {scope}Findings gefunden.",
|
||||
"RawEntries": "Einzelfälle",
|
||||
"Samples": "Beispiele",
|
||||
"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.",
|
||||
|
||||
@@ -18,12 +18,7 @@
|
||||
"Export": "Export Report",
|
||||
"ScopeLabel": "Scope",
|
||||
"ShowAll": "All Findings",
|
||||
"ShowWarnings": "Warnings Only",
|
||||
"DetailLabel": "Details",
|
||||
"GroupedOnly": "Grouped Only",
|
||||
"WithRaw": "With Raw Entries",
|
||||
"ShowRaw": "Show Raw Entries",
|
||||
"HideRaw": "Hide Raw Entries"
|
||||
"ShowWarnings": "Warnings Only"
|
||||
},
|
||||
"Progress": {
|
||||
"Initialize": "Initializing analysis",
|
||||
@@ -64,8 +59,6 @@
|
||||
"NoGrouped": "No grouped {scope}findings available.",
|
||||
"NoPrompt": "The analysis can be started directly from this view.",
|
||||
"Running": "Analysis in progress...",
|
||||
"NoRaw": "No {scope}findings found.",
|
||||
"RawEntries": "Raw Entries",
|
||||
"Samples": "Examples",
|
||||
"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.",
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"id": "kosmos-storage-audit",
|
||||
"title": "Kosmos Storage Audit",
|
||||
"description": "Analyzes media references and risky storage locations across Foundry data and public roots.",
|
||||
"version": "0.0.22",
|
||||
"version": "0.0.23",
|
||||
"compatibility": {
|
||||
"minimum": "13",
|
||||
"verified": "13"
|
||||
|
||||
@@ -6,7 +6,6 @@ export class StorageAuditReportApp extends foundry.applications.api.ApplicationV
|
||||
actions: {
|
||||
runAnalysis: StorageAuditReportApp.#onRunAnalysis,
|
||||
toggleShowAll: StorageAuditReportApp.#onToggleShowAll,
|
||||
toggleRaw: StorageAuditReportApp.#onToggleRaw,
|
||||
exportReport: StorageAuditReportApp.#onExportReport
|
||||
},
|
||||
window: {
|
||||
@@ -24,7 +23,6 @@ export class StorageAuditReportApp extends foundry.applications.api.ApplicationV
|
||||
#loading = false;
|
||||
#showAll = false;
|
||||
#progress = null;
|
||||
#showRaw = false;
|
||||
|
||||
constructor(options = {}) {
|
||||
super(options);
|
||||
@@ -39,11 +37,9 @@ export class StorageAuditReportApp extends foundry.applications.api.ApplicationV
|
||||
loading: this.#loading,
|
||||
hasAnalysis: !!this.#analysis,
|
||||
showAll: this.#showAll,
|
||||
showRaw: this.#showRaw,
|
||||
progress: this.#progress,
|
||||
summary: this.#summarize(this.#analysis),
|
||||
groupedFindings,
|
||||
findings: await enrichFindings(visibleFindings)
|
||||
groupedFindings
|
||||
};
|
||||
}
|
||||
|
||||
@@ -90,35 +86,11 @@ export class StorageAuditReportApp extends foundry.applications.api.ApplicationV
|
||||
</button>
|
||||
</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>
|
||||
</section>
|
||||
${renderProgress(context.progress, context.loading)}
|
||||
${renderSummary(context.summary, context.loading)}
|
||||
${renderGroupedFindingList(context.groupedFindings, context.hasAnalysis, context.loading, context.showAll)}
|
||||
${renderFindingList(context.findings, context.hasAnalysis, context.loading, context.showAll, context.showRaw)}
|
||||
`;
|
||||
return container;
|
||||
}
|
||||
@@ -165,16 +137,6 @@ export class StorageAuditReportApp extends foundry.applications.api.ApplicationV
|
||||
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() {
|
||||
if (!this.#analysis) return;
|
||||
const payload = {
|
||||
@@ -245,17 +207,6 @@ export class StorageAuditReportApp extends foundry.applications.api.ApplicationV
|
||||
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) {
|
||||
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>`;
|
||||
}
|
||||
|
||||
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) {
|
||||
return {
|
||||
brokenReferences: groupByTarget(findings.filter(f => f.kind === "broken-reference")),
|
||||
@@ -645,24 +559,6 @@ async function enrichGroupedSources(groups) {
|
||||
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) {
|
||||
const markup = buildSourceMarkup(source);
|
||||
if (!markup) return renderPlainSourceLabel(source);
|
||||
|
||||
Reference in New Issue
Block a user