feat: add catalog audit page
Checks for: - items_base entries without catalog_items (not purchasable) - catalog_items referencing non-existent items_base - Items without .nitro or icon files on disk - Duplicate classnames - Items missing from all configured clone sources
This commit is contained in:
1 parent
90107c83d5
commit
19e4e10b1d
6 files changed
+607
-1
No files matched your search
@@ -0,0 +1,347 @@
|
||||
"use client";
|
||||
|
||||
import {
|
||||
AlertCircle,
|
||||
CheckCircle2,
|
||||
ClipboardList,
|
||||
ExternalLink,
|
||||
Loader2,
|
||||
SearchX,
|
||||
} from "lucide-react";
|
||||
import { useCallback, useState } from "react";
|
||||
import { toast } from "sonner";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { adminFetch } from "@/lib/admin-fetch";
|
||||
|
||||
interface AuditIssue {
|
||||
type: string;
|
||||
severity: "error" | "warning" | "info";
|
||||
classname?: string;
|
||||
itemId?: number;
|
||||
catalogId?: number;
|
||||
message: string;
|
||||
sourceName?: string;
|
||||
}
|
||||
|
||||
interface MissingFromSource {
|
||||
sourceName: string;
|
||||
sourceId: string;
|
||||
classname: string;
|
||||
itemName: string;
|
||||
}
|
||||
|
||||
interface AuditResult {
|
||||
issues: AuditIssue[];
|
||||
missingFromSources: MissingFromSource[];
|
||||
summary: {
|
||||
totalItemsBase: number;
|
||||
totalCatalogItems: number;
|
||||
missingCatalog: number;
|
||||
orphanedCatalog: number;
|
||||
missingNitro: number;
|
||||
missingIcon: number;
|
||||
duplicates: number;
|
||||
missingFromSourcesTotal: number;
|
||||
};
|
||||
}
|
||||
|
||||
const ICON_COLORS: Record<string, string> = {
|
||||
error: "text-[var(--admin-error)]",
|
||||
warning: "text-[var(--admin-warning)]",
|
||||
info: "text-[var(--admin-text-muted)]",
|
||||
};
|
||||
|
||||
const TYPE_LABELS: Record<string, string> = {
|
||||
missing_catalog: "No catalog entry",
|
||||
orphaned_catalog: "Orphaned catalog reference",
|
||||
missing_nitro: "Missing .nitro file",
|
||||
missing_icon: "Missing icon file",
|
||||
duplicate_classname: "Duplicate classname",
|
||||
source_fetch_failed: "Source fetch failed",
|
||||
sources_list_failed: "Sources list failed",
|
||||
};
|
||||
|
||||
export function AuditClient() {
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [result, setResult] = useState<AuditResult | null>(null);
|
||||
const [progress, setProgress] = useState("");
|
||||
const [activeTab, setActiveTab] = useState<"issues" | "sources">("issues");
|
||||
|
||||
const runAudit = useCallback(async () => {
|
||||
setLoading(true);
|
||||
setResult(null);
|
||||
setProgress("Starting audit…");
|
||||
|
||||
try {
|
||||
const res = await adminFetch("/api/admin/import/audit", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({}),
|
||||
});
|
||||
|
||||
if (!res.ok) {
|
||||
const data = await res.json().catch(() => ({}));
|
||||
toast.error(data.error || "Audit failed");
|
||||
setProgress("");
|
||||
setLoading(false);
|
||||
return;
|
||||
}
|
||||
|
||||
const data = await res.json();
|
||||
setResult(data);
|
||||
toast.success("Audit complete");
|
||||
} catch {
|
||||
toast.error("Audit request failed");
|
||||
} finally {
|
||||
setLoading(false);
|
||||
setProgress("");
|
||||
}
|
||||
}, []);
|
||||
|
||||
const hasIssues = result && result.issues.length > 0;
|
||||
const errors = result?.issues.filter((i) => i.severity === "error") ?? [];
|
||||
const warnings = result?.issues.filter((i) => i.severity === "warning") ?? [];
|
||||
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
{!result && (
|
||||
<Button onClick={runAudit} disabled={loading} size="lg">
|
||||
{loading ? (
|
||||
<Loader2 className="w-4 h-4 animate-spin mr-2" />
|
||||
) : (
|
||||
<ClipboardList className="w-4 h-4 mr-2" />
|
||||
)}
|
||||
{loading ? progress || "Running…" : "Run Full Catalog Audit"}
|
||||
</Button>
|
||||
)}
|
||||
|
||||
{result && (
|
||||
<>
|
||||
{/* Summary cards */}
|
||||
<div className="grid gap-3 sm:grid-cols-2 lg:grid-cols-4">
|
||||
<div className="rounded-xl border bg-card p-4 space-y-1">
|
||||
<div className="text-2xl font-bold">
|
||||
{result.summary.totalItemsBase}
|
||||
</div>
|
||||
<div className="text-xs text-muted-foreground">
|
||||
items_base entries
|
||||
</div>
|
||||
</div>
|
||||
<div className="rounded-xl border bg-card p-4 space-y-1">
|
||||
<div className="text-2xl font-bold">
|
||||
{result.summary.totalCatalogItems}
|
||||
</div>
|
||||
<div className="text-xs text-muted-foreground">
|
||||
catalog_items entries
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
className={`rounded-xl border p-4 space-y-1 ${errors.length > 0 ? "border-[var(--admin-error-border)] bg-[var(--admin-error-subtle)]" : "bg-card"}`}
|
||||
>
|
||||
<div
|
||||
className={`text-2xl font-bold ${errors.length > 0 ? "text-[var(--admin-error)]" : ""}`}
|
||||
>
|
||||
{errors.length}
|
||||
</div>
|
||||
<div className="text-xs text-muted-foreground">Errors</div>
|
||||
</div>
|
||||
<div
|
||||
className={`rounded-xl border p-4 space-y-1 ${warnings.length > 0 ? "border-[var(--admin-warning-border)] bg-[var(--admin-warning-subtle)]" : "bg-card"}`}
|
||||
>
|
||||
<div
|
||||
className={`text-2xl font-bold ${warnings.length > 0 ? "text-[var(--admin-warning)]" : ""}`}
|
||||
>
|
||||
{warnings.length}
|
||||
</div>
|
||||
<div className="text-xs text-muted-foreground">Warnings</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Quick stats */}
|
||||
<div className="grid gap-2 sm:grid-cols-3 text-sm">
|
||||
<div className="flex items-center gap-2">
|
||||
{result.summary.missingCatalog > 0 ? (
|
||||
<AlertCircle className="w-4 h-4 text-[var(--admin-warning)]" />
|
||||
) : (
|
||||
<CheckCircle2 className="w-4 h-4 text-[var(--admin-success)]" />
|
||||
)}
|
||||
<span>
|
||||
{result.summary.missingCatalog} items without catalog entry
|
||||
</span>
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
{result.summary.orphanedCatalog > 0 ? (
|
||||
<AlertCircle className="w-4 h-4 text-[var(--admin-error)]" />
|
||||
) : (
|
||||
<CheckCircle2 className="w-4 h-4 text-[var(--admin-success)]" />
|
||||
)}
|
||||
<span>
|
||||
{result.summary.orphanedCatalog} orphaned catalog references
|
||||
</span>
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
{result.summary.missingNitro > 0 ? (
|
||||
<AlertCircle className="w-4 h-4 text-[var(--admin-error)]" />
|
||||
) : (
|
||||
<CheckCircle2 className="w-4 h-4 text-[var(--admin-success)]" />
|
||||
)}
|
||||
<span>{result.summary.missingNitro} items without .nitro</span>
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
{result.summary.missingIcon > 0 ? (
|
||||
<AlertCircle className="w-4 h-4 text-[var(--admin-warning)]" />
|
||||
) : (
|
||||
<CheckCircle2 className="w-4 h-4 text-[var(--admin-success)]" />
|
||||
)}
|
||||
<span>{result.summary.missingIcon} items without icon</span>
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
{result.summary.duplicates > 0 ? (
|
||||
<AlertCircle className="w-4 h-4 text-[var(--admin-error)]" />
|
||||
) : (
|
||||
<CheckCircle2 className="w-4 h-4 text-[var(--admin-success)]" />
|
||||
)}
|
||||
<span>{result.summary.duplicates} duplicate classnames</span>
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
{result.summary.missingFromSourcesTotal > 0 ? (
|
||||
<AlertCircle className="w-4 h-4 text-[var(--admin-warning)]" />
|
||||
) : (
|
||||
<CheckCircle2 className="w-4 h-4 text-[var(--admin-success)]" />
|
||||
)}
|
||||
<span>
|
||||
{result.summary.missingFromSourcesTotal} items missing from
|
||||
clone sources
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Tabs */}
|
||||
{hasIssues || result.missingFromSources.length > 0 ? (
|
||||
<div className="border-b border-border">
|
||||
<div className="flex gap-4">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setActiveTab("issues")}
|
||||
className={`pb-2 text-sm font-medium border-b-2 transition-colors ${
|
||||
activeTab === "issues"
|
||||
? "border-primary text-foreground"
|
||||
: "border-transparent text-muted-foreground hover:text-foreground"
|
||||
}`}
|
||||
>
|
||||
Issues ({result.issues.length})
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setActiveTab("sources")}
|
||||
className={`pb-2 text-sm font-medium border-b-2 transition-colors ${
|
||||
activeTab === "sources"
|
||||
? "border-primary text-foreground"
|
||||
: "border-transparent text-muted-foreground hover:text-foreground"
|
||||
}`}
|
||||
>
|
||||
Missing from sources ({result.missingFromSources.length})
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
{/* Issues list */}
|
||||
{activeTab === "issues" && hasIssues && (
|
||||
<div className="space-y-2">
|
||||
{result.issues.map((issue) => (
|
||||
<div
|
||||
key={issue.message}
|
||||
className={`rounded-xl border p-4 text-sm ${
|
||||
issue.severity === "error"
|
||||
? "border-[var(--admin-error-border)] bg-[var(--admin-error-subtle)]"
|
||||
: issue.severity === "warning"
|
||||
? "border-[var(--admin-warning-border)] bg-[var(--admin-warning-subtle)]"
|
||||
: "bg-card"
|
||||
}`}
|
||||
>
|
||||
<div className="flex items-start gap-2">
|
||||
<AlertCircle
|
||||
className={`w-4 h-4 mt-0.5 shrink-0 ${ICON_COLORS[issue.severity]}`}
|
||||
/>
|
||||
<div className="space-y-0.5 min-w-0">
|
||||
<div className="flex items-center gap-2 flex-wrap">
|
||||
<span
|
||||
className={`font-medium ${ICON_COLORS[issue.severity]}`}
|
||||
>
|
||||
{TYPE_LABELS[issue.type] || issue.type}
|
||||
</span>
|
||||
{issue.classname && (
|
||||
<code className="text-xs bg-background/50 px-1.5 py-0.5 rounded font-mono">
|
||||
{issue.classname}
|
||||
</code>
|
||||
)}
|
||||
{issue.sourceName && (
|
||||
<span className="text-xs text-muted-foreground">
|
||||
source: {issue.sourceName}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
<p className="text-muted-foreground">{issue.message}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Missing from sources list */}
|
||||
{activeTab === "sources" && result.missingFromSources.length > 0 && (
|
||||
<div className="space-y-2">
|
||||
{result.missingFromSources.map((item) => (
|
||||
<div
|
||||
key={`${item.sourceId}-${item.classname}`}
|
||||
className="rounded-xl border bg-card p-3 text-sm flex items-center gap-2"
|
||||
>
|
||||
<ExternalLink className="w-3.5 h-3.5 text-muted-foreground shrink-0" />
|
||||
<code className="font-mono text-xs">{item.classname}</code>
|
||||
<span className="text-xs text-muted-foreground">
|
||||
— {item.itemName}
|
||||
</span>
|
||||
<span className="text-xs text-muted-foreground ml-auto">
|
||||
in {item.sourceName}
|
||||
</span>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{activeTab === "issues" &&
|
||||
!hasIssues &&
|
||||
result.missingFromSources.length === 0 && (
|
||||
<div className="rounded-xl border bg-card p-12 text-center text-muted-foreground">
|
||||
<CheckCircle2 className="w-12 h-12 mx-auto mb-3 text-[var(--admin-success)]" />
|
||||
<p className="text-lg font-medium">No issues found</p>
|
||||
<p className="text-sm">Your catalog is clean!</p>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<Button
|
||||
variant="outline"
|
||||
onClick={() => {
|
||||
setResult(null);
|
||||
setProgress("");
|
||||
}}
|
||||
>
|
||||
Run Again
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
|
||||
{!loading && !result && (
|
||||
<div className="rounded-xl border bg-card p-12 text-center text-muted-foreground">
|
||||
<SearchX className="w-12 h-12 mx-auto mb-3 opacity-40" />
|
||||
<p>
|
||||
Run a full audit to check for missing catalog entries, broken
|
||||
references, missing files, and items available from clone sources.
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
import { redirect } from "next/navigation";
|
||||
import { canAccess, getAdminContext, PERMS } from "@/lib/permissions";
|
||||
import { AuditClient } from "./audit-client";
|
||||
|
||||
export default async function AuditPage() {
|
||||
const { session, permissions } = await getAdminContext();
|
||||
if (!canAccess(permissions, PERMS.ASSETS_IMPORT, session.user.rank)) {
|
||||
redirect("/admin");
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
<div>
|
||||
<h1 className="text-2xl font-bold tracking-tight">Catalog Audit</h1>
|
||||
<p className="text-muted-foreground mt-1">
|
||||
Scan your entire furniture catalog for missing entries, broken
|
||||
references, missing files, and items available from clone sources.
|
||||
</p>
|
||||
</div>
|
||||
<AuditClient />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
import {
|
||||
BadgeCheck,
|
||||
Cat,
|
||||
ClipboardCheck,
|
||||
Copy,
|
||||
Dumbbell,
|
||||
ImageIcon,
|
||||
@@ -76,6 +77,12 @@ export default async function ImportPage() {
|
||||
icon: ImageIcon,
|
||||
description: t("repairIconsDescription"),
|
||||
},
|
||||
{
|
||||
href: "/admin/import/audit",
|
||||
label: t("audit"),
|
||||
icon: ClipboardCheck,
|
||||
description: t("auditDescription"),
|
||||
},
|
||||
] as const;
|
||||
|
||||
return (
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
import { withAdmin } from "@/lib/api-handler";
|
||||
import { apiError, apiOk } from "@/lib/api-response";
|
||||
import { PERMS } from "@/lib/permissions";
|
||||
import { runCatalogAudit } from "@/lib/services/catalog-audit";
|
||||
|
||||
export const POST = withAdmin({ permission: PERMS.ASSETS_IMPORT }, async () => {
|
||||
try {
|
||||
const result = await runCatalogAudit();
|
||||
return apiOk(result as unknown as Record<string, unknown>);
|
||||
} catch (err) {
|
||||
return apiError(`Audit failed: ${(err as Error).message}`, 500);
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,214 @@
|
||||
import { existsSync } from "node:fs";
|
||||
import path from "node:path";
|
||||
import { prisma } from "@/lib/prisma";
|
||||
import { fetchSourceFurnidata } from "@/lib/services/clone-import";
|
||||
import { listSources } from "@/lib/services/clone-sources";
|
||||
import { getFurniAssetDirs } from "@/lib/services/furni-asset-dirs";
|
||||
import { ensureDirectories } from "./furni-import";
|
||||
|
||||
export interface AuditIssue {
|
||||
type: string;
|
||||
severity: "error" | "warning" | "info";
|
||||
classname?: string;
|
||||
itemId?: number;
|
||||
catalogId?: number;
|
||||
message: string;
|
||||
sourceName?: string;
|
||||
}
|
||||
|
||||
export interface MissingFromSource {
|
||||
sourceName: string;
|
||||
sourceId: string;
|
||||
classname: string;
|
||||
itemName: string;
|
||||
}
|
||||
|
||||
export interface AuditResult {
|
||||
issues: AuditIssue[];
|
||||
missingFromSources: MissingFromSource[];
|
||||
summary: {
|
||||
totalItemsBase: number;
|
||||
totalCatalogItems: number;
|
||||
missingCatalog: number;
|
||||
orphanedCatalog: number;
|
||||
missingNitro: number;
|
||||
missingIcon: number;
|
||||
duplicates: number;
|
||||
missingFromSourcesTotal: number;
|
||||
};
|
||||
}
|
||||
|
||||
export async function runCatalogAudit(
|
||||
onProgress?: (msg: string) => void,
|
||||
): Promise<AuditResult> {
|
||||
const issues: AuditIssue[] = [];
|
||||
const missingFromSources: MissingFromSource[] = [];
|
||||
|
||||
onProgress?.("Loading directories…");
|
||||
await ensureDirectories();
|
||||
const { iconDir, nitroDir } = await getFurniAssetDirs();
|
||||
|
||||
onProgress?.("Loading items_base…");
|
||||
const items = await prisma.$queryRaw<
|
||||
Array<{ id: number; item_name: string; public_name: string; type: string }>
|
||||
>`SELECT id, item_name, public_name, type FROM items_base ORDER BY id`;
|
||||
|
||||
onProgress?.("Loading catalog_items…");
|
||||
const catalogItems = await prisma.$queryRaw<
|
||||
Array<{ id: number; item_ids: string; catalog_name: string }>
|
||||
>`SELECT id, item_ids, catalog_name FROM catalog_items ORDER BY id`;
|
||||
|
||||
const summary = {
|
||||
totalItemsBase: items.length,
|
||||
totalCatalogItems: catalogItems.length,
|
||||
missingCatalog: 0,
|
||||
orphanedCatalog: 0,
|
||||
missingNitro: 0,
|
||||
missingIcon: 0,
|
||||
duplicates: 0,
|
||||
missingFromSourcesTotal: 0,
|
||||
};
|
||||
|
||||
// Build lookup: set of items_base IDs that have catalog entries
|
||||
const itemIdsWithCatalog = new Set<number>();
|
||||
const itemNamesWithCatalog = new Set<string>();
|
||||
for (const ci of catalogItems) {
|
||||
const ids = ci.item_ids.split(";").map(Number).filter(Boolean);
|
||||
for (const id of ids) {
|
||||
itemIdsWithCatalog.add(id);
|
||||
}
|
||||
itemNamesWithCatalog.add(ci.catalog_name);
|
||||
}
|
||||
|
||||
// Build items_base lookup by id and name
|
||||
const itemById = new Map<number, (typeof items)[0]>();
|
||||
const itemByName = new Map<string, (typeof items)[0]>();
|
||||
const classnameCount = new Map<string, number>();
|
||||
|
||||
for (const item of items) {
|
||||
itemById.set(item.id, item);
|
||||
itemByName.set(item.item_name, item);
|
||||
classnameCount.set(
|
||||
item.item_name,
|
||||
(classnameCount.get(item.item_name) ?? 0) + 1,
|
||||
);
|
||||
}
|
||||
|
||||
onProgress?.("Checking items_base entries…");
|
||||
for (const item of items) {
|
||||
if (!itemIdsWithCatalog.has(item.id)) {
|
||||
summary.missingCatalog++;
|
||||
issues.push({
|
||||
type: "missing_catalog",
|
||||
severity: "warning",
|
||||
classname: item.item_name,
|
||||
itemId: item.id,
|
||||
message: `"${item.item_name}" (ID ${item.id}) has no catalog_items entry — not purchasable`,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
onProgress?.("Checking for duplicate classnames…");
|
||||
for (const [name, count] of classnameCount) {
|
||||
if (count > 1) {
|
||||
summary.duplicates++;
|
||||
issues.push({
|
||||
type: "duplicate_classname",
|
||||
severity: "error",
|
||||
classname: name,
|
||||
message: `"${name}" appears ${count} times in items_base`,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
onProgress?.("Checking catalog_items for orphaned references…");
|
||||
for (const ci of catalogItems) {
|
||||
const ids = ci.item_ids.split(";").map(Number).filter(Boolean);
|
||||
for (const id of ids) {
|
||||
if (!itemById.has(id)) {
|
||||
summary.orphanedCatalog++;
|
||||
issues.push({
|
||||
type: "orphaned_catalog",
|
||||
severity: "error",
|
||||
catalogId: ci.id,
|
||||
message: `catalog_items ID ${ci.id} ("${ci.catalog_name}") references items_base ID ${id} which does not exist`,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onProgress?.("Checking .nitro files…");
|
||||
for (const item of items) {
|
||||
const nitroPath = path.join(nitroDir, `${item.item_name}.nitro`);
|
||||
if (!existsSync(nitroPath)) {
|
||||
summary.missingNitro++;
|
||||
issues.push({
|
||||
type: "missing_nitro",
|
||||
severity: "error",
|
||||
classname: item.item_name,
|
||||
itemId: item.id,
|
||||
message: `"${item.item_name}" (ID ${item.id}) has no .nitro file`,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
onProgress?.("Checking icon files…");
|
||||
for (const item of items) {
|
||||
const iconPath = path.join(iconDir, `${item.item_name}_icon.png`);
|
||||
if (!existsSync(iconPath)) {
|
||||
summary.missingIcon++;
|
||||
issues.push({
|
||||
type: "missing_icon",
|
||||
severity: "warning",
|
||||
classname: item.item_name,
|
||||
itemId: item.id,
|
||||
message: `"${item.item_name}" (ID ${item.id}) has no icon file`,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
onProgress?.("Comparing with clone sources…");
|
||||
try {
|
||||
const sources = await listSources();
|
||||
for (const source of sources) {
|
||||
try {
|
||||
const entries = await fetchSourceFurnidata(source.furnidataUrl);
|
||||
for (const entry of entries) {
|
||||
if (!itemByName.has(entry.classname)) {
|
||||
missingFromSources.push({
|
||||
sourceName: source.name,
|
||||
sourceId: source.id,
|
||||
classname: entry.classname,
|
||||
itemName: entry.name,
|
||||
});
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
issues.push({
|
||||
type: "source_fetch_failed",
|
||||
severity: "error",
|
||||
sourceName: source.name,
|
||||
message: `Failed to fetch furnidata from "${source.name}"`,
|
||||
});
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
issues.push({
|
||||
type: "sources_list_failed",
|
||||
severity: "error",
|
||||
message: `Failed to list clone sources: ${(err as Error).message}`,
|
||||
});
|
||||
}
|
||||
|
||||
summary.missingFromSourcesTotal = missingFromSources.length;
|
||||
|
||||
// Sort issues: errors first, then by type
|
||||
issues.sort((a, b) => {
|
||||
const sev = { error: 0, warning: 1, info: 2 };
|
||||
const diff = (sev[a.severity] ?? 0) - (sev[b.severity] ?? 0);
|
||||
if (diff !== 0) return diff;
|
||||
return a.type.localeCompare(b.type);
|
||||
});
|
||||
|
||||
return { issues, missingFromSources, summary };
|
||||
}
|
||||
@@ -2494,7 +2494,9 @@
|
||||
"sync": "Auto Sync",
|
||||
"syncDescription": "Automatically import missing furniture from all configured sources.",
|
||||
"repairIcons": "Repair Icons",
|
||||
"repairIconsDescription": "Download any missing icon files for furniture already in the database."
|
||||
"repairIconsDescription": "Download any missing icon files for furniture already in the database.",
|
||||
"audit": "Catalog Audit",
|
||||
"auditDescription": "Scan your catalog for missing entries, broken references, and items missing from clone sources."
|
||||
},
|
||||
"translations": {
|
||||
"title": "Translations",
|
||||
|
||||
Reference in new issue
Block a user