Replace finding filters with explicit toggles

This commit is contained in:
2026-04-21 13:09:12 +00:00
parent 7d299b31fe
commit 1fb62f17c8
5 changed files with 105 additions and 9 deletions

View File

@@ -16,8 +16,12 @@
"Run": "Analyse starten", "Run": "Analyse starten",
"Running": "Analysiere...", "Running": "Analysiere...",
"Export": "Report exportieren", "Export": "Report exportieren",
"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", "ShowRaw": "Einzelfälle anzeigen",
"HideRaw": "Einzelfälle ausblenden" "HideRaw": "Einzelfälle ausblenden"
}, },

View File

@@ -16,8 +16,12 @@
"Run": "Start Analysis", "Run": "Start Analysis",
"Running": "Analyzing...", "Running": "Analyzing...",
"Export": "Export Report", "Export": "Export Report",
"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", "ShowRaw": "Show Raw Entries",
"HideRaw": "Hide Raw Entries" "HideRaw": "Hide Raw Entries"
}, },

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

View File

@@ -67,15 +67,53 @@ 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>
<button type="button" class="button" data-action="toggleShowAll" ${context.hasAnalysis ? "" : "disabled"}> <div class="storage-audit__toggle-group" role="group" aria-label="${escapeHtml(localize("KSA.Action.ScopeLabel"))}">
<i class="fa-solid fa-filter"></i> <span class="storage-audit__toggle-label">${localize("KSA.Action.ScopeLabel")}</span>
<span>${context.showAll ? localize("KSA.Action.ShowWarnings") : localize("KSA.Action.ShowAll")}</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>
<button type="button" class="button" data-action="toggleRaw" ${context.hasAnalysis ? "" : "disabled"}> <button
<i class="fa-solid fa-list"></i> type="button"
<span>${context.showRaw ? localize("KSA.Action.HideRaw") : localize("KSA.Action.ShowRaw")}</span> 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> </button>
</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>
</section> </section>
${renderProgress(context.progress, context.loading)} ${renderProgress(context.progress, context.loading)}
${renderSummary(context.summary, context.loading)} ${renderSummary(context.summary, context.loading)}
@@ -122,11 +160,21 @@ export class StorageAuditReportApp extends foundry.applications.api.ApplicationV
return this.render({ force: true }); return this.render({ force: true });
} }
setShowAll(value) {
this.#showAll = !!value;
return this.render({ force: true });
}
toggleRaw() { toggleRaw() {
this.#showRaw = !this.#showRaw; this.#showRaw = !this.#showRaw;
return this.render({ force: true }); 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 = {
@@ -187,10 +235,24 @@ export class StorageAuditReportApp extends foundry.applications.api.ApplicationV
} }
static #onToggleShowAll(_event, _button) { 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(); return this.toggleShowAll();
} }
static #onToggleRaw(_event, _button) { 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(); return this.toggleRaw();
} }

View File

@@ -145,6 +145,32 @@
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;
} }