show file name in scan log, fix progress total by using Jellyfin page callback
Build and Push Docker Image / build (push) Successful in 33s
Build and Push Docker Image / build (push) Successful in 33s
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -3,8 +3,8 @@ import { api } from '~/shared/lib/api';
|
||||
import { Button } from '~/shared/components/ui/button';
|
||||
import { Badge } from '~/shared/components/ui/badge';
|
||||
|
||||
interface ScanStatus { running: boolean; progress: { scanned: number; total: number; errors: number }; recentItems: { name: string; type: string; scan_status: string }[]; scanLimit: number | null; }
|
||||
interface LogEntry { name: string; type: string; status: string; }
|
||||
interface ScanStatus { running: boolean; progress: { scanned: number; total: number; errors: number }; recentItems: { name: string; type: string; scan_status: string; file_path: string }[]; scanLimit: number | null; }
|
||||
interface LogEntry { name: string; type: string; status: string; file?: string; }
|
||||
|
||||
// Mutable buffer for SSE data — flushed to React state on an interval
|
||||
interface SseBuf {
|
||||
@@ -93,7 +93,7 @@ export function ScanPage() {
|
||||
setErrors(s.progress.errors);
|
||||
setStatusLabel(s.running ? 'Scan in progress…' : 'Scan idle');
|
||||
if (s.scanLimit != null) setLimit(String(s.scanLimit));
|
||||
setLog(s.recentItems.map((i) => ({ name: i.name, type: i.type, status: i.scan_status })));
|
||||
setLog(s.recentItems.map((i) => ({ name: i.name, type: i.type, status: i.scan_status, file: i.file_path })));
|
||||
};
|
||||
|
||||
useEffect(() => { load(); }, []);
|
||||
@@ -204,13 +204,15 @@ export function ScanPage() {
|
||||
{errors > 0 && <Badge variant="error">{errors} error(s)</Badge>}
|
||||
</div>
|
||||
|
||||
{(running || progressTotal > 0) && (
|
||||
{(running || progressScanned > 0) && (
|
||||
<>
|
||||
<div className="bg-gray-200 rounded-full h-1.5 overflow-hidden my-2">
|
||||
<div className="h-full bg-blue-600 rounded-full transition-all duration-300" style={{ width: `${pct}%` }} />
|
||||
</div>
|
||||
{progressTotal > 0 && (
|
||||
<div className="bg-gray-200 rounded-full h-1.5 overflow-hidden my-2">
|
||||
<div className="h-full bg-blue-600 rounded-full transition-all duration-300" style={{ width: `${pct}%` }} />
|
||||
</div>
|
||||
)}
|
||||
<div className="flex items-center gap-2 text-gray-500 text-xs">
|
||||
<span>{progressScanned} / {progressTotal}</span>
|
||||
<span>{progressScanned}{progressTotal > 0 ? ` / ${progressTotal}` : ''} scanned</span>
|
||||
{currentItem && <span className="truncate max-w-xs text-gray-400">{currentItem}</span>}
|
||||
</div>
|
||||
</>
|
||||
@@ -222,21 +224,24 @@ export function ScanPage() {
|
||||
<table className="w-full border-collapse text-[0.82rem]">
|
||||
<thead>
|
||||
<tr>
|
||||
{['Type', 'Name', 'Status'].map((h) => (
|
||||
{['Type', 'File', 'Status'].map((h) => (
|
||||
<th key={h} className="text-left text-[0.68rem] font-bold uppercase tracking-[0.06em] text-gray-500 py-1 px-2 border-b-2 border-gray-200 whitespace-nowrap">{h}</th>
|
||||
))}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{log.map((item, i) => (
|
||||
<tr key={i} className="hover:bg-gray-50">
|
||||
<td className="py-1.5 px-2 border-b border-gray-100">{item.type}</td>
|
||||
<td className="py-1.5 px-2 border-b border-gray-100">{item.name}</td>
|
||||
<td className="py-1.5 px-2 border-b border-gray-100">
|
||||
<Badge variant={item.status as 'error' | 'done' | 'pending'}>{item.status}</Badge>
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
{log.map((item, i) => {
|
||||
const fileName = item.file ? item.file.split('/').pop() ?? item.name : item.name;
|
||||
return (
|
||||
<tr key={i} className="hover:bg-gray-50">
|
||||
<td className="py-1.5 px-2 border-b border-gray-100">{item.type}</td>
|
||||
<td className="py-1.5 px-2 border-b border-gray-100" title={item.file ?? item.name}>{fileName}</td>
|
||||
<td className="py-1.5 px-2 border-b border-gray-100">
|
||||
<Badge variant={item.status as 'error' | 'done' | 'pending'}>{item.status}</Badge>
|
||||
</td>
|
||||
</tr>
|
||||
);
|
||||
})}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user