Replace finding filters with explicit toggles
This commit is contained in:
@@ -67,14 +67,52 @@ export class StorageAuditReportApp extends foundry.applications.api.ApplicationV
|
||||
<i class="fa-solid fa-file-export"></i>
|
||||
<span>${localize("KSA.Action.Export")}</span>
|
||||
</button>
|
||||
<button type="button" class="button" data-action="toggleShowAll" ${context.hasAnalysis ? "" : "disabled"}>
|
||||
<i class="fa-solid fa-filter"></i>
|
||||
<span>${context.showAll ? localize("KSA.Action.ShowWarnings") : localize("KSA.Action.ShowAll")}</span>
|
||||
</button>
|
||||
<button type="button" class="button" data-action="toggleRaw" ${context.hasAnalysis ? "" : "disabled"}>
|
||||
<i class="fa-solid fa-list"></i>
|
||||
<span>${context.showRaw ? localize("KSA.Action.HideRaw") : localize("KSA.Action.ShowRaw")}</span>
|
||||
</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 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)}
|
||||
@@ -122,11 +160,21 @@ export class StorageAuditReportApp extends foundry.applications.api.ApplicationV
|
||||
return this.render({ force: true });
|
||||
}
|
||||
|
||||
setShowAll(value) {
|
||||
this.#showAll = !!value;
|
||||
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 = {
|
||||
@@ -187,10 +235,24 @@ export class StorageAuditReportApp extends foundry.applications.api.ApplicationV
|
||||
}
|
||||
|
||||
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 #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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user