Show shelf paths in settings and force rescan after path changes.
This commit is contained in:
parent
8200b908e1
commit
71c0244dd9
3 changed files with 36 additions and 4 deletions
|
|
@ -46,6 +46,7 @@ interface ShelfRow {
|
|||
enabled: boolean;
|
||||
scanRootCount: number;
|
||||
mediaFileCount: number;
|
||||
paths?: Array<{ path: string; nodeName: string }>;
|
||||
}
|
||||
|
||||
export default function SettingsPage() {
|
||||
|
|
@ -318,7 +319,7 @@ export default function SettingsPage() {
|
|||
<tr>
|
||||
<th>Naam</th>
|
||||
<th>Type</th>
|
||||
<th>Paden</th>
|
||||
<th>Pad(en)</th>
|
||||
<th>Bestanden</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
|
|
@ -328,8 +329,25 @@ export default function SettingsPage() {
|
|||
<tr key={s.id}>
|
||||
<td>{s.name}</td>
|
||||
<td>{s.kind === "MOVIE" ? "Films" : "Series"}</td>
|
||||
<td>{s.scanRootCount}</td>
|
||||
<td>{s.mediaFileCount}</td>
|
||||
<td style={{ fontSize: "0.8rem", maxWidth: 360 }}>
|
||||
{s.paths?.length
|
||||
? s.paths.map((p) => (
|
||||
<div key={`${p.nodeName}:${p.path}`} style={{ color: "#a1a1aa", marginBottom: 2 }}>
|
||||
<span style={{ color: "#71717a" }}>{p.nodeName}:</span> {p.path}
|
||||
</div>
|
||||
))
|
||||
: (
|
||||
<span style={{ color: "#71717a" }}>{s.scanRootCount} pad(en)</span>
|
||||
)}
|
||||
</td>
|
||||
<td>
|
||||
{s.mediaFileCount}
|
||||
{s.scanRootCount > 0 && s.mediaFileCount === 0 && (
|
||||
<div style={{ color: "#f59e0b", fontSize: "0.75rem" }}>
|
||||
Pad gekoppeld, nog geen scan/shelf-match
|
||||
</div>
|
||||
)}
|
||||
</td>
|
||||
<td>
|
||||
{s.slug !== "films" && s.slug !== "series" && (
|
||||
<button className="danger" onClick={() => deleteShelf(s.id, s.name)}>
|
||||
|
|
|
|||
|
|
@ -517,7 +517,13 @@ export async function registerAdminRoutes(app: FastifyInstance, config: Config)
|
|||
await ensureDefaultShelves();
|
||||
const shelves = await prisma.libraryShelf.findMany({
|
||||
orderBy: [{ sortOrder: "asc" }, { name: "asc" }],
|
||||
include: { _count: { select: { scanRoots: true, mediaFiles: true } } },
|
||||
include: {
|
||||
_count: { select: { scanRoots: true, mediaFiles: true } },
|
||||
scanRoots: {
|
||||
select: { path: true, node: { select: { name: true } } },
|
||||
orderBy: { path: "asc" },
|
||||
},
|
||||
},
|
||||
});
|
||||
return {
|
||||
shelves: shelves.map((s) => ({
|
||||
|
|
@ -529,6 +535,10 @@ export async function registerAdminRoutes(app: FastifyInstance, config: Config)
|
|||
enabled: s.enabled,
|
||||
scanRootCount: s._count.scanRoots,
|
||||
mediaFileCount: s._count.mediaFiles,
|
||||
paths: s.scanRoots.map((r) => ({
|
||||
path: r.path,
|
||||
nodeName: r.node.name,
|
||||
})),
|
||||
})),
|
||||
};
|
||||
});
|
||||
|
|
|
|||
|
|
@ -305,6 +305,10 @@ export async function registerNodeRoutes(app: FastifyInstance) {
|
|||
kind: r.kind,
|
||||
})),
|
||||
});
|
||||
// Ensure a full inventory pass so shelfIds are rewritten for existing files.
|
||||
if (replacedRoots) {
|
||||
nodeConnectionManager.sendRescan(id, true);
|
||||
}
|
||||
}
|
||||
|
||||
return { node: serializeNode(node) };
|
||||
|
|
|
|||
Loading…
Reference in a new issue