Remove misleading severity filter
This commit is contained in:
@@ -5,7 +5,6 @@ export class StorageAuditReportApp extends foundry.applications.api.ApplicationV
|
||||
tag: "div",
|
||||
actions: {
|
||||
runAnalysis: StorageAuditReportApp.#onRunAnalysis,
|
||||
toggleShowAll: StorageAuditReportApp.#onToggleShowAll,
|
||||
exportReport: StorageAuditReportApp.#onExportReport
|
||||
},
|
||||
window: {
|
||||
@@ -21,7 +20,6 @@ export class StorageAuditReportApp extends foundry.applications.api.ApplicationV
|
||||
|
||||
#analysis = null;
|
||||
#loading = false;
|
||||
#showAll = false;
|
||||
#progress = null;
|
||||
|
||||
constructor(options = {}) {
|
||||
@@ -31,12 +29,10 @@ export class StorageAuditReportApp extends foundry.applications.api.ApplicationV
|
||||
|
||||
async _prepareContext() {
|
||||
const findings = this.#analysis?.findings ?? [];
|
||||
const visibleFindings = this.#showAll ? findings : findings.filter(f => f.severity !== "info");
|
||||
const groupedFindings = await enrichGroupedFindings(groupFindings(visibleFindings));
|
||||
const groupedFindings = await enrichGroupedFindings(groupFindings(findings));
|
||||
return {
|
||||
loading: this.#loading,
|
||||
hasAnalysis: !!this.#analysis,
|
||||
showAll: this.#showAll,
|
||||
progress: this.#progress,
|
||||
notices: this.#analysis?.notices ?? [],
|
||||
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>
|
||||
<span>${localize("KSA.Action.Export")}</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>
|
||||
</section>
|
||||
${renderProgress(context.progress, context.loading)}
|
||||
${renderNotices(context.notices, 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;
|
||||
}
|
||||
@@ -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() {
|
||||
if (!this.#analysis) return;
|
||||
const payload = {
|
||||
@@ -203,17 +166,6 @@ export class StorageAuditReportApp extends foundry.applications.api.ApplicationV
|
||||
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) {
|
||||
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 "";
|
||||
|
||||
const sections = [];
|
||||
@@ -327,7 +279,7 @@ function renderGroupedFindingList(groupedFindings, hasAnalysis, loading, showAll
|
||||
));
|
||||
}
|
||||
|
||||
if (showAll && groupedFindings.orphans.length) {
|
||||
if (groupedFindings.orphans.length) {
|
||||
sections.push(renderGroupedSection(
|
||||
localize("KSA.Section.OrphanCandidates"),
|
||||
localize("KSA.Section.OrphanCandidatesDesc"),
|
||||
@@ -344,7 +296,7 @@ function renderGroupedFindingList(groupedFindings, hasAnalysis, loading, showAll
|
||||
<section class="storage-audit__grouped">
|
||||
<div class="storage-audit__group-header">
|
||||
<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>
|
||||
</section>
|
||||
`;
|
||||
|
||||
Reference in New Issue
Block a user