Remove misleading severity filter

This commit is contained in:
2026-04-21 15:05:07 +00:00
parent 3d68eab7ef
commit 987d20ce15
5 changed files with 10 additions and 98 deletions

View File

@@ -15,10 +15,7 @@
"Action": { "Action": {
"Run": "Analyse starten", "Run": "Analyse starten",
"Running": "Analysiere...", "Running": "Analysiere...",
"Export": "Report exportieren", "Export": "Report exportieren"
"ScopeLabel": "Umfang",
"ShowAll": "Alle Findings",
"ShowWarnings": "Nur Warnungen"
}, },
"Progress": { "Progress": {
"Initialize": "Initialisiere Analyse", "Initialize": "Initialisiere Analyse",
@@ -61,7 +58,7 @@
}, },
"Section": { "Section": {
"WorkView": "Arbeitsansicht", "WorkView": "Arbeitsansicht",
"NoGrouped": "Keine gruppierten {scope}Findings vorhanden.", "NoGrouped": "Keine gruppierten 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...",
"Samples": "Beispiele", "Samples": "Beispiele",
@@ -118,10 +115,6 @@
}, },
"Export": { "Export": {
"Filename": "kosmos-storage-audit-{timestamp}.json" "Filename": "kosmos-storage-audit-{timestamp}.json"
},
"Scope": {
"Warning": "warnenden ",
"Empty": ""
} }
} }
} }

View File

@@ -15,10 +15,7 @@
"Action": { "Action": {
"Run": "Start Analysis", "Run": "Start Analysis",
"Running": "Analyzing...", "Running": "Analyzing...",
"Export": "Export Report", "Export": "Export Report"
"ScopeLabel": "Scope",
"ShowAll": "All Findings",
"ShowWarnings": "Warnings Only"
}, },
"Progress": { "Progress": {
"Initialize": "Initializing analysis", "Initialize": "Initializing analysis",
@@ -61,7 +58,7 @@
}, },
"Section": { "Section": {
"WorkView": "Work View", "WorkView": "Work View",
"NoGrouped": "No grouped {scope}findings available.", "NoGrouped": "No grouped 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...",
"Samples": "Examples", "Samples": "Examples",
@@ -118,10 +115,6 @@
}, },
"Export": { "Export": {
"Filename": "kosmos-storage-audit-{timestamp}.json" "Filename": "kosmos-storage-audit-{timestamp}.json"
},
"Scope": {
"Warning": "warning ",
"Empty": ""
} }
} }
} }

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

View File

@@ -5,7 +5,6 @@ export class StorageAuditReportApp extends foundry.applications.api.ApplicationV
tag: "div", tag: "div",
actions: { actions: {
runAnalysis: StorageAuditReportApp.#onRunAnalysis, runAnalysis: StorageAuditReportApp.#onRunAnalysis,
toggleShowAll: StorageAuditReportApp.#onToggleShowAll,
exportReport: StorageAuditReportApp.#onExportReport exportReport: StorageAuditReportApp.#onExportReport
}, },
window: { window: {
@@ -21,7 +20,6 @@ export class StorageAuditReportApp extends foundry.applications.api.ApplicationV
#analysis = null; #analysis = null;
#loading = false; #loading = false;
#showAll = false;
#progress = null; #progress = null;
constructor(options = {}) { constructor(options = {}) {
@@ -31,12 +29,10 @@ export class StorageAuditReportApp extends foundry.applications.api.ApplicationV
async _prepareContext() { async _prepareContext() {
const findings = this.#analysis?.findings ?? []; const findings = this.#analysis?.findings ?? [];
const visibleFindings = this.#showAll ? findings : findings.filter(f => f.severity !== "info"); const groupedFindings = await enrichGroupedFindings(groupFindings(findings));
const groupedFindings = await enrichGroupedFindings(groupFindings(visibleFindings));
return { return {
loading: this.#loading, loading: this.#loading,
hasAnalysis: !!this.#analysis, hasAnalysis: !!this.#analysis,
showAll: this.#showAll,
progress: this.#progress, progress: this.#progress,
notices: this.#analysis?.notices ?? [], notices: this.#analysis?.notices ?? [],
moduleVersion: game.modules.get("kosmos-storage-audit")?.version ?? null, moduleVersion: game.modules.get("kosmos-storage-audit")?.version ?? null,
@@ -68,35 +64,12 @@ export class StorageAuditReportApp extends foundry.applications.api.ApplicationV
<i class="fa-solid fa-file-export"></i> <i class="fa-solid fa-file-export"></i>
<span>${localize("KSA.Action.Export")}</span> <span>${localize("KSA.Action.Export")}</span>
</button> </button>
<div class="storage-audit__toggle-group" role="group" aria-label="${escapeHtml(localize("KSA.Action.ScopeLabel"))}">
<span class="storage-audit__toggle-label">${localize("KSA.Action.ScopeLabel")}</span>
<div class="storage-audit__toggle-buttons">
<button
type="button"
class="button ${context.showAll ? "" : "active"}"
data-action="toggleShowAll"
data-mode="warnings"
aria-pressed="${context.showAll ? "false" : "true"}"
${context.hasAnalysis ? "" : "disabled"}>
<span>${localize("KSA.Action.ShowWarnings")}</span>
</button>
<button
type="button"
class="button ${context.showAll ? "active" : ""}"
data-action="toggleShowAll"
data-mode="all"
aria-pressed="${context.showAll ? "true" : "false"}"
${context.hasAnalysis ? "" : "disabled"}>
<span>${localize("KSA.Action.ShowAll")}</span>
</button>
</div>
</div>
</div> </div>
</section> </section>
${renderProgress(context.progress, context.loading)} ${renderProgress(context.progress, context.loading)}
${renderNotices(context.notices, context.loading)} ${renderNotices(context.notices, 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)}
`; `;
return container; return container;
} }
@@ -133,16 +106,6 @@ export class StorageAuditReportApp extends foundry.applications.api.ApplicationV
} }
} }
toggleShowAll() {
this.#showAll = !this.#showAll;
return this.render({ force: true });
}
setShowAll(value) {
this.#showAll = !!value;
return this.render({ force: true });
}
exportReport() { exportReport() {
if (!this.#analysis) return; if (!this.#analysis) return;
const payload = { const payload = {
@@ -203,17 +166,6 @@ export class StorageAuditReportApp extends foundry.applications.api.ApplicationV
return this.runAnalysis(); return this.runAnalysis();
} }
static #onToggleShowAll(_event, _button) {
const mode = _button?.dataset?.mode;
if (mode === "warnings") {
return this.setShowAll(false);
}
if (mode === "all") {
return this.setShowAll(true);
}
return this.toggleShowAll();
}
static #onExportReport(_event, _button) { static #onExportReport(_event, _button) {
return this.exportReport(); return this.exportReport();
} }
@@ -299,7 +251,7 @@ function renderSummary(summary, loading) {
`; `;
} }
function renderGroupedFindingList(groupedFindings, hasAnalysis, loading, showAll) { function renderGroupedFindingList(groupedFindings, hasAnalysis, loading) {
if (loading || !hasAnalysis) return ""; if (loading || !hasAnalysis) return "";
const sections = []; const sections = [];
@@ -327,7 +279,7 @@ function renderGroupedFindingList(groupedFindings, hasAnalysis, loading, showAll
)); ));
} }
if (showAll && groupedFindings.orphans.length) { if (groupedFindings.orphans.length) {
sections.push(renderGroupedSection( sections.push(renderGroupedSection(
localize("KSA.Section.OrphanCandidates"), localize("KSA.Section.OrphanCandidates"),
localize("KSA.Section.OrphanCandidatesDesc"), localize("KSA.Section.OrphanCandidatesDesc"),
@@ -344,7 +296,7 @@ function renderGroupedFindingList(groupedFindings, hasAnalysis, loading, showAll
<section class="storage-audit__grouped"> <section class="storage-audit__grouped">
<div class="storage-audit__group-header"> <div class="storage-audit__group-header">
<h3>${localize("KSA.Section.WorkView")}</h3> <h3>${localize("KSA.Section.WorkView")}</h3>
<p>${format("KSA.Section.NoGrouped", { scope: localize(showAll ? "KSA.Scope.Empty" : "KSA.Scope.Warning") })}</p> <p>${localize("KSA.Section.NoGrouped")}</p>
</div> </div>
</section> </section>
`; `;

View File

@@ -163,32 +163,6 @@
width: 100%; width: 100%;
} }
.storage-audit__toggle-group {
display: grid;
gap: 0.35rem;
}
.storage-audit__toggle-label {
font-size: 0.9em;
opacity: 0.8;
padding: 0 0.2rem;
}
.storage-audit__toggle-buttons {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 0.45rem;
}
.storage-audit__toggle-buttons .button {
min-width: 0;
}
.storage-audit__toggle-buttons .button.active {
box-shadow: inset 0 0 0 2px color-mix(in srgb, currentColor 25%, transparent);
background: color-mix(in srgb, currentColor 10%, transparent);
}
.storage-audit__actions .button[disabled] { .storage-audit__actions .button[disabled] {
opacity: 0.5; opacity: 0.5;
} }